From 2f6ddd7c7e68db1bbd523c79727655cc45853015 Mon Sep 17 00:00:00 2001 From: Syrus Akbary Date: Mon, 2 Jul 2018 09:52:28 -0700 Subject: [PATCH] Added comments for if False checks --- graphql/backend/__init__.py | 1 + graphql/backend/base.py | 1 + graphql/backend/cache.py | 1 + graphql/backend/compiled.py | 1 + graphql/backend/core.py | 1 + graphql/backend/decider.py | 1 + graphql/error/base.py | 1 + graphql/error/format_error.py | 1 + graphql/error/located_error.py | 1 + graphql/error/syntax_error.py | 1 + graphql/error/tests/test_base.py | 1 + graphql/execution/base.py | 1 + graphql/execution/executor.py | 1 + graphql/execution/executors/asyncio.py | 1 + graphql/execution/executors/sync.py | 1 + graphql/execution/executors/thread.py | 1 + graphql/execution/executors/utils.py | 1 + graphql/execution/middleware.py | 1 + graphql/execution/tests/test_nonnull.py | 1 + graphql/execution/tests/test_subscribe.py | 1 + graphql/execution/utils.py | 1 + graphql/execution/values.py | 1 + graphql/graphql.py | 1 + graphql/language/ast.py | 1 + graphql/language/lexer.py | 1 + graphql/language/location.py | 1 + graphql/language/parser.py | 1 + graphql/language/printer.py | 1 + graphql/language/visitor.py | 1 + graphql/pyutils/cached_property.py | 1 + graphql/pyutils/contain_subset.py | 1 + graphql/pyutils/default_ordered_dict.py | 3 ++- graphql/pyutils/pair_set.py | 1 + graphql/type/definition.py | 1 + graphql/type/introspection.py | 1 + graphql/type/scalars.py | 1 + graphql/type/schema.py | 1 + graphql/type/typemap.py | 1 + graphql/utils/ast_to_code.py | 1 + graphql/utils/concat_ast.py | 1 + graphql/utils/get_field_def.py | 1 + graphql/utils/get_operation_ast.py | 1 + graphql/utils/is_valid_literal_value.py | 1 + graphql/utils/is_valid_value.py | 1 + graphql/utils/quoted_or_list.py | 1 + graphql/utils/schema_printer.py | 1 + graphql/utils/type_comparators.py | 1 + graphql/utils/type_from_ast.py | 1 + graphql/utils/type_info.py | 1 + graphql/utils/value_from_ast.py | 1 + graphql/validation/rules/__init__.py | 1 + graphql/validation/rules/arguments_of_correct_type.py | 1 + graphql/validation/rules/base.py | 1 + graphql/validation/rules/default_values_of_correct_type.py | 1 + graphql/validation/rules/fields_on_correct_type.py | 1 + graphql/validation/rules/fragments_on_composite_types.py | 1 + graphql/validation/rules/known_argument_names.py | 1 + graphql/validation/rules/known_type_names.py | 1 + graphql/validation/rules/lone_anonymous_operation.py | 1 + graphql/validation/rules/no_fragment_cycles.py | 1 + graphql/validation/rules/no_undefined_variables.py | 1 + graphql/validation/rules/no_unused_fragments.py | 1 + graphql/validation/rules/no_unused_variables.py | 1 + graphql/validation/rules/overlapping_fields_can_be_merged.py | 1 + graphql/validation/rules/possible_fragment_spreads.py | 1 + graphql/validation/rules/provided_non_null_arguments.py | 1 + graphql/validation/rules/scalar_leafs.py | 1 + graphql/validation/rules/unique_argument_names.py | 1 + graphql/validation/rules/unique_fragment_names.py | 1 + graphql/validation/rules/unique_input_field_names.py | 1 + graphql/validation/rules/unique_operation_names.py | 1 + graphql/validation/rules/unique_variable_names.py | 1 + graphql/validation/rules/variables_in_allowed_position.py | 1 + graphql/validation/validation.py | 1 + 74 files changed, 75 insertions(+), 1 deletion(-) diff --git a/graphql/backend/__init__.py b/graphql/backend/__init__.py index 87e9493e..9cd0e198 100644 --- a/graphql/backend/__init__.py +++ b/graphql/backend/__init__.py @@ -9,6 +9,7 @@ from .decider import GraphQLDeciderBackend from .cache import GraphQLCachedBackend +# Necessary for static type checking if False: # flake8: noqa from typing import Union diff --git a/graphql/backend/base.py b/graphql/backend/base.py index ee6c143e..9d3420b3 100644 --- a/graphql/backend/base.py +++ b/graphql/backend/base.py @@ -4,6 +4,7 @@ from abc import ABCMeta, abstractmethod import six +# Necessary for static type checking if False: # flake8: noqa from typing import Dict, Optional, Union, Callable from ..language.ast import Document diff --git a/graphql/backend/cache.py b/graphql/backend/cache.py index 1ecd1267..f6f0f4a1 100644 --- a/graphql/backend/cache.py +++ b/graphql/backend/cache.py @@ -4,6 +4,7 @@ from .base import GraphQLBackend +# Necessary for static type checking if False: # flake8: noqa from typing import Any, Dict, Optional, Union, Tuple, Hashable from .base import GraphQLDocument diff --git a/graphql/backend/compiled.py b/graphql/backend/compiled.py index 7dc88e50..e3805cd1 100644 --- a/graphql/backend/compiled.py +++ b/graphql/backend/compiled.py @@ -1,6 +1,7 @@ from six import string_types from .base import GraphQLDocument +# Necessary for static type checking if False: # flake8: noqa from ..type.schema import GraphQLSchema from typing import Any, Optional, Dict, Callable, Union diff --git a/graphql/backend/core.py b/graphql/backend/core.py index 9368c7de..0d956c15 100644 --- a/graphql/backend/core.py +++ b/graphql/backend/core.py @@ -8,6 +8,7 @@ from .base import GraphQLBackend, GraphQLDocument +# Necessary for static type checking if False: # flake8: noqa from typing import Any, Optional, Union from .base import GraphQLDocument diff --git a/graphql/backend/decider.py b/graphql/backend/decider.py index 6019393c..409b28fa 100644 --- a/graphql/backend/decider.py +++ b/graphql/backend/decider.py @@ -1,5 +1,6 @@ from .base import GraphQLBackend, GraphQLDocument +# Necessary for static type checking if False: # flake8: noqa from typing import List, Union, Any, Optional from ..type.schema import GraphQLSchema diff --git a/graphql/error/base.py b/graphql/error/base.py index f84482f2..c57d0959 100644 --- a/graphql/error/base.py +++ b/graphql/error/base.py @@ -1,6 +1,7 @@ import six from ..language.location import get_location +# Necessary for static type checking if False: # flake8: noqa from ..language.source import Source from ..language.location import SourceLocation diff --git a/graphql/error/format_error.py b/graphql/error/format_error.py index e60b6f1b..8cdec1ed 100644 --- a/graphql/error/format_error.py +++ b/graphql/error/format_error.py @@ -2,6 +2,7 @@ from .base import GraphQLError +# Necessary for static type checking if False: # flake8: noqa from .base import GraphQLError from .located_error import GraphQLLocatedError diff --git a/graphql/error/located_error.py b/graphql/error/located_error.py index 06bcccea..fe84e495 100644 --- a/graphql/error/located_error.py +++ b/graphql/error/located_error.py @@ -2,6 +2,7 @@ from .base import GraphQLError +# Necessary for static type checking if False: # flake8: noqa from ..language.ast import Field from typing import List, Union diff --git a/graphql/error/syntax_error.py b/graphql/error/syntax_error.py index 4be4a4b4..d38adc1f 100644 --- a/graphql/error/syntax_error.py +++ b/graphql/error/syntax_error.py @@ -1,6 +1,7 @@ from ..language.location import get_location from .base import GraphQLError +# Necessary for static type checking if False: # flake8: noqa from ..language.source import Source from ..language.location import SourceLocation diff --git a/graphql/error/tests/test_base.py b/graphql/error/tests/test_base.py index 28d8e2a3..e53f152a 100644 --- a/graphql/error/tests/test_base.py +++ b/graphql/error/tests/test_base.py @@ -5,6 +5,7 @@ from graphql.language.parser import parse from graphql.type import GraphQLField, GraphQLObjectType, GraphQLSchema, GraphQLString +# Necessary for static type checking if False: # flake8: noqa from graphql.execution.base import ResolveInfo from typing import Any diff --git a/graphql/execution/base.py b/graphql/execution/base.py index 36c42428..47bb71d4 100644 --- a/graphql/execution/base.py +++ b/graphql/execution/base.py @@ -12,6 +12,7 @@ ) from ..error.format_error import format_error as default_format_error +# Necessary for static type checking if False: # flake8: noqa from typing import Any, Optional, Dict, List, Union from ..language.ast import Field, OperationDefinition diff --git a/graphql/execution/executor.py b/graphql/execution/executor.py index d4043612..75f2ac95 100644 --- a/graphql/execution/executor.py +++ b/graphql/execution/executor.py @@ -35,6 +35,7 @@ from .executors.sync import SyncExecutor from .middleware import MiddlewareManager +# Necessary for static type checking if False: # flake8: noqa from typing import Any, Optional, Union, Dict, List, Callable from rx import Observable diff --git a/graphql/execution/executors/asyncio.py b/graphql/execution/executors/asyncio.py index 8dc183eb..bafa492b 100644 --- a/graphql/execution/executors/asyncio.py +++ b/graphql/execution/executors/asyncio.py @@ -4,6 +4,7 @@ from promise import Promise +# Necessary for static type checking if False: # flake8: noqa from asyncio.unix_events import _UnixSelectorEventLoop from typing import Optional, Any, Callable, List diff --git a/graphql/execution/executors/sync.py b/graphql/execution/executors/sync.py index df8aabb6..c45d8a8f 100644 --- a/graphql/execution/executors/sync.py +++ b/graphql/execution/executors/sync.py @@ -1,3 +1,4 @@ +# Necessary for static type checking if False: # flake8: noqa from typing import Any, Callable diff --git a/graphql/execution/executors/thread.py b/graphql/execution/executors/thread.py index 1544ec98..f540a1a0 100644 --- a/graphql/execution/executors/thread.py +++ b/graphql/execution/executors/thread.py @@ -4,6 +4,7 @@ from promise import Promise from .utils import process +# Necessary for static type checking if False: # flake8: noqa from typing import Any, Callable, List diff --git a/graphql/execution/executors/utils.py b/graphql/execution/executors/utils.py index d710e4c7..1ba3aaa6 100644 --- a/graphql/execution/executors/utils.py +++ b/graphql/execution/executors/utils.py @@ -1,5 +1,6 @@ from sys import exc_info +# Necessary for static type checking if False: # flake8: noqa from ..base import ResolveInfo from promise import Promise diff --git a/graphql/execution/middleware.py b/graphql/execution/middleware.py index 97cbec11..be61abda 100644 --- a/graphql/execution/middleware.py +++ b/graphql/execution/middleware.py @@ -4,6 +4,7 @@ from promise import Promise, promisify +# Necessary for static type checking if False: # flake8: noqa from .base import ResolveInfo from typing import Any, Callable, Iterator, Tuple, Union, List, Dict, Iterable diff --git a/graphql/execution/tests/test_nonnull.py b/graphql/execution/tests/test_nonnull.py index ebd1e844..6f8a3725 100644 --- a/graphql/execution/tests/test_nonnull.py +++ b/graphql/execution/tests/test_nonnull.py @@ -12,6 +12,7 @@ from .utils import rejected, resolved +# Necessary for static type checking if False: # flake8: noqa from promise import Promise from typing import Any, Optional, Dict, Tuple, Union diff --git a/graphql/execution/tests/test_subscribe.py b/graphql/execution/tests/test_subscribe.py index f6ad3f34..2fa039c3 100644 --- a/graphql/execution/tests/test_subscribe.py +++ b/graphql/execution/tests/test_subscribe.py @@ -15,6 +15,7 @@ subscribe, ) +# Necessary for static type checking if False: # flake8: noqa from graphql.execution.base import ResolveInfo from rx import Observable diff --git a/graphql/execution/utils.py b/graphql/execution/utils.py index a44cd503..a942c729 100644 --- a/graphql/execution/utils.py +++ b/graphql/execution/utils.py @@ -15,6 +15,7 @@ from ..utils.type_from_ast import type_from_ast from .values import get_argument_values, get_variable_values +# Necessary for static type checking if False: # flake8: noqa from ..type.definition import GraphQLObjectType, GraphQLField from ..type.schema import GraphQLSchema diff --git a/graphql/execution/values.py b/graphql/execution/values.py index c1a20f22..18388b4b 100644 --- a/graphql/execution/values.py +++ b/graphql/execution/values.py @@ -18,6 +18,7 @@ from ..utils.type_from_ast import type_from_ast from ..utils.value_from_ast import value_from_ast +# Necessary for static type checking if False: # flake8: noqa from ..language.ast import VariableDefinition, Argument from ..type.schema import GraphQLSchema diff --git a/graphql/graphql.py b/graphql/graphql.py index f7c394b7..7e22be53 100644 --- a/graphql/graphql.py +++ b/graphql/graphql.py @@ -3,6 +3,7 @@ from promise import promisify +# Necessary for static type checking if False: # flake8: noqa from rx import Observable from typing import Any, Union, Optional diff --git a/graphql/language/ast.py b/graphql/language/ast.py index a05072d3..f7f407ea 100644 --- a/graphql/language/ast.py +++ b/graphql/language/ast.py @@ -1,3 +1,4 @@ +# Necessary for static type checking if False: # flake8: noqa from .parser import Loc from typing import Any, Optional, Union, List, Tuple, Iterable diff --git a/graphql/language/lexer.py b/graphql/language/lexer.py index ce4f3179..a60bc6e2 100644 --- a/graphql/language/lexer.py +++ b/graphql/language/lexer.py @@ -4,6 +4,7 @@ from ..error import GraphQLSyntaxError +# Necessary for static type checking if False: # flake8: noqa from typing import Optional, Any, List from .source import Source diff --git a/graphql/language/location.py b/graphql/language/location.py index 6cf48f50..71c19bd9 100644 --- a/graphql/language/location.py +++ b/graphql/language/location.py @@ -1,3 +1,4 @@ +# Necessary for static type checking if False: # flake8: noqa from .source import Source from typing import Any diff --git a/graphql/language/parser.py b/graphql/language/parser.py index f8a20b84..8b658e50 100644 --- a/graphql/language/parser.py +++ b/graphql/language/parser.py @@ -5,6 +5,7 @@ from .lexer import Lexer, TokenKind, get_token_desc, get_token_kind_desc from .source import Source +# Necessary for static type checking if False: # flake8: noqa from typing import Dict, Union, Any, Optional, Callable, List from ..error.syntax_error import GraphQLSyntaxError diff --git a/graphql/language/printer.py b/graphql/language/printer.py index 02e15ee9..d2f27ef8 100644 --- a/graphql/language/printer.py +++ b/graphql/language/printer.py @@ -2,6 +2,7 @@ from .visitor import Visitor, visit +# Necessary for static type checking if False: # flake8: noqa from typing import Any, List, Optional, Union from graphql.language.ast import ( diff --git a/graphql/language/visitor.py b/graphql/language/visitor.py index c2a7bbac..66dded46 100644 --- a/graphql/language/visitor.py +++ b/graphql/language/visitor.py @@ -5,6 +5,7 @@ from . import ast from .visitor_meta import QUERY_DOCUMENT_KEYS, VisitorMeta +# Necessary for static type checking if False: # flake8: noqa from typing import Any, List, Optional, Union, Tuple, Dict from ..utils.type_info import TypeInfo diff --git a/graphql/pyutils/cached_property.py b/graphql/pyutils/cached_property.py index 119b9e2a..c17a4dbe 100644 --- a/graphql/pyutils/cached_property.py +++ b/graphql/pyutils/cached_property.py @@ -1,3 +1,4 @@ +# Necessary for static type checking if False: # flake8: noqa from typing import Any diff --git a/graphql/pyutils/contain_subset.py b/graphql/pyutils/contain_subset.py index da3aea78..3b34c621 100644 --- a/graphql/pyutils/contain_subset.py +++ b/graphql/pyutils/contain_subset.py @@ -1,3 +1,4 @@ +# Necessary for static type checking if False: # flake8: noqa from typing import Any, Dict diff --git a/graphql/pyutils/default_ordered_dict.py b/graphql/pyutils/default_ordered_dict.py index 83a0b307..2408cb43 100644 --- a/graphql/pyutils/default_ordered_dict.py +++ b/graphql/pyutils/default_ordered_dict.py @@ -1,6 +1,7 @@ import copy from collections import OrderedDict +# Necessary for static type checking if False: # flake8: noqa from typing import Any, List @@ -18,7 +19,7 @@ def __init__(self, default_factory=None, *a, **kw): self.default_factory = default_factory def __missing__(self, key): - # type: (str) -> List + # type: (str) -> Any if self.default_factory is None: raise KeyError(key) self[key] = value = self.default_factory() diff --git a/graphql/pyutils/pair_set.py b/graphql/pyutils/pair_set.py index 9b369a4c..e7b18ebb 100644 --- a/graphql/pyutils/pair_set.py +++ b/graphql/pyutils/pair_set.py @@ -1,3 +1,4 @@ +# Necessary for static type checking if False: # flake8: noqa from typing import Dict, Any diff --git a/graphql/type/definition.py b/graphql/type/definition.py index 2aba9352..9099242e 100644 --- a/graphql/type/definition.py +++ b/graphql/type/definition.py @@ -7,6 +7,7 @@ from ..utils.assert_valid_name import assert_valid_name from ..utils.undefined import Undefined +# Necessary for static type checking if False: # flake8: noqa from typing import List, Dict, Any, Callable, Optional, Union, Type diff --git a/graphql/type/introspection.py b/graphql/type/introspection.py index 1f5d1292..520011f2 100644 --- a/graphql/type/introspection.py +++ b/graphql/type/introspection.py @@ -18,6 +18,7 @@ from .directives import DirectiveLocation from .scalars import GraphQLBoolean, GraphQLString +# Necessary for static type checking if False: # flake8: noqa from ..execution.base import ResolveInfo from .definition import GraphQLInputObjectField diff --git a/graphql/type/scalars.py b/graphql/type/scalars.py index 0169e825..137cf279 100644 --- a/graphql/type/scalars.py +++ b/graphql/type/scalars.py @@ -3,6 +3,7 @@ from ..language.ast import BooleanValue, FloatValue, IntValue, StringValue from .definition import GraphQLScalarType +# Necessary for static type checking if False: # flake8: noqa from typing import Any, Optional, Union diff --git a/graphql/type/schema.py b/graphql/type/schema.py index 54e0a09f..3fe84659 100644 --- a/graphql/type/schema.py +++ b/graphql/type/schema.py @@ -5,6 +5,7 @@ from .introspection import IntrospectionSchema from .typemap import GraphQLTypeMap +# Necessary for static type checking if False: # flake8: noqa from .definition import ( GraphQLNamedType, diff --git a/graphql/type/typemap.py b/graphql/type/typemap.py index 146bd129..f492b7de 100644 --- a/graphql/type/typemap.py +++ b/graphql/type/typemap.py @@ -15,6 +15,7 @@ is_output_type, ) +# Necessary for static type checking if False: # flake8: noqa from ..type.definition import GraphQLNamedType from typing import Any, List, Optional, Union, Dict, Set, Mapping, DefaultDict diff --git a/graphql/utils/ast_to_code.py b/graphql/utils/ast_to_code.py index 2db01b35..07b8068b 100644 --- a/graphql/utils/ast_to_code.py +++ b/graphql/utils/ast_to_code.py @@ -1,6 +1,7 @@ from ..language.ast import Node from ..language.parser import Loc +# Necessary for static type checking if False: # flake8: noqa from typing import Any diff --git a/graphql/utils/concat_ast.py b/graphql/utils/concat_ast.py index 8685bbc0..1f5cfdc0 100644 --- a/graphql/utils/concat_ast.py +++ b/graphql/utils/concat_ast.py @@ -2,6 +2,7 @@ from ..language.ast import Document +# Necessary for static type checking if False: # flake8: noqa from typing import Iterable diff --git a/graphql/utils/get_field_def.py b/graphql/utils/get_field_def.py index 5b06973f..b690fbfb 100644 --- a/graphql/utils/get_field_def.py +++ b/graphql/utils/get_field_def.py @@ -5,6 +5,7 @@ TypeNameMetaFieldDef, ) +# Necessary for static type checking if False: # flake8: noqa from ..language.ast import Field from ..type.definition import GraphQLField, GraphQLInterfaceType, GraphQLObjectType diff --git a/graphql/utils/get_operation_ast.py b/graphql/utils/get_operation_ast.py index 56dccd4e..cd5ba26d 100644 --- a/graphql/utils/get_operation_ast.py +++ b/graphql/utils/get_operation_ast.py @@ -1,5 +1,6 @@ from ..language import ast +# Necessary for static type checking if False: # flake8: noqa from ..language.ast import Document, OperationDefinition from typing import Optional diff --git a/graphql/utils/is_valid_literal_value.py b/graphql/utils/is_valid_literal_value.py index 9e99d587..0949e6f4 100644 --- a/graphql/utils/is_valid_literal_value.py +++ b/graphql/utils/is_valid_literal_value.py @@ -8,6 +8,7 @@ GraphQLScalarType, ) +# Necessary for static type checking if False: # flake8: noqa from ..language.ast import ObjectValue, StringValue from ..type.definition import GraphQLInputObjectType, GraphQLScalarType diff --git a/graphql/utils/is_valid_value.py b/graphql/utils/is_valid_value.py index 2dd83bfc..8b403c94 100644 --- a/graphql/utils/is_valid_value.py +++ b/graphql/utils/is_valid_value.py @@ -15,6 +15,7 @@ GraphQLScalarType, ) +# Necessary for static type checking if False: # flake8: noqa from typing import Any, List diff --git a/graphql/utils/quoted_or_list.py b/graphql/utils/quoted_or_list.py index c968b73f..8931cec1 100644 --- a/graphql/utils/quoted_or_list.py +++ b/graphql/utils/quoted_or_list.py @@ -1,5 +1,6 @@ import functools +# Necessary for static type checking if False: # flake8: noqa from typing import List diff --git a/graphql/utils/schema_printer.py b/graphql/utils/schema_printer.py index 5fe2df68..30a28abd 100644 --- a/graphql/utils/schema_printer.py +++ b/graphql/utils/schema_printer.py @@ -11,6 +11,7 @@ from .ast_from_value import ast_from_value +# Necessary for static type checking if False: # flake8: noqa from ..type.definition import ( GraphQLArgument, diff --git a/graphql/utils/type_comparators.py b/graphql/utils/type_comparators.py index 4789df26..ba8867e1 100644 --- a/graphql/utils/type_comparators.py +++ b/graphql/utils/type_comparators.py @@ -7,6 +7,7 @@ is_abstract_type, ) +# Necessary for static type checking if False: # flake8: noqa from ..type.definition import ( GraphQLScalarType, diff --git a/graphql/utils/type_from_ast.py b/graphql/utils/type_from_ast.py index c76a2d28..1694cfd4 100644 --- a/graphql/utils/type_from_ast.py +++ b/graphql/utils/type_from_ast.py @@ -1,6 +1,7 @@ from ..language import ast from ..type.definition import GraphQLList, GraphQLNonNull +# Necessary for static type checking if False: # flake8: noqa from ..language.ast import ListType, NamedType, NonNullType from ..type.definition import GraphQLNamedType diff --git a/graphql/utils/type_info.py b/graphql/utils/type_info.py index 6a17de9b..76433eb6 100644 --- a/graphql/utils/type_info.py +++ b/graphql/utils/type_info.py @@ -11,6 +11,7 @@ from .get_field_def import get_field_def from .type_from_ast import type_from_ast +# Necessary for static type checking if False: # flake8: noqa from ..type.schema import GraphQLSchema from ..type.definition import ( diff --git a/graphql/utils/value_from_ast.py b/graphql/utils/value_from_ast.py index f8a78c70..ff012896 100644 --- a/graphql/utils/value_from_ast.py +++ b/graphql/utils/value_from_ast.py @@ -7,6 +7,7 @@ GraphQLScalarType, ) +# Necessary for static type checking if False: # flake8: noqa from ..language.ast import Node from ..type.definition import GraphQLType diff --git a/graphql/validation/rules/__init__.py b/graphql/validation/rules/__init__.py index e9f19cbf..056a530d 100644 --- a/graphql/validation/rules/__init__.py +++ b/graphql/validation/rules/__init__.py @@ -23,6 +23,7 @@ from .variables_are_input_types import VariablesAreInputTypes from .variables_in_allowed_position import VariablesInAllowedPosition +# Necessary for static type checking if False: # flake8: noqa from typing import List, Type from .base import ValidationRule diff --git a/graphql/validation/rules/arguments_of_correct_type.py b/graphql/validation/rules/arguments_of_correct_type.py index d9d7d950..7b9f87d3 100644 --- a/graphql/validation/rules/arguments_of_correct_type.py +++ b/graphql/validation/rules/arguments_of_correct_type.py @@ -3,6 +3,7 @@ from ...utils.is_valid_literal_value import is_valid_literal_value from .base import ValidationRule +# Necessary for static type checking if False: # flake8: noqa from ...language.ast import Argument from typing import Any, List, Union diff --git a/graphql/validation/rules/base.py b/graphql/validation/rules/base.py index 821dd747..53541c9c 100644 --- a/graphql/validation/rules/base.py +++ b/graphql/validation/rules/base.py @@ -1,5 +1,6 @@ from ...language.visitor import Visitor +# Necessary for static type checking if False: # flake8: noqa from ..validation import ValidationContext diff --git a/graphql/validation/rules/default_values_of_correct_type.py b/graphql/validation/rules/default_values_of_correct_type.py index d09500c4..d35c0872 100644 --- a/graphql/validation/rules/default_values_of_correct_type.py +++ b/graphql/validation/rules/default_values_of_correct_type.py @@ -4,6 +4,7 @@ from ...utils.is_valid_literal_value import is_valid_literal_value from .base import ValidationRule +# Necessary for static type checking if False: # flake8: noqa from ...language.ast import Document, OperationDefinition, SelectionSet from typing import List, Union diff --git a/graphql/validation/rules/fields_on_correct_type.py b/graphql/validation/rules/fields_on_correct_type.py index 03a68984..fdcec447 100644 --- a/graphql/validation/rules/fields_on_correct_type.py +++ b/graphql/validation/rules/fields_on_correct_type.py @@ -7,6 +7,7 @@ from ...utils.suggestion_list import suggestion_list from .base import ValidationRule +# Necessary for static type checking if False: # flake8: noqa from ...language.ast import Field, InlineFragment from typing import Any, List, Union diff --git a/graphql/validation/rules/fragments_on_composite_types.py b/graphql/validation/rules/fragments_on_composite_types.py index e775b700..33324b40 100644 --- a/graphql/validation/rules/fragments_on_composite_types.py +++ b/graphql/validation/rules/fragments_on_composite_types.py @@ -3,6 +3,7 @@ from ...type.definition import is_composite_type from .base import ValidationRule +# Necessary for static type checking if False: # flake8: noqa from ...language.ast import Field, InlineFragment from typing import Any, List, Union diff --git a/graphql/validation/rules/known_argument_names.py b/graphql/validation/rules/known_argument_names.py index e7b4839a..96966a8c 100644 --- a/graphql/validation/rules/known_argument_names.py +++ b/graphql/validation/rules/known_argument_names.py @@ -4,6 +4,7 @@ from ...utils.suggestion_list import suggestion_list from .base import ValidationRule +# Necessary for static type checking if False: # flake8: noqa from ...language.ast import Argument from typing import Any, List, Union diff --git a/graphql/validation/rules/known_type_names.py b/graphql/validation/rules/known_type_names.py index b0a95aeb..4c68c27b 100644 --- a/graphql/validation/rules/known_type_names.py +++ b/graphql/validation/rules/known_type_names.py @@ -3,6 +3,7 @@ from ...utils.suggestion_list import suggestion_list from .base import ValidationRule +# Necessary for static type checking if False: # flake8: noqa from ...language.ast import NamedType from typing import Any diff --git a/graphql/validation/rules/lone_anonymous_operation.py b/graphql/validation/rules/lone_anonymous_operation.py index 89c480f6..51b1ae23 100644 --- a/graphql/validation/rules/lone_anonymous_operation.py +++ b/graphql/validation/rules/lone_anonymous_operation.py @@ -2,6 +2,7 @@ from ...language import ast from .base import ValidationRule +# Necessary for static type checking if False: # flake8: noqa from ..validation import ValidationContext from ...language.ast import Document, OperationDefinition diff --git a/graphql/validation/rules/no_fragment_cycles.py b/graphql/validation/rules/no_fragment_cycles.py index f9a85a1f..e3cc06b0 100644 --- a/graphql/validation/rules/no_fragment_cycles.py +++ b/graphql/validation/rules/no_fragment_cycles.py @@ -1,6 +1,7 @@ from ...error import GraphQLError from .base import ValidationRule +# Necessary for static type checking if False: # flake8: noqa from ..validation import ValidationContext from ...language.ast import Document, OperationDefinition, FragmentSpread diff --git a/graphql/validation/rules/no_undefined_variables.py b/graphql/validation/rules/no_undefined_variables.py index 8a9ed3d3..59df5bb0 100644 --- a/graphql/validation/rules/no_undefined_variables.py +++ b/graphql/validation/rules/no_undefined_variables.py @@ -1,6 +1,7 @@ from ...error import GraphQLError from .base import ValidationRule +# Necessary for static type checking if False: # flake8: noqa from ..validation import ValidationContext from ...language.ast import Document, OperationDefinition diff --git a/graphql/validation/rules/no_unused_fragments.py b/graphql/validation/rules/no_unused_fragments.py index e8d2dfc1..320a0c4a 100644 --- a/graphql/validation/rules/no_unused_fragments.py +++ b/graphql/validation/rules/no_unused_fragments.py @@ -1,6 +1,7 @@ from ...error import GraphQLError from .base import ValidationRule +# Necessary for static type checking if False: # flake8: noqa from ..validation import ValidationContext from ...language.ast import Document, OperationDefinition, FragmentDefinition diff --git a/graphql/validation/rules/no_unused_variables.py b/graphql/validation/rules/no_unused_variables.py index 65b50337..49b81faf 100644 --- a/graphql/validation/rules/no_unused_variables.py +++ b/graphql/validation/rules/no_unused_variables.py @@ -1,6 +1,7 @@ from ...error import GraphQLError from .base import ValidationRule +# Necessary for static type checking if False: # flake8: noqa from ..validation import ValidationContext from ...language.ast import Document, OperationDefinition, VariableDefinition diff --git a/graphql/validation/rules/overlapping_fields_can_be_merged.py b/graphql/validation/rules/overlapping_fields_can_be_merged.py index ae8ee6c5..8506e2cd 100644 --- a/graphql/validation/rules/overlapping_fields_can_be_merged.py +++ b/graphql/validation/rules/overlapping_fields_can_be_merged.py @@ -17,6 +17,7 @@ from ...utils.type_from_ast import type_from_ast from .base import ValidationRule +# Necessary for static type checking if False: # flake8: noqa from ..validation import ValidationContext from ...language.ast import ( diff --git a/graphql/validation/rules/possible_fragment_spreads.py b/graphql/validation/rules/possible_fragment_spreads.py index d8bf329c..460d9191 100644 --- a/graphql/validation/rules/possible_fragment_spreads.py +++ b/graphql/validation/rules/possible_fragment_spreads.py @@ -3,6 +3,7 @@ from ...utils.type_from_ast import type_from_ast from .base import ValidationRule +# Necessary for static type checking if False: # flake8: noqa from ...language.ast import Field, InlineFragment from typing import Any, List, Union diff --git a/graphql/validation/rules/provided_non_null_arguments.py b/graphql/validation/rules/provided_non_null_arguments.py index 5558fd6d..bfdbabe8 100644 --- a/graphql/validation/rules/provided_non_null_arguments.py +++ b/graphql/validation/rules/provided_non_null_arguments.py @@ -2,6 +2,7 @@ from ...type.definition import GraphQLNonNull from .base import ValidationRule +# Necessary for static type checking if False: # flake8: noqa from ...language.ast import Field, InlineFragment from typing import Any, List, Optional, Union diff --git a/graphql/validation/rules/scalar_leafs.py b/graphql/validation/rules/scalar_leafs.py index 76d25a24..a36c4e8d 100644 --- a/graphql/validation/rules/scalar_leafs.py +++ b/graphql/validation/rules/scalar_leafs.py @@ -2,6 +2,7 @@ from ...type.definition import get_named_type, is_leaf_type from .base import ValidationRule +# Necessary for static type checking if False: # flake8: noqa from ...language.ast import Field, InlineFragment from typing import Any, List, Union diff --git a/graphql/validation/rules/unique_argument_names.py b/graphql/validation/rules/unique_argument_names.py index e59a5f85..4f7cefc1 100644 --- a/graphql/validation/rules/unique_argument_names.py +++ b/graphql/validation/rules/unique_argument_names.py @@ -1,6 +1,7 @@ from ...error import GraphQLError from .base import ValidationRule +# Necessary for static type checking if False: # flake8: noqa from ..validation import ValidationContext from ...language.ast import Field, InlineFragment, Argument, Name diff --git a/graphql/validation/rules/unique_fragment_names.py b/graphql/validation/rules/unique_fragment_names.py index cc67f8a4..aa7fa5ba 100644 --- a/graphql/validation/rules/unique_fragment_names.py +++ b/graphql/validation/rules/unique_fragment_names.py @@ -1,6 +1,7 @@ from ...error import GraphQLError from .base import ValidationRule +# Necessary for static type checking if False: # flake8: noqa from ..validation import ValidationContext from ...language.ast import Document, OperationDefinition, Name diff --git a/graphql/validation/rules/unique_input_field_names.py b/graphql/validation/rules/unique_input_field_names.py index dde35ec9..b0e64077 100644 --- a/graphql/validation/rules/unique_input_field_names.py +++ b/graphql/validation/rules/unique_input_field_names.py @@ -1,6 +1,7 @@ from ...error import GraphQLError from .base import ValidationRule +# Necessary for static type checking if False: # flake8: noqa from ..validation import ValidationContext from ...language.ast import Argument, ObjectValue, ObjectField, Name diff --git a/graphql/validation/rules/unique_operation_names.py b/graphql/validation/rules/unique_operation_names.py index d44d6ee2..f7546595 100644 --- a/graphql/validation/rules/unique_operation_names.py +++ b/graphql/validation/rules/unique_operation_names.py @@ -1,6 +1,7 @@ from ...error import GraphQLError from .base import ValidationRule +# Necessary for static type checking if False: # flake8: noqa from ..validation import ValidationContext from ...language.ast import Document, OperationDefinition, Name diff --git a/graphql/validation/rules/unique_variable_names.py b/graphql/validation/rules/unique_variable_names.py index 425d43f4..6d7bfcbf 100644 --- a/graphql/validation/rules/unique_variable_names.py +++ b/graphql/validation/rules/unique_variable_names.py @@ -1,6 +1,7 @@ from ...error import GraphQLError from .base import ValidationRule +# Necessary for static type checking if False: # flake8: noqa from ..validation import ValidationContext from ...language.ast import Document, OperationDefinition diff --git a/graphql/validation/rules/variables_in_allowed_position.py b/graphql/validation/rules/variables_in_allowed_position.py index 5bdd5da5..8a0209d1 100644 --- a/graphql/validation/rules/variables_in_allowed_position.py +++ b/graphql/validation/rules/variables_in_allowed_position.py @@ -4,6 +4,7 @@ from ...utils.type_from_ast import type_from_ast from .base import ValidationRule +# Necessary for static type checking if False: # flake8: noqa from ..validation import ValidationContext from ...language.ast import Document, OperationDefinition, VariableDefinition diff --git a/graphql/validation/validation.py b/graphql/validation/validation.py index 9422ad56..ed647742 100644 --- a/graphql/validation/validation.py +++ b/graphql/validation/validation.py @@ -4,6 +4,7 @@ from ..utils.type_info import TypeInfo from .rules import specified_rules +# Necessary for static type checking if False: # flake8: noqa from typing import List, Union, Optional, Dict, Set, Any, Type from ..language.ast import Document, OperationDefinition, SelectionSet, Node