Skip to content

Commit 924c1fb

Browse files
committed
Revert "Add Black, pyupgrade to pre-commit & apply to all files"
This reverts commit ec7daec.
1 parent 8abff09 commit 924c1fb

29 files changed

+710
-1005
lines changed

.pre-commit-config.yaml

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -11,15 +11,12 @@ repos:
1111
exclude: ^docs/.*$
1212
- id: trailing-whitespace
1313
exclude: README.md
14-
- repo: https://github.com/asottile/pyupgrade
15-
rev: v2.32.1
16-
hooks:
17-
- id: pyupgrade
18-
- repo: https://github.com/ambv/black
19-
rev: 22.3.0
20-
hooks:
21-
- id: black
2214
- repo: https://github.com/PyCQA/flake8
23-
rev: 4.0.1
15+
rev: 4.0.0
2416
hooks:
2517
- id: flake8
18+
- repo: https://github.com/pycqa/isort
19+
rev: 5.10.1
20+
hooks:
21+
- id: isort
22+
name: isort (python)

docs/conf.py

Lines changed: 43 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import os
22

3-
on_rtd = os.environ.get("READTHEDOCS", None) == "True"
3+
on_rtd = os.environ.get('READTHEDOCS', None) == 'True'
44

55
# -*- coding: utf-8 -*-
66
#
@@ -34,46 +34,46 @@
3434
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
3535
# ones.
3636
extensions = [
37-
"sphinx.ext.autodoc",
38-
"sphinx.ext.intersphinx",
39-
"sphinx.ext.todo",
40-
"sphinx.ext.coverage",
41-
"sphinx.ext.viewcode",
37+
'sphinx.ext.autodoc',
38+
'sphinx.ext.intersphinx',
39+
'sphinx.ext.todo',
40+
'sphinx.ext.coverage',
41+
'sphinx.ext.viewcode',
4242
]
4343
if not on_rtd:
4444
extensions += [
45-
"sphinx.ext.githubpages",
45+
'sphinx.ext.githubpages',
4646
]
4747

4848
# Add any paths that contain templates here, relative to this directory.
49-
templates_path = ["_templates"]
49+
templates_path = ['_templates']
5050

5151
# The suffix(es) of source filenames.
5252
# You can specify multiple suffix as a list of string:
5353
#
5454
# source_suffix = ['.rst', '.md']
55-
source_suffix = ".rst"
55+
source_suffix = '.rst'
5656

5757
# The encoding of source files.
5858
#
5959
# source_encoding = 'utf-8-sig'
6060

6161
# The master toctree document.
62-
master_doc = "index"
62+
master_doc = 'index'
6363

6464
# General information about the project.
65-
project = "Graphene Django"
66-
copyright = "Graphene 2016"
67-
author = "Syrus Akbary"
65+
project = u'Graphene Django'
66+
copyright = u'Graphene 2016'
67+
author = u'Syrus Akbary'
6868

6969
# The version info for the project you're documenting, acts as replacement for
7070
# |version| and |release|, also used in various other places throughout the
7171
# built documents.
7272
#
7373
# The short X.Y version.
74-
version = "1.0"
74+
version = u'1.0'
7575
# The full version, including alpha/beta/rc tags.
76-
release = "1.0.dev"
76+
release = u'1.0.dev'
7777

7878
# The language for content autogenerated by Sphinx. Refer to documentation
7979
# for a list of supported languages.
@@ -94,7 +94,7 @@
9494
# List of patterns, relative to source directory, that match files and
9595
# directories to ignore when looking for source files.
9696
# This patterns also effect to html_static_path and html_extra_path
97-
exclude_patterns = ["_build", "Thumbs.db", ".DS_Store"]
97+
exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store']
9898

9999
# The reST default role (used for this markup: `text`) to use for all
100100
# documents.
@@ -116,7 +116,7 @@
116116
# show_authors = False
117117

118118
# The name of the Pygments (syntax highlighting) style to use.
119-
pygments_style = "sphinx"
119+
pygments_style = 'sphinx'
120120

121121
# A list of ignored prefixes for module index sorting.
122122
# modindex_common_prefix = []
@@ -175,7 +175,7 @@
175175
# Add any paths that contain custom static files (such as style sheets) here,
176176
# relative to this directory. They are copied after the builtin static files,
177177
# so a file named "default.css" will overwrite the builtin "default.css".
178-
html_static_path = ["_static"]
178+
html_static_path = ['_static']
179179

180180
# Add any extra paths that contain custom files (such as robots.txt or
181181
# .htaccess) here, relative to this directory. These files are copied
@@ -255,30 +255,34 @@
255255
# html_search_scorer = 'scorer.js'
256256

257257
# Output file base name for HTML help builder.
258-
htmlhelp_basename = "Graphenedoc"
258+
htmlhelp_basename = 'Graphenedoc'
259259

260260
# -- Options for LaTeX output ---------------------------------------------
261261

262262
latex_elements = {
263-
# The paper size ('letterpaper' or 'a4paper').
264-
#
265-
# 'papersize': 'letterpaper',
266-
# The font size ('10pt', '11pt' or '12pt').
267-
#
268-
# 'pointsize': '10pt',
269-
# Additional stuff for the LaTeX preamble.
270-
#
271-
# 'preamble': '',
272-
# Latex figure (float) alignment
273-
#
274-
# 'figure_align': 'htbp',
263+
# The paper size ('letterpaper' or 'a4paper').
264+
#
265+
# 'papersize': 'letterpaper',
266+
267+
# The font size ('10pt', '11pt' or '12pt').
268+
#
269+
# 'pointsize': '10pt',
270+
271+
# Additional stuff for the LaTeX preamble.
272+
#
273+
# 'preamble': '',
274+
275+
# Latex figure (float) alignment
276+
#
277+
# 'figure_align': 'htbp',
275278
}
276279

277280
# Grouping the document tree into LaTeX files. List of tuples
278281
# (source start file, target name, title,
279282
# author, documentclass [howto, manual, or own class]).
280283
latex_documents = [
281-
(master_doc, "Graphene.tex", "Graphene Documentation", "Syrus Akbary", "manual"),
284+
(master_doc, 'Graphene.tex', u'Graphene Documentation',
285+
u'Syrus Akbary', 'manual'),
282286
]
283287

284288
# The name of an image file (relative to this directory) to place at the top of
@@ -319,7 +323,8 @@
319323
# One entry per manual page. List of tuples
320324
# (source start file, name, description, authors, manual section).
321325
man_pages = [
322-
(master_doc, "graphene_django", "Graphene Django Documentation", [author], 1)
326+
(master_doc, 'graphene_django', u'Graphene Django Documentation',
327+
[author], 1)
323328
]
324329

325330
# If true, show URL addresses after external links.
@@ -333,15 +338,9 @@
333338
# (source start file, target name, title, author,
334339
# dir menu entry, description, category)
335340
texinfo_documents = [
336-
(
337-
master_doc,
338-
"Graphene-Django",
339-
"Graphene Django Documentation",
340-
author,
341-
"Graphene Django",
342-
"One line description of project.",
343-
"Miscellaneous",
344-
),
341+
(master_doc, 'Graphene-Django', u'Graphene Django Documentation',
342+
author, 'Graphene Django', 'One line description of project.',
343+
'Miscellaneous'),
345344
]
346345

347346
# Documents to append as an appendix to all manuals.
@@ -415,7 +414,7 @@
415414
# epub_post_files = []
416415

417416
# A list of files that should not be packed into the epub file.
418-
epub_exclude_files = ["search.html"]
417+
epub_exclude_files = ['search.html']
419418

420419
# The depth of the table of contents in toc.ncx.
421420
#
@@ -447,4 +446,4 @@
447446

448447

449448
# Example configuration for intersphinx: refer to the Python standard library.
450-
intersphinx_mapping = {"https://docs.python.org/": None}
449+
intersphinx_mapping = {'https://docs.python.org/': None}

examples/flask_sqlalchemy/database.py

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,10 @@
22
from sqlalchemy.ext.declarative import declarative_base
33
from sqlalchemy.orm import scoped_session, sessionmaker
44

5-
engine = create_engine("sqlite:///database.sqlite3", convert_unicode=True)
6-
db_session = scoped_session(
7-
sessionmaker(autocommit=False, autoflush=False, bind=engine)
8-
)
5+
engine = create_engine('sqlite:///database.sqlite3', convert_unicode=True)
6+
db_session = scoped_session(sessionmaker(autocommit=False,
7+
autoflush=False,
8+
bind=engine))
99
Base = declarative_base()
1010
Base.query = db_session.query_property()
1111

@@ -15,25 +15,24 @@ def init_db():
1515
# they will be registered properly on the metadata. Otherwise
1616
# you will have to import them first before calling init_db()
1717
from models import Department, Employee, Role
18-
1918
Base.metadata.drop_all(bind=engine)
2019
Base.metadata.create_all(bind=engine)
2120

2221
# Create the fixtures
23-
engineering = Department(name="Engineering")
22+
engineering = Department(name='Engineering')
2423
db_session.add(engineering)
25-
hr = Department(name="Human Resources")
24+
hr = Department(name='Human Resources')
2625
db_session.add(hr)
2726

28-
manager = Role(name="manager")
27+
manager = Role(name='manager')
2928
db_session.add(manager)
30-
engineer = Role(name="engineer")
29+
engineer = Role(name='engineer')
3130
db_session.add(engineer)
3231

33-
peter = Employee(name="Peter", department=engineering, role=engineer)
32+
peter = Employee(name='Peter', department=engineering, role=engineer)
3433
db_session.add(peter)
35-
roy = Employee(name="Roy", department=engineering, role=engineer)
34+
roy = Employee(name='Roy', department=engineering, role=engineer)
3635
db_session.add(roy)
37-
tracy = Employee(name="Tracy", department=hr, role=manager)
36+
tracy = Employee(name='Tracy', department=hr, role=manager)
3837
db_session.add(tracy)
3938
db_session.commit()

examples/flask_sqlalchemy/models.py

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4,31 +4,35 @@
44

55

66
class Department(Base):
7-
__tablename__ = "department"
7+
__tablename__ = 'department'
88
id = Column(Integer, primary_key=True)
99
name = Column(String)
1010

1111

1212
class Role(Base):
13-
__tablename__ = "roles"
13+
__tablename__ = 'roles'
1414
role_id = Column(Integer, primary_key=True)
1515
name = Column(String)
1616

1717

1818
class Employee(Base):
19-
__tablename__ = "employee"
19+
__tablename__ = 'employee'
2020
id = Column(Integer, primary_key=True)
2121
name = Column(String)
2222
# Use default=func.now() to set the default hiring time
2323
# of an Employee to be the current time when an
2424
# Employee record was created
2525
hired_on = Column(DateTime, default=func.now())
26-
department_id = Column(Integer, ForeignKey("department.id"))
27-
role_id = Column(Integer, ForeignKey("roles.role_id"))
26+
department_id = Column(Integer, ForeignKey('department.id'))
27+
role_id = Column(Integer, ForeignKey('roles.role_id'))
2828
# Use cascade='delete,all' to propagate the deletion of a Department onto its Employees
2929
department = relationship(
30-
Department, backref=backref("employees", uselist=True, cascade="delete,all")
31-
)
30+
Department,
31+
backref=backref('employees',
32+
uselist=True,
33+
cascade='delete,all'))
3234
role = relationship(
33-
Role, backref=backref("roles", uselist=True, cascade="delete,all")
34-
)
35+
Role,
36+
backref=backref('roles',
37+
uselist=True,
38+
cascade='delete,all'))

examples/flask_sqlalchemy/schema.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,27 +10,26 @@
1010
class Department(SQLAlchemyObjectType):
1111
class Meta:
1212
model = DepartmentModel
13-
interfaces = (relay.Node,)
13+
interfaces = (relay.Node, )
1414

1515

1616
class Employee(SQLAlchemyObjectType):
1717
class Meta:
1818
model = EmployeeModel
19-
interfaces = (relay.Node,)
19+
interfaces = (relay.Node, )
2020

2121

2222
class Role(SQLAlchemyObjectType):
2323
class Meta:
2424
model = RoleModel
25-
interfaces = (relay.Node,)
25+
interfaces = (relay.Node, )
2626

2727

2828
class Query(graphene.ObjectType):
2929
node = relay.Node.Field()
3030
# Allow only single column sorting
3131
all_employees = SQLAlchemyConnectionField(
32-
Employee.connection, sort=Employee.sort_argument()
33-
)
32+
Employee.connection, sort=Employee.sort_argument())
3433
# Allows sorting over multiple columns, by default over the primary key
3534
all_roles = SQLAlchemyConnectionField(Role.connection)
3635
# Disable sorting over this field

0 commit comments

Comments
 (0)