Patchwork [4,of,4] zeroconf: replace has_key with in

login
register
mail settings
Submitter timeless@mozdev.org
Date March 9, 2016, 4:24 a.m.
Message ID <a443820c59be348fe56b.1457497441@waste.org>
Download mbox | patch
Permalink /patch/13704/
State Accepted
Headers show

Comments

timeless@mozdev.org - March 9, 2016, 4:24 a.m.
# HG changeset patch
# User timeless <timeless@mozdev.org>
# Date 1456827730 0
#      Tue Mar 01 10:22:10 2016 +0000
# Node ID a443820c59be348fe56ba28ef2ef448ed9b97f1c
# Parent  8e2e04f015097b7df7121a8bc840ee8c43cb59d3
zeroconf: replace has_key with in
Pierre-Yves David - March 9, 2016, 6:05 p.m.
On 03/09/2016 04:24 AM, timeless wrote:
> # HG changeset patch
> # User timeless <timeless@mozdev.org>
> # Date 1456827730 0
> #      Tue Mar 01 10:22:10 2016 +0000
> # Node ID a443820c59be348fe56ba28ef2ef448ed9b97f1c
> # Parent  8e2e04f015097b7df7121a8bc840ee8c43cb59d3
> zeroconf: replace has_key with in

Pushed to the clowcopter, thanks

Patch

diff --git a/hgext/zeroconf/Zeroconf.py b/hgext/zeroconf/Zeroconf.py
--- a/hgext/zeroconf/Zeroconf.py
+++ b/hgext/zeroconf/Zeroconf.py
@@ -1389,7 +1389,7 @@ 
         changed if needed to make it unique on the network."""
         self.checkService(info)
         self.services[info.name.lower()] = info
-        if self.servicetypes.has_key(info.type):
+        if info.type in self.servicetypes:
             self.servicetypes[info.type] += 1
         else:
             self.servicetypes[info.type] = 1
@@ -1678,5 +1678,3 @@ 
     r.unregisterService(info)
     print("   Unregister done.")
     r.close()
-
-# no-check-code
diff --git a/tests/test-check-code.t b/tests/test-check-code.t
--- a/tests/test-check-code.t
+++ b/tests/test-check-code.t
@@ -8,7 +8,6 @@ 
 
   $ hg locate | sed 's-\\-/-g' |
   >   xargs "$check_code" --warnings --per-file=0 || false
-  Skipping hgext/zeroconf/Zeroconf.py it has no-che?k-code (glob)
   Skipping i18n/polib.py it has no-che?k-code (glob)
   Skipping mercurial/httpclient/__init__.py it has no-che?k-code (glob)
   Skipping mercurial/httpclient/_readers.py it has no-che?k-code (glob)