remove has_key usage stable
authorAurelien Campeas <aurelien.campeas@logilab.fr>
Fri, 28 Jun 2013 14:11:31 +0200
branchstable
changeset 716 134b04defd20
parent 715 042ea5e6e08c
child 717 5cad47e1ffbf
remove has_key usage
compare.py
stmts.py
test/unittest_analyze.py
--- a/compare.py	Wed Aug 07 20:07:53 2013 +0200
+++ b/compare.py	Fri Jun 28 14:11:31 2013 +0200
@@ -116,7 +116,7 @@
         r_list = canon['restriction'].setdefault(r_type, [])
         done = {}
         for key in keys:
-            if done.has_key(key):
+            if key in done:
                 continue
             done[key] = None
             for expr in canon_dict[key]:
--- a/stmts.py	Wed Aug 07 20:07:53 2013 +0200
+++ b/stmts.py	Fri Jun 28 14:11:31 2013 +0200
@@ -44,7 +44,7 @@
                 raise AssertionError('vref %r is not in the tree' % vref)
             refs[id(vref)] = 1
     for vref in varrefs:
-        if not refs.has_key(id(vref)):
+        if id(vref) not in refs:
             raise AssertionError('vref %r is not referenced (%r)' % (vref, vref.stmt))
     return True
 
@@ -998,7 +998,7 @@
         """add a relation to the list of inserted relations"""
         var = relation.children[0].variable
         rhs = relation.children[1]
-        if not self.inserted_variables.has_key(var):
+        if var not in self.inserted_variables:
             if isinstance(rhs, nodes.Constant):
                 msg = 'Using variable %s in declaration but %s is not an \
 insertion variable'
--- a/test/unittest_analyze.py	Wed Aug 07 20:07:53 2013 +0200
+++ b/test/unittest_analyze.py	Fri Jun 28 14:11:31 2013 +0200
@@ -170,10 +170,10 @@
         return self._relations.keys()
 
     def has_entity(self, e_type):
-        return self._types.has_key(e_type)
+        return e_type in self._types
 
     def has_relation(self, r_type):
-        return self._relations.has_key(r_type)
+        return r_type in self._relations
 
     def __contains__(self, ertype):
         return self.has_entity(ertype) or self.has_relation(ertype)