Skip to content

Commit 25dd3d0

Browse files
authored
Add isort as pre-commit hook
Merge pull request #193 from Nabellaleen/precommit-isort
2 parents 1033de5 + bf28813 commit 25dd3d0

25 files changed

+80
-60
lines changed

.pre-commit-config.yaml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,3 +15,11 @@ repos:
1515
rev: 88caf5ac484f5c09aedc02167c59c66ff0af0068 # 3.7.7
1616
hooks:
1717
- id: flake8
18+
- repo: git://github.com/asottile/seed-isort-config
19+
rev: v1.7.0
20+
hooks:
21+
- id: seed-isort-config
22+
- repo: git://github.com/pre-commit/mirrors-isort
23+
rev: v4.3.4
24+
hooks:
25+
- id: isort

docs/conf.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@
136136
# html_theme = 'alabaster'
137137
# if on_rtd:
138138
# html_theme = 'sphinx_rtd_theme'
139-
import sphinx_graphene_theme
139+
import sphinx_graphene_theme # isort:skip
140140

141141
html_theme = "sphinx_graphene_theme"
142142

docs/tutorial.rst

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ Create ``flask_sqlalchemy/schema.py`` and type the following:
9393
import graphene
9494
from graphene import relay
9595
from graphene_sqlalchemy import SQLAlchemyObjectType, SQLAlchemyConnectionField
96-
from models import db_session, Department as DepartmentModel, Employee as EmployeeModel
96+
from .models import db_session, Department as DepartmentModel, Employee as EmployeeModel
9797
9898
9999
class Department(SQLAlchemyObjectType):
@@ -146,8 +146,8 @@ installed makes this task quite easy.
146146
from flask import Flask
147147
from flask_graphql import GraphQLView
148148
149-
from models import db_session
150-
from schema import schema, Department
149+
from .models import db_session
150+
from .schema import schema, Department
151151
152152
app = Flask(__name__)
153153
app.debug = True
@@ -175,7 +175,7 @@ Creating some data
175175
176176
$ python
177177
178-
>>> from models import engine, db_session, Base, Department, Employee
178+
>>> from .models import engine, db_session, Base, Department, Employee
179179
>>> Base.metadata.create_all(bind=engine)
180180
181181
>>> # Fill the tables with some data

examples/flask_sqlalchemy/app.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,10 @@
22

33
from flask import Flask
44

5-
from database import db_session, init_db
65
from flask_graphql import GraphQLView
7-
from schema import schema
6+
7+
from .database import db_session, init_db
8+
from .schema import schema
89

910
app = Flask(__name__)
1011
app.debug = True

examples/flask_sqlalchemy/database.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ def init_db():
1414
# import all modules here that might define models so that
1515
# they will be registered properly on the metadata. Otherwise
1616
# you will have to import them first before calling init_db()
17-
from models import Department, Employee, Role
17+
from .models import Department, Employee, Role
1818
Base.metadata.drop_all(bind=engine)
1919
Base.metadata.create_all(bind=engine)
2020

examples/flask_sqlalchemy/models.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
from sqlalchemy import Column, DateTime, ForeignKey, Integer, String, func
22
from sqlalchemy.orm import backref, relationship
33

4-
from database import Base
4+
from .database import Base
55

66

77
class Department(Base):

examples/flask_sqlalchemy/schema.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
11
import graphene
22
from graphene import relay
3-
from graphene_sqlalchemy import SQLAlchemyConnectionField, SQLAlchemyObjectType, utils
4-
from models import Department as DepartmentModel
5-
from models import Employee as EmployeeModel
6-
from models import Role as RoleModel
3+
from graphene_sqlalchemy import (SQLAlchemyConnectionField,
4+
SQLAlchemyObjectType, utils)
5+
6+
from .models import Department as DepartmentModel
7+
from .models import Employee as EmployeeModel
8+
from .models import Role as RoleModel
79

810

911
class Department(SQLAlchemyObjectType):

examples/nameko_sqlalchemy/app.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
1-
from database import db_session, init_db
2-
from schema import schema
3-
41
from graphql_server import (HttpQueryError, default_format_error,
5-
encode_execution_results, json_encode,load_json_body, run_http_query)
2+
encode_execution_results, json_encode,
3+
load_json_body, run_http_query)
4+
5+
from .database import db_session, init_db
6+
from .schema import schema
67

78

89
class App():

examples/nameko_sqlalchemy/database.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ def init_db():
1414
# import all modules here that might define models so that
1515
# they will be registered properly on the metadata. Otherwise
1616
# you will have to import them first before calling init_db()
17-
from models import Department, Employee, Role
17+
from .models import Department, Employee, Role
1818
Base.metadata.drop_all(bind=engine)
1919
Base.metadata.create_all(bind=engine)
2020

examples/nameko_sqlalchemy/models.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
from sqlalchemy import Column, DateTime, ForeignKey, Integer, String, func
22
from sqlalchemy.orm import backref, relationship
33

4-
from database import Base
4+
from .database import Base
55

66

77
class Department(Base):

0 commit comments

Comments
 (0)