diff --git a/graphene_federation/entity.py b/graphene_federation/entity.py index 1348c66..31ea737 100644 --- a/graphene_federation/entity.py +++ b/graphene_federation/entity.py @@ -1,6 +1,6 @@ from __future__ import annotations -from typing import Any, Callable +from typing import Any, Callable, Dict from graphene import List, NonNull, Union @@ -11,7 +11,7 @@ from .utils import field_name_to_type_attribute -def get_entities(schema: Schema) -> dict[str, Any]: +def get_entities(schema: Schema) -> Dict[str, Any]: """ Find all the entities from the type map. They can be easily distinguished from the other type as @@ -27,7 +27,7 @@ def get_entities(schema: Schema) -> dict[str, Any]: return entities -def get_entity_cls(entities: dict[str, Any]) -> Union: +def get_entity_cls(entities: Dict[str, Any]) -> Union: """ Create _Entity type which is a union of all the entities types. """ diff --git a/graphene_federation/extend.py b/graphene_federation/extend.py index bfb1f50..79aec15 100644 --- a/graphene_federation/extend.py +++ b/graphene_federation/extend.py @@ -1,9 +1,9 @@ -from typing import Any, Callable, Union +from typing import Any, Callable, Union, Dict, List from graphene import Schema -def get_extended_types(schema: Schema) -> dict[str, Any]: +def get_extended_types(schema: Schema) -> Dict[str, Any]: """ Find all the extended types from the schema. They can be easily distinguished from the other type as @@ -54,7 +54,7 @@ def external(field): return field -def requires(field, fields: Union[str, list[str]]): +def requires(field, fields: Union[str, List[str]]): """ Mark the required fields for a given field. The input `fields` can be either a string or a list. diff --git a/graphene_federation/provides.py b/graphene_federation/provides.py index 74e8324..6ee2ecf 100644 --- a/graphene_federation/provides.py +++ b/graphene_federation/provides.py @@ -1,10 +1,10 @@ -from typing import Any, Union +from typing import Any, Union, Dict, List from graphene import Field from graphene import Schema -def get_provides_parent_types(schema: Schema) -> dict[str, Any]: +def get_provides_parent_types(schema: Schema) -> Dict[str, Any]: """ Find all the types for which a field is provided from the schema. They can be easily distinguished from the other type as @@ -19,7 +19,7 @@ def get_provides_parent_types(schema: Schema) -> dict[str, Any]: return provides_parent_types -def provides(field, fields: Union[str, list[str]] = None): +def provides(field, fields: Union[str, List[str]] = None): """ :param field: base type (when used as decorator) or field of base type diff --git a/graphene_federation/service.py b/graphene_federation/service.py index acfd29d..4a63f28 100644 --- a/graphene_federation/service.py +++ b/graphene_federation/service.py @@ -1,5 +1,7 @@ import re +from typing import List + from graphql.utilities.print_schema import print_fields from graphene import ObjectType, String, Field, Schema @@ -21,7 +23,7 @@ def __init__(self, name, field): self.fields = {name: field} -def convert_fields(schema: Schema, fields: list[str]) -> str: +def convert_fields(schema: Schema, fields: List[str]) -> str: get_field_name = type_attribute_to_field_name(schema) return " ".join([get_field_name(field) for field in fields])