From bfc4b94a65c9555da625f3b5251bffcd48c18468 Mon Sep 17 00:00:00 2001 From: Christoph Zwerschke Date: Mon, 2 Sep 2024 22:35:01 +0200 Subject: [PATCH] Fix issue with newer flake8 --- .flake8 | 2 +- src/graphql/type/definition.py | 8 ++++---- src/graphql/utilities/ast_to_dict.py | 5 +---- src/graphql/utilities/type_from_ast.py | 6 +++--- 4 files changed, 9 insertions(+), 12 deletions(-) diff --git a/.flake8 b/.flake8 index ccded588..0be28606 100644 --- a/.flake8 +++ b/.flake8 @@ -1,4 +1,4 @@ [flake8] -ignore = E203,W503 +ignore = E203,E704,W503 exclude = .git,.mypy_cache,.pytest_cache,.tox,.venv,__pycache__,build,dist,docs max-line-length = 88 diff --git a/src/graphql/type/definition.py b/src/graphql/type/definition.py index 7ec9ed08..9be16b2d 100644 --- a/src/graphql/type/definition.py +++ b/src/graphql/type/definition.py @@ -1,5 +1,6 @@ from enum import Enum from typing import ( + TYPE_CHECKING, Any, Callable, Collection, @@ -10,7 +11,6 @@ NamedTuple, Optional, Tuple, - TYPE_CHECKING, Type, TypeVar, Union, @@ -21,8 +21,8 @@ from ..error import GraphQLError from ..language import ( EnumTypeDefinitionNode, - EnumValueDefinitionNode, EnumTypeExtensionNode, + EnumValueDefinitionNode, EnumValueNode, FieldDefinitionNode, FieldNode, @@ -47,16 +47,16 @@ from ..pyutils import ( AwaitableOrValue, Path, + Undefined, cached_property, did_you_mean, inspect, is_collection, is_description, suggestion_list, - Undefined, ) from ..utilities.value_from_ast_untyped import value_from_ast_untyped -from .assert_name import assert_name, assert_enum_value_name +from .assert_name import assert_enum_value_name, assert_name try: from typing import TypedDict diff --git a/src/graphql/utilities/ast_to_dict.py b/src/graphql/utilities/ast_to_dict.py index a43cf139..f344a5e2 100644 --- a/src/graphql/utilities/ast_to_dict.py +++ b/src/graphql/utilities/ast_to_dict.py @@ -3,7 +3,6 @@ from ..language import Node, OperationType from ..pyutils import is_iterable - __all__ = ["ast_to_dict"] @@ -34,10 +33,8 @@ def ast_to_dict( ) -> Any: """Convert a language AST to a nested Python dictionary. - Set `location` to True in order to get the locations as well. + Set `locations` to True in order to get the locations as well. """ - - """Convert a node to a nested Python dictionary.""" if isinstance(node, Node): if cache is None: cache = {} diff --git a/src/graphql/utilities/type_from_ast.py b/src/graphql/utilities/type_from_ast.py index 1fdbcf22..5c4623b0 100644 --- a/src/graphql/utilities/type_from_ast.py +++ b/src/graphql/utilities/type_from_ast.py @@ -1,13 +1,13 @@ -from typing import cast, overload, Optional +from typing import Optional, cast, overload from ..language import ListTypeNode, NamedTypeNode, NonNullTypeNode, TypeNode from ..pyutils import inspect from ..type import ( - GraphQLSchema, - GraphQLNamedType, GraphQLList, + GraphQLNamedType, GraphQLNonNull, GraphQLNullableType, + GraphQLSchema, GraphQLType, )