Skip to content

Commit ca464ef

Browse files
committed
Enforcing quote format with black in develop.
1 parent 52887a2 commit ca464ef

25 files changed

+193
-185
lines changed

Makefile

+1-1
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ watch-$(SPHINX_SOURCEDIR): ##
120120
$(SPHINX_AUTOBUILD) $(SPHINX_SOURCEDIR) $(shell mktemp -d)
121121

122122
format: ## Reformats the whole codebase using our standards (requires black and isort).
123-
black -l 120 --skip-string-normalization .
123+
black -l 120 .
124124
isort -rc -o mondrian -o whistle -y .
125125

126126
medikit: # Checks installed medikit version and updates it if it is outdated.

Projectfile

+1-1
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ def on_make_generate(event):
8787
makefile.add_target(
8888
'format',
8989
'''
90-
black -l 120 --skip-string-normalization .
90+
black -l 120 .
9191
isort -rc -o mondrian -o whistle -y .
9292
''',
9393
phony=True,

benchmarks/parameters.py

+6-6
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,11 @@
1616

1717

1818
def j1(d):
19-
return {'prepend': 'foo', **d, 'append': 'bar'}
19+
return {"prepend": "foo", **d, "append": "bar"}
2020

2121

2222
def k1(**d):
23-
return {'prepend': 'foo', **d, 'append': 'bar'}
23+
return {"prepend": "foo", **d, "append": "bar"}
2424

2525

2626
def j2(d):
@@ -39,17 +39,17 @@ def k3(**d):
3939
return None
4040

4141

42-
if __name__ == '__main__':
42+
if __name__ == "__main__":
4343
import timeit
4444

45-
with open('person.json') as f:
45+
with open("person.json") as f:
4646
json_data = json.load(f)
4747

4848
for i in 1, 2, 3:
4949
print(
50-
'j{}'.format(i), timeit.timeit("j{}({!r})".format(i, json_data), setup="from __main__ import j{}".format(i))
50+
"j{}".format(i), timeit.timeit("j{}({!r})".format(i, json_data), setup="from __main__ import j{}".format(i))
5151
)
5252
print(
53-
'k{}'.format(i),
53+
"k{}".format(i),
5454
timeit.timeit("k{}(**{!r})".format(i, json_data), setup="from __main__ import k{}".format(i)),
5555
)

bin/update_apidoc.py

+21-21
Original file line numberDiff line numberDiff line change
@@ -2,48 +2,48 @@
22

33
from jinja2 import DictLoader, Environment
44

5-
__path__ = os.path.realpath(os.path.join(os.getcwd(), os.path.dirname(__file__), '..'))
5+
__path__ = os.path.realpath(os.path.join(os.getcwd(), os.path.dirname(__file__), ".."))
66

7-
apidoc_root = 'docs/reference/api'
7+
apidoc_root = "docs/reference/api"
88

99

1010
class Module:
1111
def __init__(self, name, title=None, *, automodule_options=None):
1212

1313
self.name = name
14-
self.title = title or ' '.join(map(str.title, self.name.split('.')[1:]))
14+
self.title = title or " ".join(map(str.title, self.name.split(".")[1:]))
1515
self.automodule_options = automodule_options or list()
1616

1717
def __repr__(self):
18-
return '<{} ({})>'.format(self.title, self.name)
18+
return "<{} ({})>".format(self.title, self.name)
1919

2020
def asdict(self):
21-
return {'name': self.name, 'title': self.title, 'automodule_options': self.automodule_options}
21+
return {"name": self.name, "title": self.title, "automodule_options": self.automodule_options}
2222

2323
def get_path(self):
24-
return os.path.join(__path__, apidoc_root, *self.name.split('.')) + '.rst'
24+
return os.path.join(__path__, apidoc_root, *self.name.split(".")) + ".rst"
2525

2626

2727
modules = [
28-
Module('bonobo', title='Bonobo'),
29-
Module('bonobo.config'),
30-
Module('bonobo.constants', automodule_options=['no-members']),
31-
Module('bonobo.execution'),
32-
Module('bonobo.execution.contexts'),
33-
Module('bonobo.execution.events'),
34-
Module('bonobo.execution.strategies'),
35-
Module('bonobo.util'),
28+
Module("bonobo", title="Bonobo"),
29+
Module("bonobo.config"),
30+
Module("bonobo.constants", automodule_options=["no-members"]),
31+
Module("bonobo.execution"),
32+
Module("bonobo.execution.contexts"),
33+
Module("bonobo.execution.events"),
34+
Module("bonobo.execution.strategies"),
35+
Module("bonobo.util"),
3636
]
3737

3838

3939
def underlined_filter(txt, chr):
40-
return txt + '\n' + chr * len(txt)
40+
return txt + "\n" + chr * len(txt)
4141

4242

4343
env = Environment(
4444
loader=DictLoader(
4545
{
46-
'module': '''
46+
"module": """
4747
{{ (':mod:`'~title~' <'~name~'>`') | underlined('=') }}
4848
4949
.. currentmodule:: {{ name }}
@@ -52,15 +52,15 @@ def underlined_filter(txt, chr):
5252
5353
.. automodule:: {{ name }}
5454
{% for opt in automodule_options %} :{{ opt }}:{{ "\n" }}{% endfor %}
55-
'''[
55+
"""[
5656
1:-1
5757
]
58-
+ '\n'
58+
+ "\n"
5959
}
6060
)
6161
)
62-
env.filters['underlined'] = underlined_filter
62+
env.filters["underlined"] = underlined_filter
6363

6464
for module in modules:
65-
with open(module.get_path(), 'w+') as f:
66-
f.write(env.get_template('module').render(module.asdict()))
65+
with open(module.get_path(), "w+") as f:
66+
f.write(env.get_template("module").render(module.asdict()))

bonobo/__init__.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
import sys
99

1010
if sys.version_info < (3, 5):
11-
raise RuntimeError('Python 3.5+ is required to use Bonobo.')
11+
raise RuntimeError("Python 3.5+ is required to use Bonobo.")
1212

1313
from bonobo._api import (
1414
run,
@@ -65,8 +65,8 @@ def _repr_html_():
6565
'<div style="padding: 8px;">'
6666
' <div style="float: left; width: 20px; height: 20px;">{}</div>'
6767
' <pre style="white-space: nowrap; padding-left: 8px">{}</pre>'
68-
'</div>'
69-
).format(__logo__, '<br/>'.join(get_versions(all=True)))
68+
"</div>"
69+
).format(__logo__, "<br/>".join(get_versions(all=True)))
7070

7171

7272
del sys

bonobo/_api.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -187,7 +187,7 @@ def get_examples_path(*pathsegments):
187187
import os
188188
import pathlib
189189

190-
return str(pathlib.Path(os.path.dirname(__file__), 'examples', *pathsegments))
190+
return str(pathlib.Path(os.path.dirname(__file__), "examples", *pathsegments))
191191

192192

193193
@api.register

bonobo/_version.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
__version__ = '0.6.3'
1+
__version__ = "0.6.3"

bonobo/commands/base.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,11 @@
44
import sys
55
from contextlib import contextmanager
66

7+
from mondrian import humanizer
8+
79
import bonobo.util.environ
810
from bonobo.util import get_name
911
from bonobo.util.environ import get_argument_parser, parse_args
10-
from mondrian import humanizer
1112

1213

1314
class BaseCommand:

bonobo/commands/convert.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
1+
from mondrian import humanizer
2+
13
import bonobo
24
from bonobo.commands import BaseCommand
35
from bonobo.registry import READER, WRITER, default_registry
46
from bonobo.util.resolvers import _resolve_options, _resolve_transformations
5-
from mondrian import humanizer
67

78

89
class ConvertCommand(BaseCommand):

bonobo/commands/init.py

+10-14
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
import os
22

33
from jinja2 import Environment, FileSystemLoader
4+
from mondrian import humanizer
45

56
from bonobo.commands import BaseCommand
6-
from mondrian import humanizer
77

88

99
class InitCommand(BaseCommand):
@@ -31,16 +31,12 @@ def create_file_from_template(self, *, template, filename):
3131
with open(filename, "w+") as f:
3232
f.write(template.render(name=name))
3333

34-
print(
35-
humanizer.Success(
36-
"Generated {} using template {!r}.".format(filename, template_name)
37-
)
38-
)
34+
print(humanizer.Success("Generated {} using template {!r}.".format(filename, template_name)))
3935

4036
def create_package(self, *, filename):
4137
_, ext = os.path.splitext(filename)
42-
if ext != '':
43-
raise ValueError('Package names should not have an extension.')
38+
if ext != "":
39+
raise ValueError("Package names should not have an extension.")
4440

4541
try:
4642
import medikit.commands
@@ -60,16 +56,16 @@ def create_package(self, *, filename):
6056
print(
6157
humanizer.Success(
6258
'Package "{}" has been created.'.format(package_name),
63-
'',
59+
"",
6460
"Install it...",
65-
'',
61+
"",
6662
" $ `pip install --editable {}`".format(filename),
67-
'',
63+
"",
6864
"Then maybe run the example...",
69-
'',
65+
"",
7066
" $ `python -m {}`".format(package_name),
71-
'',
72-
"Enjoy!"
67+
"",
68+
"Enjoy!",
7369
)
7470
)
7571

bonobo/commands/version.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
1-
from bonobo.commands import BaseCommand
21
from mondrian import humanizer
32

3+
from bonobo.commands import BaseCommand
4+
45

56
def get_versions(*, all=False, quiet=None):
67
import bonobo

bonobo/config/services.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ def __new__(cls, *args, **kwargs):
6868
if len(args) == 1:
6969
if len(kwargs):
7070
raise ValueError(
71-
'You can either use {} with one positional argument or with keyword arguments, not both.'.format(
71+
"You can either use {} with one positional argument or with keyword arguments, not both.".format(
7272
cls.__name__
7373
)
7474
)

bonobo/contrib/django/commands.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -60,8 +60,8 @@ def run(self, *args, **options):
6060

6161
for i, graph in enumerate(graph_coll):
6262
if not isinstance(graph, bonobo.Graph):
63-
raise ValueError('Expected a Graph instance, got {!r}.'.format(graph))
64-
print(term.lightwhite('{}. {}'.format(i + 1, graph.name)))
63+
raise ValueError("Expected a Graph instance, got {!r}.".format(graph))
64+
print(term.lightwhite("{}. {}".format(i + 1, graph.name)))
6565
result = bonobo.run(graph, services=services, strategy=strategy)
6666
results.append(result)
6767
print(term.lightblack(" ... return value: " + str(result)))

bonobo/util/bags.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ def BagType(typename, fields, *, verbose=False, module=None):
134134
if type(name) is not str:
135135
raise TypeError("Type names and field names must be strings, got {name!r}".format(name=name))
136136
if not isinstance(name, str):
137-
raise TypeError('Type names and field names must be strings, got {name!r}'.format(name=name))
137+
raise TypeError("Type names and field names must be strings, got {name!r}".format(name=name))
138138
if not i:
139139
if not name.isidentifier():
140140
raise ValueError("Type names must be valid identifiers: {name!r}".format(name=name))

bonobo/util/term.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
CLEAR_EOL = "\033[0K"
2-
MOVE_CURSOR_UP = '\033[{}A'.format
2+
MOVE_CURSOR_UP = "\033[{}A".format

docs/_templates/alabaster/__init__.py

+5-5
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,13 @@ def get_path():
1212

1313

1414
def update_context(app, pagename, templatename, context, doctree):
15-
context['alabaster_version'] = version.__version__
15+
context["alabaster_version"] = version.__version__
1616

1717

1818
def setup(app):
1919
# add_html_theme is new in Sphinx 1.6+
20-
if hasattr(app, 'add_html_theme'):
20+
if hasattr(app, "add_html_theme"):
2121
theme_path = os.path.abspath(os.path.dirname(__file__))
22-
app.add_html_theme('alabaster', theme_path)
23-
app.connect('html-page-context', update_context)
24-
return {'version': version.__version__, 'parallel_read_safe': True}
22+
app.add_html_theme("alabaster", theme_path)
23+
app.connect("html-page-context", update_context)
24+
return {"version": version.__version__, "parallel_read_safe": True}

docs/_templates/alabaster/_version.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
__version_info__ = (0, 7, 10)
2-
__version__ = '.'.join(map(str, __version_info__))
2+
__version__ = ".".join(map(str, __version_info__))

0 commit comments

Comments
 (0)