# HG changeset patch # User Nsukami Patrick <ptrck at nskm dot xyz> # Date 1637688920 0 # Tue Nov 23 17:35:20 2021 +0000 # Node ID bd85b70067441e028bf501f3366abbabcc37441b # Parent af2d5233a53fd3bc70c7a2145a94a45a66372c5c [mypy] Type RQLHelper's schema attribute as ISchema There was an unused protocol definition sleeping within the rql/interfaces.py module. This protocol (ISchema) perfectly represent what a schema should be. Let's use it to annotate the schema attribute within the RQLHelper class diff --git a/rql/__init__.py b/rql/__init__.py --- a/rql/__init__.py +++ b/rql/__init__.py @@ -45,7 +45,7 @@ if TYPE_CHECKING: import rql - from unittest_analyze import DummySchema # type:ignore[import] + # from unittest_analyze import DummySchema # type:ignore[import] # REQUIRED_TYPES = ['String', 'Float', 'Int', 'Boolean', 'Date'] @@ -61,7 +61,7 @@ def __init__( self, - schema: "DummySchema", + schema: "rql.interfaces.ISchema", uid_func_mapping: rt.UIDFuncMapping = None, special_relations: Dict[str, str] = {}, resolver_class: Type[rt.ResolvesEType] = ETypeResolver, @@ -90,7 +90,7 @@ ) self.set_schema(schema) - def set_schema(self, schema: "DummySchema") -> None: + def set_schema(self, schema: "rql.interfaces.ISchema") -> None: from rql.utils import is_keyword for etype in schema.entities():