Fix deprecation warning in python 3 for has_key
authorLaurent Wouters <lwouters@cenotelie.fr>
Wed, 29 Apr 2020 15:22:11 +0200
changeset 16 bc001415dcbe
parent 15 cba52ce2eb91
child 17 b792134b6f43
Fix deprecation warning in python 3 for has_key
cubicweb_graphql/gql_schema.py
--- a/cubicweb_graphql/gql_schema.py	Wed Apr 29 15:06:28 2020 +0200
+++ b/cubicweb_graphql/gql_schema.py	Wed Apr 29 15:22:11 2020 +0200
@@ -201,7 +201,7 @@
         :return: The corresponding union type
         """
         key = tuple(sorted([member.type for member in members]))
-        if self.unions.has_key(key):
+        if key in self.unions:
             return self.unions[key]
         base_classes = (graphene.Union,)
         common = GraphQLSchemaTypes._get_common_ancestor(members)
@@ -278,7 +278,7 @@
             elif relation.final:
                 # handle a primitive type
                 field_type = relation.objects(entity_schema)[0].type
-                if _PRIMITIVES.has_key(field_type):
+                if field_type in _PRIMITIVES:
                     target_type = _PRIMITIVES[field_type]
                     fields[relation.type] = graphene.Field(
                         target_type,
@@ -357,7 +357,7 @@
             elif relation.final:
                 # handle a primitive type
                 field_type = relation.objects(entity_schema)[0].type
-                if _PRIMITIVES.has_key(field_type):
+                if field_type in _PRIMITIVES:
                     target_type = _PRIMITIVES[field_type]
                     fields[relation.type] = graphene.Field(
                         target_type,
@@ -398,7 +398,7 @@
             elif relation.final:
                 # handle a primitive type
                 field_type = relation.objects(entity_schema)[0].type
-                if _PRIMITIVES.has_key(field_type):
+                if field_type in _PRIMITIVES:
                     target_type = _PRIMITIVES[field_type]
                     arguments[relation.type] = graphene.Argument(
                         target_type,