Skip to content

Commit

Permalink
Update dependencies and reformat
Browse files Browse the repository at this point in the history
  • Loading branch information
Cito committed Apr 6, 2024
1 parent 8f4d245 commit 634ee95
Show file tree
Hide file tree
Showing 19 changed files with 266 additions and 195 deletions.
1 change: 1 addition & 0 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,7 @@
GraphQLAbstractType
GraphQLErrorExtensions
GraphQLFieldResolver
GraphQLInputType
GraphQLTypeResolver
GraphQLOutputType
Middleware
Expand Down
273 changes: 179 additions & 94 deletions poetry.lock

Large diffs are not rendered by default.

21 changes: 13 additions & 8 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ packages = [
{ include = "CODEOWNERS", format = "sdist" },
{ include = "SECURITY.md", format = "sdist" }
]
exclude = ["docs/_build/**"]

[tool.poetry.urls]
Changelog = "https://github.com/graphql-python/graphql-core/releases"
Expand All @@ -51,29 +52,32 @@ optional = true

[tool.poetry.group.test.dependencies]
pytest = [
{ version = "^8.0", python = ">=3.8" },
{ version = "^8.1", python = ">=3.8" },
{ version = "^7.4", python = "<3.8"}
]
pytest-asyncio = [
{ version = "^0.23.5", python = ">=3.8" },
{ version = "^0.23.6", python = ">=3.8" },
{ version = "~0.21.1", python = "<3.8"}
]
pytest-benchmark = "^4.0"
pytest-cov = "^4.1"
pytest-cov = [
{ version = "^5.0", python = ">=3.8" },
{ version = "^4.1", python = "<3.8" },
]
pytest-describe = "^2.2"
pytest-timeout = "^2.2"
pytest-timeout = "^2.3"
tox = [
{ version = "^4.13", python = ">=3.8" },
{ version = "^4.14", python = ">=3.8" },
{ version = "^3.28", python = "<3.8" }
]

[tool.poetry.group.lint]
optional = true

[tool.poetry.group.lint.dependencies]
ruff = ">=0.2.1,<0.3"
ruff = ">=0.3.5,<0.4"
mypy = [
{ version = "^1.8", python = ">=3.8" },
{ version = "^1.9", python = ">=3.8" },
{ version = "~1.4", python = "<3.8" }
]
bump2version = ">=1.0,<2"
Expand Down Expand Up @@ -253,7 +257,8 @@ exclude_lines = [
"if MYPY:",
"if TYPE_CHECKING:",
'^\s+\.\.\.$',
'^\s+pass$'
'^\s+pass$',
': \.\.\.$'
]
ignore_errors = true

Expand Down
2 changes: 1 addition & 1 deletion src/graphql/execution/execute.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
# noinspection PyCompatibility
from asyncio.exceptions import TimeoutError
except ImportError: # Python < 3.7
from concurrent.futures import TimeoutError # type: ignore
from concurrent.futures import TimeoutError

from ..error import GraphQLError, GraphQLFormattedError, located_error
from ..language import (
Expand Down
2 changes: 1 addition & 1 deletion src/graphql/language/lexer.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ def print_code_point_at(self, location: int) -> str:
return TokenKind.EOF.value
char = body[location]
# Printable ASCII
if "\x20" <= char <= "\x7E":
if "\x20" <= char <= "\x7e":
return "'\"'" if char == '"' else f"'{char}'"
# Unicode code point
point = ord(
Expand Down
4 changes: 1 addition & 3 deletions src/graphql/pyutils/simple_pub_sub.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,7 @@ def emit(self, event: Any) -> bool:
create_task(result) # type: ignore # noqa: RUF006
return bool(self.subscribers)

def get_subscriber(
self, transform: Callable | None = None
) -> SimplePubSubIterator:
def get_subscriber(self, transform: Callable | None = None) -> SimplePubSubIterator:
"""Return subscriber iterator"""
return SimplePubSubIterator(self, transform)

Expand Down
15 changes: 5 additions & 10 deletions src/graphql/type/definition.py
Original file line number Diff line number Diff line change
Expand Up @@ -1638,18 +1638,15 @@ def assert_nullable_type(type_: Any) -> GraphQLNullableType:


@overload
def get_nullable_type(type_: None) -> None:
...
def get_nullable_type(type_: None) -> None: ...


@overload
def get_nullable_type(type_: GraphQLNullableType) -> GraphQLNullableType:
...
def get_nullable_type(type_: GraphQLNullableType) -> GraphQLNullableType: ...


@overload
def get_nullable_type(type_: GraphQLNonNull) -> GraphQLNullableType:
...
def get_nullable_type(type_: GraphQLNonNull) -> GraphQLNullableType: ...


def get_nullable_type(
Expand Down Expand Up @@ -1690,13 +1687,11 @@ def assert_named_type(type_: Any) -> GraphQLNamedType:


@overload
def get_named_type(type_: None) -> None:
...
def get_named_type(type_: None) -> None: ...


@overload
def get_named_type(type_: GraphQLType) -> GraphQLNamedType:
...
def get_named_type(type_: GraphQLType) -> GraphQLNamedType: ...


def get_named_type(type_: GraphQLType | None) -> GraphQLNamedType | None:
Expand Down
12 changes: 6 additions & 6 deletions src/graphql/type/schema.py
Original file line number Diff line number Diff line change
Expand Up @@ -238,9 +238,9 @@ def __init__(
if iface.name in implementations_map:
implementations = implementations_map[iface.name]
else:
implementations = implementations_map[
iface.name
] = InterfaceImplementations(objects=[], interfaces=[])
implementations = implementations_map[iface.name] = (
InterfaceImplementations(objects=[], interfaces=[])
)

implementations.interfaces.append(named_type)
elif is_object_type(named_type):
Expand All @@ -250,9 +250,9 @@ def __init__(
if iface.name in implementations_map:
implementations = implementations_map[iface.name]
else:
implementations = implementations_map[
iface.name
] = InterfaceImplementations(objects=[], interfaces=[])
implementations = implementations_map[iface.name] = (
InterfaceImplementations(objects=[], interfaces=[])
)

implementations.objects.append(named_type)

Expand Down
4 changes: 1 addition & 3 deletions src/graphql/type/validate.py
Original file line number Diff line number Diff line change
Expand Up @@ -235,9 +235,7 @@ def validate_types(self) -> None:
# Ensure Input Objects do not contain non-nullable circular references
validate_input_object_circular_refs(type_)

def validate_fields(
self, type_: GraphQLObjectType | GraphQLInterfaceType
) -> None:
def validate_fields(self, type_: GraphQLObjectType | GraphQLInterfaceType) -> None:
fields = type_.fields

# Objects and Interfaces both must define one or more fields.
Expand Down
9 changes: 3 additions & 6 deletions src/graphql/utilities/ast_to_dict.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,26 +13,23 @@
@overload
def ast_to_dict(
node: Node, locations: bool = False, cache: dict[Node, Any] | None = None
) -> dict:
...
) -> dict: ...


@overload
def ast_to_dict(
node: Collection[Node],
locations: bool = False,
cache: dict[Node, Any] | None = None,
) -> list[Node]:
...
) -> list[Node]: ...


@overload
def ast_to_dict(
node: OperationType,
locations: bool = False,
cache: dict[Node, Any] | None = None,
) -> str:
...
) -> str: ...


def ast_to_dict(
Expand Down
2 changes: 1 addition & 1 deletion src/graphql/utilities/get_operation_ast.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
""""Get operation AST node"""
"""Get operation AST node"""

from __future__ import annotations

Expand Down
12 changes: 4 additions & 8 deletions src/graphql/utilities/type_from_ast.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,27 +21,23 @@
@overload
def type_from_ast(
schema: GraphQLSchema, type_node: NamedTypeNode
) -> GraphQLNamedType | None:
...
) -> GraphQLNamedType | None: ...


@overload
def type_from_ast(
schema: GraphQLSchema, type_node: ListTypeNode
) -> GraphQLList | None:
...
) -> GraphQLList | None: ...


@overload
def type_from_ast(
schema: GraphQLSchema, type_node: NonNullTypeNode
) -> GraphQLNonNull | None:
...
) -> GraphQLNonNull | None: ...


@overload
def type_from_ast(schema: GraphQLSchema, type_node: TypeNode) -> GraphQLType | None:
...
def type_from_ast(schema: GraphQLSchema, type_node: TypeNode) -> GraphQLType | None: ...


def type_from_ast(
Expand Down
4 changes: 1 addition & 3 deletions src/graphql/utilities/value_from_ast_untyped.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,9 +77,7 @@ def value_from_string(
return value_node.value


def value_from_list(
value_node: ListValueNode, variables: dict[str, Any] | None
) -> Any:
def value_from_list(value_node: ListValueNode, variables: dict[str, Any] | None) -> Any:
return [value_from_ast_untyped(node, variables) for node in value_node.values]


Expand Down
4 changes: 1 addition & 3 deletions src/graphql/validation/rules/unique_operation_types.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,7 @@ def __init__(self, context: SDLValidationContext) -> None:
self.defined_operation_types: dict[
OperationType, OperationTypeDefinitionNode
] = {}
self.existing_operation_types: dict[
OperationType, GraphQLObjectType | None
] = (
self.existing_operation_types: dict[OperationType, GraphQLObjectType | None] = (
{
OperationType.QUERY: schema.query_type,
OperationType.MUTATION: schema.mutation_type,
Expand Down
Loading

0 comments on commit 634ee95

Please sign in to comment.