Skip to content

Commit

Permalink
Added comments for if False checks
Browse files Browse the repository at this point in the history
  • Loading branch information
syrusakbary committed Jul 2, 2018
1 parent 80836e4 commit 2f6ddd7
Show file tree
Hide file tree
Showing 74 changed files with 75 additions and 1 deletion.
1 change: 1 addition & 0 deletions graphql/backend/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
1 change: 1 addition & 0 deletions graphql/backend/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions graphql/backend/cache.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions graphql/backend/compiled.py
Original file line number Diff line number Diff line change
@@ -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
Expand Down
1 change: 1 addition & 0 deletions graphql/backend/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions graphql/backend/decider.py
Original file line number Diff line number Diff line change
@@ -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
Expand Down
1 change: 1 addition & 0 deletions graphql/error/base.py
Original file line number Diff line number Diff line change
@@ -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
Expand Down
1 change: 1 addition & 0 deletions graphql/error/format_error.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions graphql/error/located_error.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions graphql/error/syntax_error.py
Original file line number Diff line number Diff line change
@@ -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
Expand Down
1 change: 1 addition & 0 deletions graphql/error/tests/test_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions graphql/execution/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions graphql/execution/executor.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions graphql/execution/executors/asyncio.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions graphql/execution/executors/sync.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# Necessary for static type checking
if False: # flake8: noqa
from typing import Any, Callable

Expand Down
1 change: 1 addition & 0 deletions graphql/execution/executors/thread.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
1 change: 1 addition & 0 deletions graphql/execution/executors/utils.py
Original file line number Diff line number Diff line change
@@ -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
Expand Down
1 change: 1 addition & 0 deletions graphql/execution/middleware.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions graphql/execution/tests/test_nonnull.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions graphql/execution/tests/test_subscribe.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
subscribe,
)

# Necessary for static type checking
if False: # flake8: noqa
from graphql.execution.base import ResolveInfo
from rx import Observable
Expand Down
1 change: 1 addition & 0 deletions graphql/execution/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions graphql/execution/values.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions graphql/graphql.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions graphql/language/ast.py
Original file line number Diff line number Diff line change
@@ -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
Expand Down
1 change: 1 addition & 0 deletions graphql/language/lexer.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions graphql/language/location.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# Necessary for static type checking
if False: # flake8: noqa
from .source import Source
from typing import Any
Expand Down
1 change: 1 addition & 0 deletions graphql/language/parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions graphql/language/printer.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 (
Expand Down
1 change: 1 addition & 0 deletions graphql/language/visitor.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions graphql/pyutils/cached_property.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# Necessary for static type checking
if False: # flake8: noqa
from typing import Any

Expand Down
1 change: 1 addition & 0 deletions graphql/pyutils/contain_subset.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# Necessary for static type checking
if False: # flake8: noqa
from typing import Any, Dict

Expand Down
3 changes: 2 additions & 1 deletion graphql/pyutils/default_ordered_dict.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import copy
from collections import OrderedDict

# Necessary for static type checking
if False: # flake8: noqa
from typing import Any, List

Expand All @@ -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()
Expand Down
1 change: 1 addition & 0 deletions graphql/pyutils/pair_set.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# Necessary for static type checking
if False: # flake8: noqa
from typing import Dict, Any

Expand Down
1 change: 1 addition & 0 deletions graphql/type/definition.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
1 change: 1 addition & 0 deletions graphql/type/introspection.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions graphql/type/scalars.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
1 change: 1 addition & 0 deletions graphql/type/schema.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
1 change: 1 addition & 0 deletions graphql/type/typemap.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions graphql/utils/ast_to_code.py
Original file line number Diff line number Diff line change
@@ -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

Expand Down
1 change: 1 addition & 0 deletions graphql/utils/concat_ast.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

from ..language.ast import Document

# Necessary for static type checking
if False: # flake8: noqa
from typing import Iterable

Expand Down
1 change: 1 addition & 0 deletions graphql/utils/get_field_def.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions graphql/utils/get_operation_ast.py
Original file line number Diff line number Diff line change
@@ -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
Expand Down
1 change: 1 addition & 0 deletions graphql/utils/is_valid_literal_value.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions graphql/utils/is_valid_value.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
GraphQLScalarType,
)

# Necessary for static type checking
if False: # flake8: noqa
from typing import Any, List

Expand Down
1 change: 1 addition & 0 deletions graphql/utils/quoted_or_list.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import functools

# Necessary for static type checking
if False: # flake8: noqa
from typing import List

Expand Down
1 change: 1 addition & 0 deletions graphql/utils/schema_printer.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
1 change: 1 addition & 0 deletions graphql/utils/type_comparators.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
is_abstract_type,
)

# Necessary for static type checking
if False: # flake8: noqa
from ..type.definition import (
GraphQLScalarType,
Expand Down
1 change: 1 addition & 0 deletions graphql/utils/type_from_ast.py
Original file line number Diff line number Diff line change
@@ -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
Expand Down
1 change: 1 addition & 0 deletions graphql/utils/type_info.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 (
Expand Down
1 change: 1 addition & 0 deletions graphql/utils/value_from_ast.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
GraphQLScalarType,
)

# Necessary for static type checking
if False: # flake8: noqa
from ..language.ast import Node
from ..type.definition import GraphQLType
Expand Down
1 change: 1 addition & 0 deletions graphql/validation/rules/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Loading

0 comments on commit 2f6ddd7

Please sign in to comment.