From 5d7c57b748675d524455ddaf94beb42ada2f20f3 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Mon, 25 Nov 2024 16:33:32 +0000 Subject: [PATCH] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- strawberry/__init__.py | 16 +++---- strawberry/annotation.py | 2 +- strawberry/channels/__init__.py | 2 +- strawberry/cli/commands/codegen.py | 2 +- strawberry/cli/commands/upgrade/__init__.py | 2 +- strawberry/codegen/exceptions.py | 4 +- strawberry/codegen/query_codegen.py | 6 +-- strawberry/codegen/types.py | 38 ++++++++--------- strawberry/codemods/annotated_unions.py | 2 +- strawberry/dataloader.py | 14 +++---- strawberry/django/views.py | 2 +- strawberry/exceptions/__init__.py | 42 +++++++++---------- strawberry/experimental/pydantic/__init__.py | 4 +- strawberry/experimental/pydantic/_compat.py | 4 +- strawberry/extensions/__init__.py | 12 +++--- strawberry/extensions/base_extension.py | 2 +- strawberry/extensions/context.py | 6 +-- strawberry/extensions/utils.py | 2 +- strawberry/fastapi/router.py | 2 +- strawberry/federation/__init__.py | 6 +-- strawberry/federation/object_type.py | 2 +- strawberry/federation/schema_directives.py | 18 ++++---- strawberry/flask/views.py | 2 +- strawberry/http/__init__.py | 2 +- strawberry/http/ides.py | 2 +- strawberry/http/types.py | 2 +- strawberry/http/typevars.py | 4 +- strawberry/litestar/controller.py | 2 +- strawberry/relay/fields.py | 2 +- strawberry/relay/types.py | 10 ++--- strawberry/relay/utils.py | 4 +- strawberry/schema/compat.py | 4 +- strawberry/schema/types/base_scalars.py | 2 +- .../graphql_transport_ws/handlers.py | 6 +-- .../protocols/graphql_transport_ws/types.py | 10 ++--- .../protocols/graphql_ws/types.py | 12 +++--- strawberry/test/__init__.py | 2 +- strawberry/test/client.py | 2 +- strawberry/types/__init__.py | 2 +- strawberry/types/arguments.py | 2 +- strawberry/types/enum.py | 2 +- strawberry/types/nodes.py | 2 +- strawberry/types/object_type.py | 2 +- strawberry/utils/await_maybe.py | 2 +- strawberry/utils/inspect.py | 2 +- strawberry/utils/str_converters.py | 2 +- strawberry/utils/typing.py | 22 +++++----- 47 files changed, 148 insertions(+), 148 deletions(-) diff --git a/strawberry/__init__.py b/strawberry/__init__.py index 2cbda32b2f..05a10ec22b 100644 --- a/strawberry/__init__.py +++ b/strawberry/__init__.py @@ -25,32 +25,32 @@ from .types.unset import UNSET __all__ = [ - "BasePermission", - "experimental", "ID", - "Info", "UNSET", - "lazy", + "BasePermission", + "Info", "LazyType", "Parent", "Private", "Schema", "argument", + "asdict", + "auto", "directive", "directive_field", - "schema_directive", "enum", "enum_value", + "experimental", "federation", "field", "input", "interface", + "lazy", "mutation", + "relay", "scalar", + "schema_directive", "subscription", "type", "union", - "auto", - "asdict", - "relay", ] diff --git a/strawberry/annotation.py b/strawberry/annotation.py index dff708a1a1..6946647a17 100644 --- a/strawberry/annotation.py +++ b/strawberry/annotation.py @@ -54,7 +54,7 @@ class StrawberryAnnotation: - __slots__ = "raw_annotation", "namespace", "__resolve_cache__" + __slots__ = "__resolve_cache__", "namespace", "raw_annotation" def __init__( self, diff --git a/strawberry/channels/__init__.py b/strawberry/channels/__init__.py index f67fb25a82..f680cbfe50 100644 --- a/strawberry/channels/__init__.py +++ b/strawberry/channels/__init__.py @@ -10,8 +10,8 @@ __all__ = [ "ChannelsConsumer", "ChannelsRequest", - "GraphQLProtocolTypeRouter", "GraphQLHTTPConsumer", + "GraphQLProtocolTypeRouter", "GraphQLWSConsumer", "SyncGraphQLHTTPConsumer", ] diff --git a/strawberry/cli/commands/codegen.py b/strawberry/cli/commands/codegen.py index 6fe784da30..e5c271f606 100644 --- a/strawberry/cli/commands/codegen.py +++ b/strawberry/cli/commands/codegen.py @@ -3,7 +3,7 @@ import functools import importlib import inspect -from pathlib import Path # noqa: TCH003 +from pathlib import Path # noqa: TC003 from typing import List, Optional, Type, Union, cast import rich diff --git a/strawberry/cli/commands/upgrade/__init__.py b/strawberry/cli/commands/upgrade/__init__.py index 2b8f387ccb..d282768265 100644 --- a/strawberry/cli/commands/upgrade/__init__.py +++ b/strawberry/cli/commands/upgrade/__init__.py @@ -1,7 +1,7 @@ from __future__ import annotations import glob -import pathlib # noqa: TCH003 +import pathlib # noqa: TC003 import sys from typing import List diff --git a/strawberry/codegen/exceptions.py b/strawberry/codegen/exceptions.py index ca7bd6ad10..3db33c1537 100644 --- a/strawberry/codegen/exceptions.py +++ b/strawberry/codegen/exceptions.py @@ -16,7 +16,7 @@ class MultipleOperationsProvidedError(CodegenError): __all__ = [ "CodegenError", - "NoOperationProvidedError", - "NoOperationNameProvidedError", "MultipleOperationsProvidedError", + "NoOperationNameProvidedError", + "NoOperationProvidedError", ] diff --git a/strawberry/codegen/query_codegen.py b/strawberry/codegen/query_codegen.py index 583f7fbe39..ec487b2b15 100644 --- a/strawberry/codegen/query_codegen.py +++ b/strawberry/codegen/query_codegen.py @@ -922,9 +922,9 @@ def _collect_enum(self, enum: EnumDefinition) -> GraphQLEnum: __all__ = [ - "QueryCodegen", - "QueryCodegenPlugin", - "ConsolePlugin", "CodegenFile", "CodegenResult", + "ConsolePlugin", + "QueryCodegen", + "QueryCodegenPlugin", ] diff --git a/strawberry/codegen/types.py b/strawberry/codegen/types.py index 1518cb5f1f..4f6af3e285 100644 --- a/strawberry/codegen/types.py +++ b/strawberry/codegen/types.py @@ -197,31 +197,31 @@ class GraphQLOperation: __all__ = [ - "GraphQLOptional", - "GraphQLList", - "GraphQLUnion", + "GraphQLArgument", + "GraphQLArgumentValue", + "GraphQLBoolValue", + "GraphQLDirective", + "GraphQLEnum", + "GraphQLEnumValue", "GraphQLField", + "GraphQLFieldSelection", + "GraphQLFloatValue", "GraphQLFragmentSpread", - "GraphQLObjectType", "GraphQLFragmentType", - "GraphQLEnum", - "GraphQLScalar", - "GraphQLType", - "GraphQLFieldSelection", "GraphQLInlineFragment", - "GraphQLSelection", - "GraphQLStringValue", "GraphQLIntValue", - "GraphQLFloatValue", - "GraphQLEnumValue", - "GraphQLBoolValue", - "GraphQLNullValue", + "GraphQLList", "GraphQLListValue", + "GraphQLNullValue", + "GraphQLObjectType", "GraphQLObjectValue", - "GraphQLVariableReference", - "GraphQLArgumentValue", - "GraphQLArgument", - "GraphQLDirective", - "GraphQLVariable", "GraphQLOperation", + "GraphQLOptional", + "GraphQLScalar", + "GraphQLSelection", + "GraphQLStringValue", + "GraphQLType", + "GraphQLUnion", + "GraphQLVariable", + "GraphQLVariableReference", ] diff --git a/strawberry/codemods/annotated_unions.py b/strawberry/codemods/annotated_unions.py index 0da878b75c..fdba9a6af0 100644 --- a/strawberry/codemods/annotated_unions.py +++ b/strawberry/codemods/annotated_unions.py @@ -4,7 +4,7 @@ import libcst as cst import libcst.matchers as m -from libcst._nodes.expression import BaseExpression, Call # noqa: TCH002 +from libcst._nodes.expression import BaseExpression, Call # noqa: TC002 from libcst.codemod import CodemodContext, VisitorBasedCodemodCommand from libcst.codemod.visitors import AddImportsVisitor, RemoveImportsVisitor diff --git a/strawberry/dataloader.py b/strawberry/dataloader.py index ce2d247b27..c979180de9 100644 --- a/strawberry/dataloader.py +++ b/strawberry/dataloader.py @@ -210,8 +210,8 @@ def prime_many(self, data: Mapping[K, T], force: bool = False) -> None: def should_create_new_batch(loader: DataLoader, batch: Batch) -> bool: return bool( batch.dispatched - or loader.max_batch_size - and len(batch) >= loader.max_batch_size + or (loader.max_batch_size + and len(batch) >= loader.max_batch_size) ) @@ -267,13 +267,13 @@ async def dispatch_batch(loader: DataLoader, batch: Batch) -> None: __all__ = [ - "DataLoader", - "Batch", - "LoaderTask", "AbstractCache", + "Batch", + "DataLoader", "DefaultCache", - "should_create_new_batch", - "get_current_batch", + "LoaderTask", "dispatch", "dispatch_batch", + "get_current_batch", + "should_create_new_batch", ] diff --git a/strawberry/django/views.py b/strawberry/django/views.py index 47cd2b1d98..c6284cdf2a 100644 --- a/strawberry/django/views.py +++ b/strawberry/django/views.py @@ -318,4 +318,4 @@ async def create_websocket_response( raise NotImplementedError -__all__ = ["GraphQLView", "AsyncGraphQLView"] +__all__ = ["AsyncGraphQLView", "GraphQLView"] diff --git a/strawberry/exceptions/__init__.py b/strawberry/exceptions/__init__.py index ee331af721..53b0e6316f 100644 --- a/strawberry/exceptions/__init__.py +++ b/strawberry/exceptions/__init__.py @@ -158,32 +158,32 @@ class StrawberryGraphQLError(GraphQLError): __all__ = [ - "StrawberryException", - "UnableToFindExceptionSource", + "ConflictingArgumentsError", + "DuplicatedTypeName", + "FieldWithResolverAndDefaultFactoryError", + "FieldWithResolverAndDefaultValueError", + "InvalidArgumentTypeError", + "InvalidCustomContext", + "InvalidDefaultFactoryError", + "InvalidTypeForUnionMergeError", + "InvalidUnionTypeError", "MissingArgumentsAnnotationsError", + "MissingFieldAnnotationError", + "MissingOptionalDependenciesError", + "MissingQueryError", "MissingReturnAnnotationError", - "WrongReturnTypeForUnion", - "UnallowedReturnTypeForUnion", + "MissingTypesForGenericError", + "MultipleStrawberryArgumentsError", "ObjectIsNotAnEnumError", "ObjectIsNotClassError", - "InvalidUnionTypeError", - "InvalidTypeForUnionMergeError", - "MissingTypesForGenericError", - "UnsupportedTypeError", - "UnresolvedFieldTypeError", "PrivateStrawberryFieldError", - "MultipleStrawberryArgumentsError", "ScalarAlreadyRegisteredError", - "WrongNumberOfResultsReturned", - "FieldWithResolverAndDefaultValueError", - "FieldWithResolverAndDefaultFactoryError", - "ConflictingArgumentsError", - "MissingQueryError", - "InvalidArgumentTypeError", - "InvalidDefaultFactoryError", - "InvalidCustomContext", - "MissingFieldAnnotationError", - "DuplicatedTypeName", + "StrawberryException", "StrawberryGraphQLError", - "MissingOptionalDependenciesError", + "UnableToFindExceptionSource", + "UnallowedReturnTypeForUnion", + "UnresolvedFieldTypeError", + "UnsupportedTypeError", + "WrongNumberOfResultsReturned", + "WrongReturnTypeForUnion", ] diff --git a/strawberry/experimental/pydantic/__init__.py b/strawberry/experimental/pydantic/__init__.py index 10f382650d..1939a9fed3 100644 --- a/strawberry/experimental/pydantic/__init__.py +++ b/strawberry/experimental/pydantic/__init__.py @@ -3,9 +3,9 @@ from .object_type import input, interface, type __all__ = [ - "error_type", "UnregisteredTypeException", + "error_type", "input", - "type", "interface", + "type", ] diff --git a/strawberry/experimental/pydantic/_compat.py b/strawberry/experimental/pydantic/_compat.py index 9971c962b5..3b9bc5600f 100644 --- a/strawberry/experimental/pydantic/_compat.py +++ b/strawberry/experimental/pydantic/_compat.py @@ -283,10 +283,10 @@ def new_type_supertype(type_: Any) -> Any: __all__ = [ "PydanticCompat", + "get_args", + "get_origin", "is_new_type", "lenient_issubclass", - "get_origin", - "get_args", "new_type_supertype", "smart_deepcopy", ] diff --git a/strawberry/extensions/__init__.py b/strawberry/extensions/__init__.py index a94f69651b..189c4a6136 100644 --- a/strawberry/extensions/__init__.py +++ b/strawberry/extensions/__init__.py @@ -29,16 +29,16 @@ def __getattr__(name: str) -> Type[SchemaExtension]: __all__ = [ - "FieldExtension", - "SchemaExtension", - "LifecycleStep", "AddValidationRules", "DisableValidation", - "ParserCache", - "QueryDepthLimiter", + "FieldExtension", "IgnoreContext", - "ValidationCache", + "LifecycleStep", "MaskErrors", "MaxAliasesLimiter", "MaxTokensLimiter", + "ParserCache", + "QueryDepthLimiter", + "SchemaExtension", + "ValidationCache", ] diff --git a/strawberry/extensions/base_extension.py b/strawberry/extensions/base_extension.py index ff8d75d7ce..19dbcf35e8 100644 --- a/strawberry/extensions/base_extension.py +++ b/strawberry/extensions/base_extension.py @@ -78,4 +78,4 @@ def _implements_resolve(cls) -> bool: SchemaExtension.on_execute.__name__, } -__all__ = ["SchemaExtension", "Hook", "HOOK_METHODS", "LifecycleStep"] +__all__ = ["HOOK_METHODS", "Hook", "LifecycleStep", "SchemaExtension"] diff --git a/strawberry/extensions/context.py b/strawberry/extensions/context.py index f9a231fed4..c5cf47ce33 100644 --- a/strawberry/extensions/context.py +++ b/strawberry/extensions/context.py @@ -37,11 +37,11 @@ class WrappedHook(NamedTuple): class ExtensionContextManagerBase: __slots__ = ( - "hooks", - "deprecation_message", - "default_hook", "async_exit_stack", + "default_hook", + "deprecation_message", "exit_stack", + "hooks", ) def __init_subclass__(cls) -> None: diff --git a/strawberry/extensions/utils.py b/strawberry/extensions/utils.py index f857db5eaf..7b78b030c4 100644 --- a/strawberry/extensions/utils.py +++ b/strawberry/extensions/utils.py @@ -37,4 +37,4 @@ def get_path_from_info(info: GraphQLResolveInfo) -> List[str]: return elements[::-1] -__all__ = ["is_introspection_key", "is_introspection_field", "get_path_from_info"] +__all__ = ["get_path_from_info", "is_introspection_field", "is_introspection_key"] diff --git a/strawberry/fastapi/router.py b/strawberry/fastapi/router.py index 51ccd9731f..9bfe308410 100644 --- a/strawberry/fastapi/router.py +++ b/strawberry/fastapi/router.py @@ -20,7 +20,7 @@ from typing_extensions import TypeGuard from starlette import status -from starlette.background import BackgroundTasks # noqa: TCH002 +from starlette.background import BackgroundTasks # noqa: TC002 from starlette.requests import HTTPConnection, Request from starlette.responses import ( HTMLResponse, diff --git a/strawberry/federation/__init__.py b/strawberry/federation/__init__.py index 1ba201045f..3059a674da 100644 --- a/strawberry/federation/__init__.py +++ b/strawberry/federation/__init__.py @@ -9,17 +9,17 @@ from .union import union __all__ = [ + "Schema", "argument", "enum", "enum_value", "field", - "mutation", "input", "interface", "interface_object", - "type", + "mutation", "scalar", - "Schema", "schema_directive", + "type", "union", ] diff --git a/strawberry/federation/object_type.py b/strawberry/federation/object_type.py index 7005302370..cfb843bfec 100644 --- a/strawberry/federation/object_type.py +++ b/strawberry/federation/object_type.py @@ -371,4 +371,4 @@ def interface_object( ) -__all__ = ["type", "input", "interface", "interface_object"] +__all__ = ["input", "interface", "interface_object", "type"] diff --git a/strawberry/federation/schema_directives.py b/strawberry/federation/schema_directives.py index 0f9232d7f3..907cd9234c 100644 --- a/strawberry/federation/schema_directives.py +++ b/strawberry/federation/schema_directives.py @@ -229,18 +229,18 @@ class Policy(FederationDirective): __all__ = [ + "Authenticated", + "ComposeDirective", "External", - "Requires", - "Provides", + "Inaccessible", + "InterfaceObject", "Key", - "Shareable", "Link", - "Tag", "Override", - "Inaccessible", - "ComposeDirective", - "InterfaceObject", - "Authenticated", - "RequiresScopes", "Policy", + "Provides", + "Requires", + "RequiresScopes", + "Shareable", + "Tag", ] diff --git a/strawberry/flask/views.py b/strawberry/flask/views.py index d93f480b1e..233b506bfe 100644 --- a/strawberry/flask/views.py +++ b/strawberry/flask/views.py @@ -203,6 +203,6 @@ async def create_websocket_response( __all__ = [ - "GraphQLView", "AsyncGraphQLView", + "GraphQLView", ] diff --git a/strawberry/http/__init__.py b/strawberry/http/__init__.py index 86f295b9c3..368a1038d8 100644 --- a/strawberry/http/__init__.py +++ b/strawberry/http/__init__.py @@ -37,6 +37,6 @@ class GraphQLRequestData: __all__ = [ "GraphQLHTTPResponse", - "process_result", "GraphQLRequestData", + "process_result", ] diff --git a/strawberry/http/ides.py b/strawberry/http/ides.py index 9680a0277a..63d7d4af10 100644 --- a/strawberry/http/ides.py +++ b/strawberry/http/ides.py @@ -22,4 +22,4 @@ def get_graphql_ide_html( return template -__all__ = ["get_graphql_ide_html", "GraphQL_IDE"] +__all__ = ["GraphQL_IDE", "get_graphql_ide_html"] diff --git a/strawberry/http/types.py b/strawberry/http/types.py index 28794c9afa..f4e372c982 100644 --- a/strawberry/http/types.py +++ b/strawberry/http/types.py @@ -13,4 +13,4 @@ class FormData(TypedDict): form: Mapping[str, Any] -__all__ = ["HTTPMethod", "QueryParams", "FormData"] +__all__ = ["FormData", "HTTPMethod", "QueryParams"] diff --git a/strawberry/http/typevars.py b/strawberry/http/typevars.py index 53a5d5ac33..e28ce8bf3d 100644 --- a/strawberry/http/typevars.py +++ b/strawberry/http/typevars.py @@ -10,11 +10,11 @@ __all__ = [ + "Context", "Request", "Response", + "RootValue", "SubResponse", "WebSocketRequest", "WebSocketResponse", - "Context", - "RootValue", ] diff --git a/strawberry/litestar/controller.py b/strawberry/litestar/controller.py index 2ffc456df8..1c20e9d294 100644 --- a/strawberry/litestar/controller.py +++ b/strawberry/litestar/controller.py @@ -474,6 +474,6 @@ class _GraphQLController(GraphQLController): __all__ = [ - "make_graphql_controller", "GraphQLController", + "make_graphql_controller", ] diff --git a/strawberry/relay/fields.py b/strawberry/relay/fields.py index 5af00700f8..fb56e8ef7f 100644 --- a/strawberry/relay/fields.py +++ b/strawberry/relay/fields.py @@ -478,4 +478,4 @@ def get_some_nodes(self, age: int) -> Iterable[SomeType]: ... return f -__all__ = ["node", "connection"] +__all__ = ["connection", "node"] diff --git a/strawberry/relay/types.py b/strawberry/relay/types.py index 869e017be9..0d06814e14 100644 --- a/strawberry/relay/types.py +++ b/strawberry/relay/types.py @@ -33,7 +33,7 @@ get_object_definition, ) from strawberry.types.field import field -from strawberry.types.info import Info # noqa: TCH001 +from strawberry.types.info import Info # noqa: TC001 from strawberry.types.lazy_type import LazyType from strawberry.types.object_type import interface, type from strawberry.types.private import StrawberryPrivate @@ -935,17 +935,17 @@ async def resolver() -> Self: __all__ = [ + "PREFIX", + "Connection", + "Edge", "GlobalID", "GlobalIDValueError", + "ListConnection", "Node", "NodeID", "NodeIDAnnotationError", "NodeIDPrivate", "NodeIterableType", "NodeType", - "PREFIX", - "Connection", - "Edge", "PageInfo", - "ListConnection", ] diff --git a/strawberry/relay/utils.py b/strawberry/relay/utils.py index c25bd537b0..4f9301140a 100644 --- a/strawberry/relay/utils.py +++ b/strawberry/relay/utils.py @@ -191,8 +191,8 @@ def from_arguments( __all__ = [ + "SliceMetadata", "from_base64", - "to_base64", "should_resolve_list_connection_edges", - "SliceMetadata", + "to_base64", ] diff --git a/strawberry/schema/compat.py b/strawberry/schema/compat.py index 2831eab78a..c4ec8c1413 100644 --- a/strawberry/schema/compat.py +++ b/strawberry/schema/compat.py @@ -54,10 +54,10 @@ def is_graphql_generic(type_: Union[StrawberryType, type]) -> bool: __all__ = [ + "is_enum", + "is_graphql_generic", "is_input_type", "is_interface_type", "is_scalar", - "is_enum", "is_schema_directive", - "is_graphql_generic", ] diff --git a/strawberry/schema/types/base_scalars.py b/strawberry/schema/types/base_scalars.py index 8e73a1383a..4d8a66df23 100644 --- a/strawberry/schema/types/base_scalars.py +++ b/strawberry/schema/types/base_scalars.py @@ -81,4 +81,4 @@ def _verify_void(x: None) -> None: description="Represents NULL values", ) -__all__ = ["Date", "DateTime", "Time", "Decimal", "UUID", "Void"] +__all__ = ["UUID", "Date", "DateTime", "Decimal", "Time", "Void"] diff --git a/strawberry/subscriptions/protocols/graphql_transport_ws/handlers.py b/strawberry/subscriptions/protocols/graphql_transport_ws/handlers.py index cdda39595a..b60e0f75de 100644 --- a/strawberry/subscriptions/protocols/graphql_transport_ws/handlers.py +++ b/strawberry/subscriptions/protocols/graphql_transport_ws/handlers.py @@ -324,14 +324,14 @@ class Operation: """A class encapsulating a single operation with its id. Helps enforce protocol state transition.""" __slots__ = [ + "completed", "handler", "id", + "operation_name", "operation_type", "query", - "variables", - "operation_name", - "completed", "task", + "variables", ] def __init__( diff --git a/strawberry/subscriptions/protocols/graphql_transport_ws/types.py b/strawberry/subscriptions/protocols/graphql_transport_ws/types.py index 7e5a804f29..a597c49048 100644 --- a/strawberry/subscriptions/protocols/graphql_transport_ws/types.py +++ b/strawberry/subscriptions/protocols/graphql_transport_ws/types.py @@ -89,13 +89,13 @@ class CompleteMessage(TypedDict): __all__ = [ - "ConnectionInitMessage", + "CompleteMessage", "ConnectionAckMessage", + "ConnectionInitMessage", + "ErrorMessage", + "Message", + "NextMessage", "PingMessage", "PongMessage", "SubscribeMessage", - "NextMessage", - "ErrorMessage", - "CompleteMessage", - "Message", ] diff --git a/strawberry/subscriptions/protocols/graphql_ws/types.py b/strawberry/subscriptions/protocols/graphql_ws/types.py index 56aa81ab1b..a1b9f48f03 100644 --- a/strawberry/subscriptions/protocols/graphql_ws/types.py +++ b/strawberry/subscriptions/protocols/graphql_ws/types.py @@ -83,15 +83,15 @@ class ConnectionKeepAliveMessage(TypedDict): __all__ = [ + "CompleteMessage", + "ConnectionAckMessage", + "ConnectionErrorMessage", "ConnectionInitMessage", - "StartMessage", - "StopMessage", + "ConnectionKeepAliveMessage", "ConnectionTerminateMessage", - "ConnectionErrorMessage", - "ConnectionAckMessage", "DataMessage", "ErrorMessage", - "CompleteMessage", - "ConnectionKeepAliveMessage", "OperationMessage", + "StartMessage", + "StopMessage", ] diff --git a/strawberry/test/__init__.py b/strawberry/test/__init__.py index 5f6b0b76e5..c81b9637fb 100644 --- a/strawberry/test/__init__.py +++ b/strawberry/test/__init__.py @@ -1,3 +1,3 @@ from .client import BaseGraphQLTestClient, Body, Response -__all__ = ["Body", "Response", "BaseGraphQLTestClient"] +__all__ = ["BaseGraphQLTestClient", "Body", "Response"] diff --git a/strawberry/test/client.py b/strawberry/test/client.py index 243ac3aadb..9f1c73920c 100644 --- a/strawberry/test/client.py +++ b/strawberry/test/client.py @@ -195,4 +195,4 @@ def _decode(self, response: Any, type: Literal["multipart", "json"]) -> Any: return response.json() -__all__ = ["BaseGraphQLTestClient", "Response", "Body"] +__all__ = ["BaseGraphQLTestClient", "Body", "Response"] diff --git a/strawberry/types/__init__.py b/strawberry/types/__init__.py index 65f055865c..ba3b5158b9 100644 --- a/strawberry/types/__init__.py +++ b/strawberry/types/__init__.py @@ -5,9 +5,9 @@ __all__ = [ "ExecutionContext", "ExecutionResult", - "SubscriptionExecutionResult", "Info", "Info", + "SubscriptionExecutionResult", "get_object_definition", "has_object_definition", ] diff --git a/strawberry/types/arguments.py b/strawberry/types/arguments.py index a48f0e417d..3687ab0883 100644 --- a/strawberry/types/arguments.py +++ b/strawberry/types/arguments.py @@ -283,9 +283,9 @@ def __getattr__(name: str) -> Any: # TODO: check exports __all__ = [ # noqa: F822 + "UNSET", # for backwards compatibility # type: ignore "StrawberryArgument", "StrawberryArgumentAnnotation", - "UNSET", # for backwards compatibility # type: ignore "argument", "is_unset", # for backwards compatibility # type: ignore ] diff --git a/strawberry/types/enum.py b/strawberry/types/enum.py index 4ec01be188..3f66ae5dd6 100644 --- a/strawberry/types/enum.py +++ b/strawberry/types/enum.py @@ -228,4 +228,4 @@ def wrap(cls: EnumType) -> EnumType: return wrap(cls) -__all__ = ["EnumValue", "EnumDefinition", "EnumValueDefinition", "enum", "enum_value"] +__all__ = ["EnumDefinition", "EnumValue", "EnumValueDefinition", "enum", "enum_value"] diff --git a/strawberry/types/nodes.py b/strawberry/types/nodes.py index 20a8407a8e..70bcc057dc 100644 --- a/strawberry/types/nodes.py +++ b/strawberry/types/nodes.py @@ -152,4 +152,4 @@ def from_node(cls, info: GraphQLResolveInfo, node: GQLFieldNode) -> SelectedFiel ) -__all__ = ["convert_selections", "FragmentSpread", "InlineFragment", "SelectedField"] +__all__ = ["FragmentSpread", "InlineFragment", "SelectedField", "convert_selections"] diff --git a/strawberry/types/object_type.py b/strawberry/types/object_type.py index c6120763aa..c0d4e9fa7e 100644 --- a/strawberry/types/object_type.py +++ b/strawberry/types/object_type.py @@ -489,8 +489,8 @@ class User: __all__ = [ "StrawberryObjectDefinition", + "asdict", "input", "interface", "type", - "asdict", ] diff --git a/strawberry/utils/await_maybe.py b/strawberry/utils/await_maybe.py index 65b1a23bd6..6a5e8aa743 100644 --- a/strawberry/utils/await_maybe.py +++ b/strawberry/utils/await_maybe.py @@ -14,4 +14,4 @@ async def await_maybe(value: AwaitableOrValue[T]) -> T: return value -__all__ = ["await_maybe", "AwaitableOrValue", "AsyncIteratorOrIterator"] +__all__ = ["AsyncIteratorOrIterator", "AwaitableOrValue", "await_maybe"] diff --git a/strawberry/utils/inspect.py b/strawberry/utils/inspect.py index 4ed67c6be4..736a8723cf 100644 --- a/strawberry/utils/inspect.py +++ b/strawberry/utils/inspect.py @@ -122,4 +122,4 @@ class IntBarFoo(IntBar, Foo[str]): ... return type_var_map -__all__ = ["in_async_context", "get_func_args", "get_specialized_type_var_map"] +__all__ = ["get_func_args", "get_specialized_type_var_map", "in_async_context"] diff --git a/strawberry/utils/str_converters.py b/strawberry/utils/str_converters.py index 9c52a7ed7d..2fac7f6df3 100644 --- a/strawberry/utils/str_converters.py +++ b/strawberry/utils/str_converters.py @@ -26,4 +26,4 @@ def to_snake_case(name: str) -> str: return re.sub("([a-z0-9])([A-Z])", r"\1_\2", name).lower() -__all__ = ["to_camel_case", "to_kebab_case", "capitalize_first", "to_snake_case"] +__all__ = ["capitalize_first", "to_camel_case", "to_kebab_case", "to_snake_case"] diff --git a/strawberry/utils/typing.py b/strawberry/utils/typing.py index 245f6542ab..2ee57dc8c6 100644 --- a/strawberry/utils/typing.py +++ b/strawberry/utils/typing.py @@ -197,9 +197,9 @@ def type_has_annotation(type_: object, annotation: Type) -> bool: def get_parameters(annotation: Type) -> Union[Tuple[object], Tuple[()]]: if ( isinstance(annotation, _GenericAlias) - or isinstance(annotation, type) + or (isinstance(annotation, type) and issubclass(annotation, Generic) # type:ignore - and annotation is not Generic + and annotation is not Generic) ): return annotation.__parameters__ else: @@ -417,19 +417,19 @@ def eval_type( __all__ = [ + "eval_type", "get_generic_alias", - "is_generic_alias", - "is_list", - "is_union", - "is_optional", - "get_optional_annotation", "get_list_annotation", + "get_optional_annotation", + "get_parameters", + "is_classvar", "is_concrete_generic", - "is_generic_subclass", "is_generic", + "is_generic_alias", + "is_generic_subclass", + "is_list", + "is_optional", "is_type_var", - "is_classvar", + "is_union", "type_has_annotation", - "get_parameters", - "eval_type", ]