Skip to content

Commit eec5328

Browse files
committed
Enforce import order (fix #49)
1 parent a4cbcf9 commit eec5328

File tree

17 files changed

+69
-58
lines changed

17 files changed

+69
-58
lines changed

.travis.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,8 @@ install:
1111
- pip install pytest>=2.7.3 --upgrade
1212
- pip install -e .
1313
script:
14-
- py.test --cov=graphql tests
1514
- flake8
15+
- import-order graphql
16+
- py.test --cov=graphql tests
1617
after_success:
1718
- coveralls

graphql/core/__init__.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
from .execution import execute, ExecutionResult
2-
from .language.source import Source
1+
from .execution import ExecutionResult, execute
32
from .language.parser import parse
3+
from .language.source import Source
44
from .validation import validate
55

66

graphql/core/execution/__init__.py

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,27 @@
11
# -*- coding: utf-8 -*-
22
import collections
33
from ..error import GraphQLError, format_error
4-
from ..utils import type_from_ast, is_nullish
54
from ..language import ast
6-
from .values import get_variable_values, get_argument_values
75
from ..type.definition import (
8-
GraphQLScalarType,
9-
GraphQLObjectType,
10-
GraphQLInterfaceType,
11-
GraphQLUnionType,
126
GraphQLEnumType,
7+
GraphQLInterfaceType,
138
GraphQLList,
149
GraphQLNonNull,
10+
GraphQLObjectType,
11+
GraphQLScalarType,
12+
GraphQLUnionType,
13+
)
14+
from ..type.directives import (
15+
GraphQLIncludeDirective,
16+
GraphQLSkipDirective,
1517
)
1618
from ..type.introspection import (
1719
SchemaMetaFieldDef,
1820
TypeMetaFieldDef,
1921
TypeNameMetaFieldDef,
2022
)
21-
from ..type.directives import (
22-
GraphQLIncludeDirective,
23-
GraphQLSkipDirective,
24-
)
23+
from ..utils import is_nullish, type_from_ast
24+
from .values import get_argument_values, get_variable_values
2525

2626
Undefined = object()
2727

graphql/core/execution/values.py

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,15 @@
33
from ..error import GraphQLError
44
from ..language import ast
55
from ..language.printer import print_ast
6-
from ..type import (GraphQLNonNull, GraphQLList, GraphQLInputObjectType,
7-
GraphQLScalarType, GraphQLEnumType, is_input_type)
8-
from ..utils import type_from_ast, is_nullish
6+
from ..type import (
7+
GraphQLEnumType,
8+
GraphQLInputObjectType,
9+
GraphQLList,
10+
GraphQLNonNull,
11+
GraphQLScalarType,
12+
is_input_type
13+
)
14+
from ..utils import is_nullish, type_from_ast
915

1016
__all__ = ['get_variable_values', 'get_argument_values']
1117

graphql/core/language/parser.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1+
from . import ast
12
from ..compat import str_type
2-
from .source import Source
33
from .error import LanguageError
4-
from .lexer import Lexer, TokenKind, get_token_kind_desc, get_token_desc
5-
from . import ast
4+
from .lexer import Lexer, TokenKind, get_token_desc, get_token_kind_desc
5+
from .source import Source
66

77
__all__ = ['parse']
88

graphql/core/language/printer.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import json
2-
from .visitor import visit, Visitor
2+
from .visitor import Visitor, visit
33

44
__all__ = ['print_ast']
55

graphql/core/language/visitor.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
from copy import copy, deepcopy
21
from collections import namedtuple
2+
from copy import copy, deepcopy
33
from . import ast
44

55
QUERY_DOCUMENT_KEYS = {

graphql/core/type/__init__.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
# flake8: noqa
2-
from .schema import GraphQLSchema
3-
from .definition import (
2+
from .definition import ( # no import order
43
GraphQLScalarType,
54
GraphQLObjectType,
65
GraphQLField,
@@ -15,10 +14,11 @@
1514
GraphQLNonNull,
1615
is_input_type,
1716
)
18-
from .scalars import (
17+
from .scalars import ( # no import order
1918
GraphQLInt,
2019
GraphQLFloat,
2120
GraphQLString,
2221
GraphQLBoolean,
2322
GraphQLID,
2423
)
24+
from .schema import GraphQLSchema

graphql/core/type/directives.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
from .definition import GraphQLNonNull, GraphQLArgument
1+
from .definition import GraphQLArgument, GraphQLNonNull
22
from .scalars import GraphQLBoolean
33

44

graphql/core/type/introspection.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,18 @@
11
import json
22
from .definition import (
3-
GraphQLObjectType,
4-
GraphQLField,
5-
GraphQLEnumType,
6-
GraphQLList,
7-
GraphQLNonNull,
83
GraphQLArgument,
4+
GraphQLEnumType,
95
GraphQLEnumValue,
10-
GraphQLInterfaceType,
11-
GraphQLUnionType,
6+
GraphQLField,
127
GraphQLInputObjectType,
8+
GraphQLInterfaceType,
9+
GraphQLList,
10+
GraphQLNonNull,
11+
GraphQLObjectType,
1312
GraphQLScalarType,
13+
GraphQLUnionType,
1414
)
15-
from .scalars import GraphQLString, GraphQLBoolean
15+
from .scalars import GraphQLBoolean, GraphQLString
1616

1717
__Schema = GraphQLObjectType(
1818
'__Schema',

0 commit comments

Comments
 (0)