Skip to content

Commit 6394059

Browse files
committed
Improve config for development with VS Code
1 parent 3cf0d26 commit 6394059

File tree

4 files changed

+51
-28
lines changed

4 files changed

+51
-28
lines changed

.github/workflows/test.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ name: Tests
33
on: [push, pull_request]
44

55
jobs:
6-
build:
6+
tests:
77
runs-on: ubuntu-latest
88

99
strategy:

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
.tox/
99
.venv*/
1010
.vs/
11+
.vscode/
1112

1213
build/
1314
dist/

pyproject.toml

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -274,13 +274,32 @@ disallow_untyped_defs = true
274274

275275
[[tool.mypy.overrides]]
276276
module = [
277-
"graphql.pyutils.frozen_dict",
278-
"graphql.pyutils.frozen_list",
279277
"graphql.type.introspection",
280278
"tests.*"
281279
]
282280
disallow_untyped_defs = false
283281

282+
[tool.pyright]
283+
reportIncompatibleVariableOverride = false
284+
reportMissingTypeArgument = false
285+
reportUnknownArgumentType = false
286+
reportUnknownMemberType = false
287+
reportUnknownParameterType = false
288+
reportUnnecessaryIsInstance = false
289+
reportUnknownVariableType = false
290+
ignore = ["**/test_*"] # test functions
291+
292+
[tool.pylint.basic]
293+
max-module-lines = 2000
294+
295+
[tool.pylint.messages_control]
296+
disable = [
297+
"method-hidden",
298+
"missing-module-docstring", # test modules
299+
"redefined-outer-name",
300+
"unused-variable", # test functions
301+
]
302+
284303
[tool.pytest.ini_options]
285304
minversion = "7.4"
286305
# Only run benchmarks as tests.

src/graphql/type/definition.py

Lines changed: 28 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -189,15 +189,15 @@ def assert_type(type_: Any) -> GraphQLType:
189189

190190
# These types wrap and modify other types
191191

192-
GT = TypeVar("GT", bound=GraphQLType, covariant=True) # noqa: PLC0105
192+
GT_co = TypeVar("GT_co", bound=GraphQLType, covariant=True)
193193

194194

195-
class GraphQLWrappingType(GraphQLType, Generic[GT]):
195+
class GraphQLWrappingType(GraphQLType, Generic[GT_co]):
196196
"""Base class for all GraphQL wrapping types"""
197197

198-
of_type: GT
198+
of_type: GT_co
199199

200-
def __init__(self, type_: GT) -> None:
200+
def __init__(self, type_: GT_co) -> None:
201201
self.of_type = type_
202202

203203
def __repr__(self) -> str:
@@ -255,7 +255,7 @@ def _get_instance(cls, name: str, args: tuple) -> GraphQLNamedType:
255255
try:
256256
return cls.reserved_types[name]
257257
except KeyError:
258-
return cls(**dict(args))
258+
return cls(**dict(args)) # pyright: ignore
259259

260260
def __init__(
261261
self,
@@ -429,8 +429,8 @@ def parse_literal(
429429
def to_kwargs(self) -> GraphQLScalarTypeKwargs:
430430
"""Get corresponding arguments."""
431431
# noinspection PyArgumentList
432-
return GraphQLScalarTypeKwargs( # type: ignore
433-
super().to_kwargs(),
432+
return GraphQLScalarTypeKwargs(
433+
super().to_kwargs(), # type: ignore
434434
serialize=None
435435
if self.serialize is GraphQLScalarType.serialize
436436
else self.serialize,
@@ -552,11 +552,11 @@ def __copy__(self) -> GraphQLField: # pragma: no cover
552552
return self.__class__(**self.to_kwargs())
553553

554554

555-
TContext = TypeVar("TContext")
555+
TContext = TypeVar("TContext") # pylint: disable=invalid-name
556556

557557
try:
558558

559-
class GraphQLResolveInfo(NamedTuple, Generic[TContext]):
559+
class GraphQLResolveInfo(NamedTuple, Generic[TContext]): # pyright: ignore
560560
"""Collection of information passed to the resolvers.
561561
562562
This is always passed as the first argument to the resolvers.
@@ -768,8 +768,8 @@ def __init__(
768768
def to_kwargs(self) -> GraphQLObjectTypeKwargs:
769769
"""Get corresponding arguments."""
770770
# noinspection PyArgumentList
771-
return GraphQLObjectTypeKwargs( # type: ignore
772-
super().to_kwargs(),
771+
return GraphQLObjectTypeKwargs(
772+
super().to_kwargs(), # type: ignore
773773
fields=self.fields.copy(),
774774
interfaces=self.interfaces,
775775
is_type_of=self.is_type_of,
@@ -873,8 +873,8 @@ def __init__(
873873
def to_kwargs(self) -> GraphQLInterfaceTypeKwargs:
874874
"""Get corresponding arguments."""
875875
# noinspection PyArgumentList
876-
return GraphQLInterfaceTypeKwargs( # type: ignore
877-
super().to_kwargs(),
876+
return GraphQLInterfaceTypeKwargs(
877+
super().to_kwargs(), # type: ignore
878878
fields=self.fields.copy(),
879879
interfaces=self.interfaces,
880880
resolve_type=self.resolve_type,
@@ -978,8 +978,10 @@ def __init__(
978978
def to_kwargs(self) -> GraphQLUnionTypeKwargs:
979979
"""Get corresponding arguments."""
980980
# noinspection PyArgumentList
981-
return GraphQLUnionTypeKwargs( # type: ignore
982-
super().to_kwargs(), types=self.types, resolve_type=self.resolve_type
981+
return GraphQLUnionTypeKwargs(
982+
super().to_kwargs(), # type: ignore
983+
types=self.types,
984+
resolve_type=self.resolve_type,
983985
)
984986

985987
def __copy__(self) -> GraphQLUnionType: # pragma: no cover
@@ -1082,7 +1084,7 @@ def __init__(
10821084
isinstance(name, str) for name in values
10831085
):
10841086
try:
1085-
values = dict(values)
1087+
values = dict(values) # pyright: ignore
10861088
except (TypeError, ValueError) as error:
10871089
msg = (
10881090
f"{name} values must be an Enum or a mapping"
@@ -1107,8 +1109,9 @@ def __init__(
11071109
def to_kwargs(self) -> GraphQLEnumTypeKwargs:
11081110
"""Get corresponding arguments."""
11091111
# noinspection PyArgumentList
1110-
return GraphQLEnumTypeKwargs( # type: ignore
1111-
super().to_kwargs(), values=self.values.copy()
1112+
return GraphQLEnumTypeKwargs(
1113+
super().to_kwargs(), # type: ignore
1114+
values=self.values.copy(),
11121115
)
11131116

11141117
def __copy__(self) -> GraphQLEnumType: # pragma: no cover
@@ -1331,8 +1334,8 @@ def out_type(value: dict[str, Any]) -> Any:
13311334
def to_kwargs(self) -> GraphQLInputObjectTypeKwargs:
13321335
"""Get corresponding arguments."""
13331336
# noinspection PyArgumentList
1334-
return GraphQLInputObjectTypeKwargs( # type: ignore
1335-
super().to_kwargs(),
1337+
return GraphQLInputObjectTypeKwargs(
1338+
super().to_kwargs(), # type: ignore
13361339
fields=self.fields.copy(),
13371340
out_type=None
13381341
if self.out_type is GraphQLInputObjectType.out_type
@@ -1448,7 +1451,7 @@ def is_required_input_field(field: GraphQLInputField) -> bool:
14481451
# Wrapper types
14491452

14501453

1451-
class GraphQLList(GraphQLWrappingType[GT]):
1454+
class GraphQLList(GraphQLWrappingType[GT_co]):
14521455
"""List Type Wrapper
14531456
14541457
A list is a wrapping type which points to another type. Lists are often created
@@ -1467,7 +1470,7 @@ def fields(self):
14671470
}
14681471
"""
14691472

1470-
def __init__(self, type_: GT) -> None:
1473+
def __init__(self, type_: GT_co) -> None:
14711474
super().__init__(type_=type_)
14721475

14731476
def __str__(self) -> str:
@@ -1487,10 +1490,10 @@ def assert_list_type(type_: Any) -> GraphQLList:
14871490
return type_
14881491

14891492

1490-
GNT = TypeVar("GNT", bound="GraphQLNullableType", covariant=True) # noqa: PLC0105
1493+
GNT_co = TypeVar("GNT_co", bound="GraphQLNullableType", covariant=True)
14911494

14921495

1493-
class GraphQLNonNull(GraphQLWrappingType[GNT]):
1496+
class GraphQLNonNull(GraphQLWrappingType[GNT_co]):
14941497
"""Non-Null Type Wrapper
14951498
14961499
A non-null is a wrapping type which points to another type. Non-null types enforce
@@ -1510,7 +1513,7 @@ class RowType(GraphQLObjectType):
15101513
Note: the enforcement of non-nullability occurs within the executor.
15111514
"""
15121515

1513-
def __init__(self, type_: GNT) -> None:
1516+
def __init__(self, type_: GNT_co) -> None:
15141517
super().__init__(type_=type_)
15151518

15161519
def __str__(self) -> str:

0 commit comments

Comments
 (0)