Skip to content

Commit 4fe6404

Browse files
authored
fix: downgrade to 3.8-compatible type hints (#10)
fixes #9
1 parent b8bf51b commit 4fe6404

File tree

4 files changed

+12
-10
lines changed

4 files changed

+12
-10
lines changed

graphene_federation/entity.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
from __future__ import annotations
22

3-
from typing import Any, Callable
3+
from typing import Any, Callable, Dict
44

55
from graphene import List, NonNull, Union
66

@@ -11,7 +11,7 @@
1111
from .utils import field_name_to_type_attribute
1212

1313

14-
def get_entities(schema: Schema) -> dict[str, Any]:
14+
def get_entities(schema: Schema) -> Dict[str, Any]:
1515
"""
1616
Find all the entities from the type map.
1717
They can be easily distinguished from the other type as
@@ -27,7 +27,7 @@ def get_entities(schema: Schema) -> dict[str, Any]:
2727
return entities
2828

2929

30-
def get_entity_cls(entities: dict[str, Any]) -> Union:
30+
def get_entity_cls(entities: Dict[str, Any]) -> Union:
3131
"""
3232
Create _Entity type which is a union of all the entities types.
3333
"""

graphene_federation/extend.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
from typing import Any, Callable, Union
1+
from typing import Any, Callable, Union, Dict, List
22

33
from graphene import Schema
44

55

6-
def get_extended_types(schema: Schema) -> dict[str, Any]:
6+
def get_extended_types(schema: Schema) -> Dict[str, Any]:
77
"""
88
Find all the extended types from the schema.
99
They can be easily distinguished from the other type as
@@ -54,7 +54,7 @@ def external(field):
5454
return field
5555

5656

57-
def requires(field, fields: Union[str, list[str]]):
57+
def requires(field, fields: Union[str, List[str]]):
5858
"""
5959
Mark the required fields for a given field.
6060
The input `fields` can be either a string or a list.

graphene_federation/provides.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
from typing import Any, Union
1+
from typing import Any, Union, Dict, List
22

33
from graphene import Field
44
from graphene import Schema
55

66

7-
def get_provides_parent_types(schema: Schema) -> dict[str, Any]:
7+
def get_provides_parent_types(schema: Schema) -> Dict[str, Any]:
88
"""
99
Find all the types for which a field is provided from the schema.
1010
They can be easily distinguished from the other type as
@@ -19,7 +19,7 @@ def get_provides_parent_types(schema: Schema) -> dict[str, Any]:
1919
return provides_parent_types
2020

2121

22-
def provides(field, fields: Union[str, list[str]] = None):
22+
def provides(field, fields: Union[str, List[str]] = None):
2323
"""
2424
2525
:param field: base type (when used as decorator) or field of base type

graphene_federation/service.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
import re
22

3+
from typing import List
4+
35
from graphql.utilities.print_schema import print_fields
46

57
from graphene import ObjectType, String, Field, Schema
@@ -21,7 +23,7 @@ def __init__(self, name, field):
2123
self.fields = {name: field}
2224

2325

24-
def convert_fields(schema: Schema, fields: list[str]) -> str:
26+
def convert_fields(schema: Schema, fields: List[str]) -> str:
2527
get_field_name = type_attribute_to_field_name(schema)
2628
return " ".join([get_field_name(field) for field in fields])
2729

0 commit comments

Comments
 (0)