Skip to content

Commit 1ff3e96

Browse files
committed
Remove result type annotation from __init__ methods
They are noisy and not needed in mypy any more (python/mypy#5677).
1 parent 1a42027 commit 1ff3e96

36 files changed

+44
-44
lines changed

src/graphql/execution/middleware.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ class MiddlewareManager:
2525
_cached_resolvers: Dict[GraphQLFieldResolver, GraphQLFieldResolver]
2626
_middleware_resolvers: Optional[List[Callable]]
2727

28-
def __init__(self, *middlewares: Any) -> None:
28+
def __init__(self, *middlewares: Any):
2929
self.middlewares = middlewares
3030
self._middleware_resolvers = (
3131
list(get_middleware_resolvers(middlewares)) if middlewares else None

src/graphql/language/lexer.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ class Lexer:
6767
EOF token whenever called.
6868
"""
6969

70-
def __init__(self, source: Source) -> None:
70+
def __init__(self, source: Source):
7171
"""Given a Source object, initialize a Lexer for that source."""
7272
self.source = source
7373
self.token = self.last_token = Token(TokenKind.SOF, 0, 0, 0, 0)

src/graphql/language/visitor.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -341,7 +341,7 @@ class ParallelVisitor(Visitor):
341341
If a prior visitor edits a node, no following visitors will see that node.
342342
"""
343343

344-
def __init__(self, visitors: Collection[Visitor]) -> None:
344+
def __init__(self, visitors: Collection[Visitor]):
345345
"""Create a new visitor from the given list of parallel visitors."""
346346
self.visitors = visitors
347347
self.skipping: List[Any] = [None] * len(visitors)

src/graphql/pyutils/event_emitter.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
class EventEmitter:
1212
"""A very simple EventEmitter."""
1313

14-
def __init__(self, loop: Optional[AbstractEventLoop] = None) -> None:
14+
def __init__(self, loop: Optional[AbstractEventLoop] = None):
1515
self.loop = loop
1616
self.listeners: Dict[str, List[Callable]] = defaultdict(list)
1717

@@ -43,7 +43,7 @@ class EventEmitterAsyncIterator:
4343
Useful for mocking a PubSub system for tests.
4444
"""
4545

46-
def __init__(self, event_emitter: EventEmitter, event_name: str) -> None:
46+
def __init__(self, event_emitter: EventEmitter, event_name: str):
4747
self.queue: Queue = Queue(loop=cast(AbstractEventLoop, event_emitter.loop))
4848
event_emitter.add_listener(event_name, self.queue.put)
4949
self.remove_listener = lambda: event_emitter.remove_listener(

src/graphql/type/definition.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,7 @@ class GraphQLWrappingType(GraphQLType, Generic[GT]):
161161

162162
of_type: GT
163163

164-
def __init__(self, type_: GT) -> None:
164+
def __init__(self, type_: GT):
165165
if not is_type(type_):
166166
raise TypeError(
167167
f"Can only create a wrapper for a GraphQLType, but got: {type_}."
@@ -1415,7 +1415,7 @@ def fields(self):
14151415
}
14161416
"""
14171417

1418-
def __init__(self, type_: GT) -> None:
1418+
def __init__(self, type_: GT):
14191419
super().__init__(type_=type_)
14201420

14211421
def __str__(self):
@@ -1455,7 +1455,7 @@ class RowType(GraphQLObjectType):
14551455
Note: the enforcement of non-nullability occurs within the executor.
14561456
"""
14571457

1458-
def __init__(self, type_: GNT) -> None:
1458+
def __init__(self, type_: GNT):
14591459
super().__init__(type_=type_)
14601460
if isinstance(type_, GraphQLNonNull):
14611461
raise TypeError(

src/graphql/type/validate.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ class SchemaValidationContext:
9090
errors: List[GraphQLError]
9191
schema: GraphQLSchema
9292

93-
def __init__(self, schema: GraphQLSchema) -> None:
93+
def __init__(self, schema: GraphQLSchema):
9494
self.errors = []
9595
self.schema = schema
9696

@@ -500,7 +500,7 @@ def get_operation_type_node(
500500
class InputObjectCircularRefsValidator:
501501
"""Modified copy of algorithm from validation.rules.NoFragmentCycles"""
502502

503-
def __init__(self, context: SchemaValidationContext) -> None:
503+
def __init__(self, context: SchemaValidationContext):
504504
self.context = context
505505
# Tracks already visited types to maintain O(N) and to ensure that cycles
506506
# are not redundantly reported.

src/graphql/utilities/find_deprecated_usages.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ class FindDeprecatedUsages(Visitor):
2626
type_info: TypeInfo
2727
errors: List[GraphQLError]
2828

29-
def __init__(self, type_info: TypeInfo) -> None:
29+
def __init__(self, type_info: TypeInfo):
3030
super().__init__()
3131
self.type_info = type_info
3232
self.errors = []

src/graphql/utilities/type_info.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -288,7 +288,7 @@ def get_field_def(
288288
class TypeInfoVisitor(Visitor):
289289
"""A visitor which maintains a provided TypeInfo."""
290290

291-
def __init__(self, type_info: "TypeInfo", visitor: Visitor) -> None:
291+
def __init__(self, type_info: "TypeInfo", visitor: Visitor):
292292
self.type_info = type_info
293293
self.visitor = visitor
294294

src/graphql/validation/rules/__init__.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ class ASTValidationRule(Visitor):
1818

1919
context: ASTValidationContext
2020

21-
def __init__(self, context: ASTValidationContext) -> None:
21+
def __init__(self, context: ASTValidationContext):
2222
self.context = context
2323

2424
def report_error(self, error: GraphQLError):
@@ -30,7 +30,7 @@ class SDLValidationRule(ASTValidationRule):
3030

3131
context: ValidationContext
3232

33-
def __init__(self, context: SDLValidationContext) -> None:
33+
def __init__(self, context: SDLValidationContext):
3434
super().__init__(context)
3535

3636

@@ -39,7 +39,7 @@ class ValidationRule(ASTValidationRule):
3939

4040
context: ValidationContext
4141

42-
def __init__(self, context: ValidationContext) -> None:
42+
def __init__(self, context: ValidationContext):
4343
super().__init__(context)
4444

4545

src/graphql/validation/rules/known_argument_names.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ class KnownArgumentNamesOnDirectivesRule(ASTValidationRule):
1919

2020
context: Union[ValidationContext, SDLValidationContext]
2121

22-
def __init__(self, context: Union[ValidationContext, SDLValidationContext]) -> None:
22+
def __init__(self, context: Union[ValidationContext, SDLValidationContext]):
2323
super().__init__(context)
2424
directive_args: Dict[str, List[str]] = {}
2525

@@ -64,7 +64,7 @@ class KnownArgumentNamesRule(KnownArgumentNamesOnDirectivesRule):
6464

6565
context: ValidationContext
6666

67-
def __init__(self, context: ValidationContext) -> None:
67+
def __init__(self, context: ValidationContext):
6868
super().__init__(context)
6969

7070
def enter_argument(self, arg_node: ArgumentNode, *args):

0 commit comments

Comments
 (0)