From 2532dd1b89d7c36e82dcb94bd8d09ba6042816b1 Mon Sep 17 00:00:00 2001 From: Jason Crowe Date: Thu, 12 Oct 2017 11:41:23 -0500 Subject: [PATCH 1/6] [doc] fix typos and errors. --- docs/tutorial/index.rst | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/docs/tutorial/index.rst b/docs/tutorial/index.rst index 3296afb..4ba99c2 100644 --- a/docs/tutorial/index.rst +++ b/docs/tutorial/index.rst @@ -5,7 +5,7 @@ What is Bonobo? ::::::::::::::: Bonobo is an ETL (Extract-Transform-Load) framework for python 3.5. The goal is to define data-transformations, with -python code in charge of handling similar shaped independant lines of data. +python code in charge of handling similar shaped independent lines of data. Bonobo *is not* a statistical or data-science tool. If you're looking for a data-analysis tool in python, use Pandas. @@ -21,13 +21,13 @@ Tutorial Good documentation is not easy to write. We do our best to make it better and better. - Although all content here should be accurate, you may feel a lack of completeness, for which we plaid guilty and + Although all content here should be accurate, you may feel a lack of completeness, for which we plead guilty and apologize. If you're stuck, please come and ask on our `slack channel `_, we'll figure something out. - If you're not stuck but had trouble understanding something, please consider contributing to the docs (via github + If you're not stuck but had trouble understanding something, please consider contributing to the docs (via GitHub pull requests). .. toctree:: From b0623c77c97889ab7b9fb30fe4bab3608e4f565d Mon Sep 17 00:00:00 2001 From: Romain Dorgueil Date: Sun, 15 Oct 2017 14:09:57 +0200 Subject: [PATCH 2/6] Fixes #186, probably the whole logic should be refactored as the approach of hardcoding iterators which we should not iterate on is bad. Let's think about it for 0.6, maybe that just means removing the ability to return a list/tuple from a function for multiple rows, as a generator would do the same. --- bonobo/util/iterators.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bonobo/util/iterators.py b/bonobo/util/iterators.py index 82f8518..04c81a5 100644 --- a/bonobo/util/iterators.py +++ b/bonobo/util/iterators.py @@ -38,6 +38,6 @@ def tuplize(generator): def iter_if_not_sequence(mixed): - if isinstance(mixed, (dict, list, str)): + if isinstance(mixed, (dict, list, str, bytes, )): raise TypeError(type(mixed).__name__) return iter(mixed) From 7c8625dda69308595796393f22404965f40a9f1f Mon Sep 17 00:00:00 2001 From: Romain Dorgueil Date: Mon, 16 Oct 2017 16:59:47 +0200 Subject: [PATCH 3/6] Update conf.py --- docs/conf.py | 1 + 1 file changed, 1 insertion(+) diff --git a/docs/conf.py b/docs/conf.py index 52fb506..afbbe83 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -76,6 +76,7 @@ html_theme_options = { 'github_user': 'python-bonobo', 'github_repo': 'bonobo', 'github_button': 'true', + 'github_banner': 'true', 'show_powered_by': 'false', 'show_related': 'true', } From 866824db7c5fac0e860bf0d784c8d766cb2e6ac4 Mon Sep 17 00:00:00 2001 From: Romain Dorgueil Date: Sat, 21 Oct 2017 12:38:02 +0200 Subject: [PATCH 4/6] [config] Adds __doc__ to option/service. Fix variable names in Option.__get__() that would have an unpredicatable behaviour in the rare case of using get on a type. Update to Medikit. --- Makefile | 18 +++++++++++++----- Projectfile | 4 ++-- bonobo/config/options.py | 8 +++++--- bonobo/config/services.py | 4 ++-- setup.py | 2 +- 5 files changed, 23 insertions(+), 13 deletions(-) diff --git a/Makefile b/Makefile index 221b012..fdab6c6 100644 --- a/Makefile +++ b/Makefile @@ -1,7 +1,5 @@ -# This file has been auto-generated. -# All changes will be lost, see Projectfile. -# -# Updated at 2017-10-05 18:56:33.985014 +# This file has been auto-generated by Medikit. All changes will be lost. +# Updated on 2017-10-21. PACKAGE ?= bonobo PYTHON ?= $(shell which python) @@ -22,7 +20,7 @@ YAPF ?= $(PYTHON) -m yapf YAPF_OPTIONS ?= -rip VERSION ?= $(shell git describe 2>/dev/null || echo dev) -.PHONY: $(SPHINX_SOURCEDIR) clean format install install-dev test +.PHONY: $(SPHINX_SOURCEDIR) clean format install install-dev test update update-requirements # Installs the local project dependencies. install: @@ -40,6 +38,16 @@ install-dev: clean: rm -rf build dist *.egg-info +# Update project artifacts using medikit, after installing it eventually. +update: + python -c 'import medikit; print(medikit.__version__)' || pip install medikit; + $(PYTHON) -m medikit update + +# Remove requirements files and update project artifacts using medikit, after installing it eventually. +update-requirements: + rm -rf requirements*.txt + $(MAKE) update + test: install-dev $(PYTEST) $(PYTEST_OPTIONS) tests diff --git a/Projectfile b/Projectfile index 0973c1f..c812fc1 100644 --- a/Projectfile +++ b/Projectfile @@ -1,6 +1,6 @@ -# bonobo (see github.com/python-edgy/project) +# bonobo's description for medikit -from edgy.project import require +from medikit import require pytest = require('pytest') python = require('python') diff --git a/bonobo/config/options.py b/bonobo/config/options.py index 065cc9d..7ee26e8 100644 --- a/bonobo/config/options.py +++ b/bonobo/config/options.py @@ -53,21 +53,23 @@ class Option: _creation_counter = 0 - def __init__(self, type=None, *, required=True, positional=False, default=None): + def __init__(self, type=None, *, required=True, positional=False, default=None, __doc__=None): self.name = None self.type = type self.required = required if default is None else False self.positional = positional self.default = default + self.__doc__ = __doc__ or self.__doc__ + # This hack is necessary for python3.5 self._creation_counter = Option._creation_counter Option._creation_counter += 1 - def __get__(self, inst, typ): + def __get__(self, inst, type_): # XXX If we call this on the type, then either return overriden value or ... ??? if inst is None: - return vars(type).get(self.name, self) + return vars(type_).get(self.name, self) if not self.name in inst._options_values: inst._options_values[self.name] = self.get_default() diff --git a/bonobo/config/services.py b/bonobo/config/services.py index 1810ebc..acf4dfd 100644 --- a/bonobo/config/services.py +++ b/bonobo/config/services.py @@ -49,8 +49,8 @@ class Service(Option): """ - def __init__(self, name): - super().__init__(str, required=False, default=name) + def __init__(self, name, __doc__=None): + super().__init__(str, required=False, default=name, __doc__=__doc__) def __set__(self, inst, value): inst._options_values[self.name] = validate_service_name(value) diff --git a/setup.py b/setup.py index be97d0c..7b513dc 100644 --- a/setup.py +++ b/setup.py @@ -1,4 +1,4 @@ -# This file is autogenerated by edgy.project code generator. +# This file is autogenerated by medikit code generator. # All changes will be overwritten. from setuptools import setup, find_packages From d596d3a4384f222ec70c9e30e4e1e6ad1d7b6030 Mon Sep 17 00:00:00 2001 From: Romain Dorgueil Date: Sat, 21 Oct 2017 12:39:46 +0200 Subject: [PATCH 5/6] Update requirements. --- requirements-docker.txt | 6 +++--- requirements-jupyter.txt | 2 +- requirements.txt | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/requirements-docker.txt b/requirements-docker.txt index 976b56d..9e68208 100644 --- a/requirements-docker.txt +++ b/requirements-docker.txt @@ -1,16 +1,16 @@ -e .[docker] appdirs==1.4.3 -bonobo-docker==0.2.11 +bonobo-docker==0.2.12 certifi==2017.7.27.1 chardet==3.0.4 colorama==0.3.9 docker-pycreds==0.2.1 docker==2.3.0 -fs==2.0.11 +fs==2.0.12 idna==2.6 packaging==16.8 pbr==3.1.1 -psutil==5.3.1 +psutil==5.4.0 pyparsing==2.2.0 pytz==2017.2 requests==2.18.4 diff --git a/requirements-jupyter.txt b/requirements-jupyter.txt index e1b0ba7..2ad75ab 100644 --- a/requirements-jupyter.txt +++ b/requirements-jupyter.txt @@ -19,7 +19,7 @@ markupsafe==1.0 mistune==0.7.4 nbconvert==5.3.1 nbformat==4.4.0 -notebook==5.1.0 +notebook==5.2.0 pandocfilters==1.4.2 parso==0.1.0 pexpect==4.2.1 diff --git a/requirements.txt b/requirements.txt index d6439df..13d5113 100644 --- a/requirements.txt +++ b/requirements.txt @@ -3,11 +3,11 @@ appdirs==1.4.3 certifi==2017.7.27.1 chardet==3.0.4 colorama==0.3.9 -fs==2.0.11 +fs==2.0.12 idna==2.6 packaging==16.8 pbr==3.1.1 -psutil==5.3.1 +psutil==5.4.0 pyparsing==2.2.0 pytz==2017.2 requests==2.18.4 From c7f39aa851a73894f015f7d1bd93fd1ae8911273 Mon Sep 17 00:00:00 2001 From: Romain Dorgueil Date: Sat, 21 Oct 2017 12:49:34 +0200 Subject: [PATCH 6/6] release: 0.5.1 --- bonobo/_version.py | 2 +- bonobo/commands/run.py | 5 +- bonobo/config/configurables.py | 5 +- bonobo/config/options.py | 5 +- bonobo/examples/datasets/fablabs.py | 19 ++-- bonobo/ext/console.py | 29 ++++-- bonobo/nodes/io/csv.py | 5 +- bonobo/nodes/io/pickle.py | 5 +- bonobo/structs/bags.py | 16 ++-- bonobo/util/iterators.py | 7 +- docs/_templates/alabaster/__init__.py | 4 +- docs/_templates/alabaster/support.py | 130 ++++++++++++-------------- tests/config/test_methods.py | 25 ++++- tests/config/test_methods_partial.py | 5 +- tests/config/test_services.py | 4 +- tests/io/test_csv.py | 9 +- tests/io/test_json.py | 9 +- tests/structs/test_bags.py | 26 +++++- tests/util/test_statistics.py | 5 +- 19 files changed, 196 insertions(+), 119 deletions(-) diff --git a/bonobo/_version.py b/bonobo/_version.py index 2b8877c..93b60a1 100644 --- a/bonobo/_version.py +++ b/bonobo/_version.py @@ -1 +1 @@ -__version__ = '0.5.0' +__version__ = '0.5.1' diff --git a/bonobo/commands/run.py b/bonobo/commands/run.py index a37282c..0a11577 100644 --- a/bonobo/commands/run.py +++ b/bonobo/commands/run.py @@ -3,7 +3,10 @@ import os import bonobo from bonobo.constants import DEFAULT_SERVICES_ATTR, DEFAULT_SERVICES_FILENAME -DEFAULT_GRAPH_FILENAMES = ('__main__.py', 'main.py', ) +DEFAULT_GRAPH_FILENAMES = ( + '__main__.py', + 'main.py', +) DEFAULT_GRAPH_ATTR = 'get_graph' diff --git a/bonobo/config/configurables.py b/bonobo/config/configurables.py index 1b0201f..85ecdde 100644 --- a/bonobo/config/configurables.py +++ b/bonobo/config/configurables.py @@ -50,7 +50,10 @@ class ConfigurableMeta(type): return (processor for _, processor in cls.__processors) def __repr__(self): - return ' '.join((' ', ' '.join('{}{}{}: {}'.format(Style.BRIGHT, k, Style.RESET_ALL, v) - for k, v in append), CLEAR_EOL + ' `-> ', ' '.join('{}{}{}: {}'.format(Style.BRIGHT, k, Style.RESET_ALL, v) for k, v in append), + CLEAR_EOL ) ), file=sys.stderr diff --git a/bonobo/nodes/io/csv.py b/bonobo/nodes/io/csv.py index 75fffe8..31222fb 100644 --- a/bonobo/nodes/io/csv.py +++ b/bonobo/nodes/io/csv.py @@ -60,7 +60,10 @@ class CsvReader(IOFormatEnabled, FileReader, CsvHandler): for row in reader: if len(row) != field_count: - raise ValueError('Got a line with %d fields, expecting %d.' % (len(row), field_count, )) + raise ValueError('Got a line with %d fields, expecting %d.' % ( + len(row), + field_count, + )) yield self.get_output(dict(zip(_headers, row))) diff --git a/bonobo/nodes/io/pickle.py b/bonobo/nodes/io/pickle.py index d9da55f..28db8af 100644 --- a/bonobo/nodes/io/pickle.py +++ b/bonobo/nodes/io/pickle.py @@ -52,7 +52,10 @@ class PickleReader(IOFormatEnabled, FileReader, PickleHandler): for i in iterator: if len(i) != item_count: - raise ValueError('Received an object with %d items, expecting %d.' % (len(i), item_count, )) + raise ValueError('Received an object with %d items, expecting %d.' % ( + len(i), + item_count, + )) yield self.get_output(dict(zip(i)) if is_dict else dict(zip(pickle_headers.value, i))) diff --git a/bonobo/structs/bags.py b/bonobo/structs/bags.py index 3eae9ff..28d2e02 100644 --- a/bonobo/structs/bags.py +++ b/bonobo/structs/bags.py @@ -45,7 +45,10 @@ class Bag: def args(self): if self._parent is None: return self._args - return (*self._parent.args, *self._args, ) + return ( + *self._parent.args, + *self._args, + ) @property def kwargs(self): @@ -100,11 +103,12 @@ class Bag: def __repr__(self): return '<{} ({})>'.format( - type(self).__name__, ', '. - join(itertools.chain( - map(repr, self.args), - ('{}={}'.format(k, repr(v)) for k, v in self.kwargs.items()), - )) + type(self).__name__, ', '.join( + itertools.chain( + map(repr, self.args), + ('{}={}'.format(k, repr(v)) for k, v in self.kwargs.items()), + ) + ) ) diff --git a/bonobo/util/iterators.py b/bonobo/util/iterators.py index 04c81a5..ee45614 100644 --- a/bonobo/util/iterators.py +++ b/bonobo/util/iterators.py @@ -38,6 +38,11 @@ def tuplize(generator): def iter_if_not_sequence(mixed): - if isinstance(mixed, (dict, list, str, bytes, )): + if isinstance(mixed, ( + dict, + list, + str, + bytes, + )): raise TypeError(type(mixed).__name__) return iter(mixed) diff --git a/docs/_templates/alabaster/__init__.py b/docs/_templates/alabaster/__init__.py index 39f1407..a4bebf2 100644 --- a/docs/_templates/alabaster/__init__.py +++ b/docs/_templates/alabaster/__init__.py @@ -14,11 +14,11 @@ def get_path(): def update_context(app, pagename, templatename, context, doctree): context['alabaster_version'] = version.__version__ + def setup(app): # add_html_theme is new in Sphinx 1.6+ if hasattr(app, 'add_html_theme'): theme_path = os.path.abspath(os.path.dirname(__file__)) app.add_html_theme('alabaster', theme_path) app.connect('html-page-context', update_context) - return {'version': version.__version__, - 'parallel_read_safe': True} + return {'version': version.__version__, 'parallel_read_safe': True} diff --git a/docs/_templates/alabaster/support.py b/docs/_templates/alabaster/support.py index 0f3aa8c..9147b52 100644 --- a/docs/_templates/alabaster/support.py +++ b/docs/_templates/alabaster/support.py @@ -7,82 +7,74 @@ from pygments.token import Keyword, Name, Comment, String, Error, \ # Originally based on FlaskyStyle which was based on 'tango'. class Alabaster(Style): - background_color = "#f8f8f8" # doesn't seem to override CSS 'pre' styling? + background_color = "#f8f8f8" # doesn't seem to override CSS 'pre' styling? default_style = "" styles = { # No corresponding class for the following: #Text: "", # class: '' - Whitespace: "underline #f8f8f8", # class: 'w' - Error: "#a40000 border:#ef2929", # class: 'err' - Other: "#000000", # class 'x' - - Comment: "italic #8f5902", # class: 'c' - Comment.Preproc: "noitalic", # class: 'cp' - - Keyword: "bold #004461", # class: 'k' - Keyword.Constant: "bold #004461", # class: 'kc' - Keyword.Declaration: "bold #004461", # class: 'kd' - Keyword.Namespace: "bold #004461", # class: 'kn' - Keyword.Pseudo: "bold #004461", # class: 'kp' - Keyword.Reserved: "bold #004461", # class: 'kr' - Keyword.Type: "bold #004461", # class: 'kt' - - Operator: "#582800", # class: 'o' - Operator.Word: "bold #004461", # class: 'ow' - like keywords - - Punctuation: "bold #000000", # class: 'p' + Whitespace: "underline #f8f8f8", # class: 'w' + Error: "#a40000 border:#ef2929", # class: 'err' + Other: "#000000", # class 'x' + Comment: "italic #8f5902", # class: 'c' + Comment.Preproc: "noitalic", # class: 'cp' + Keyword: "bold #004461", # class: 'k' + Keyword.Constant: "bold #004461", # class: 'kc' + Keyword.Declaration: "bold #004461", # class: 'kd' + Keyword.Namespace: "bold #004461", # class: 'kn' + Keyword.Pseudo: "bold #004461", # class: 'kp' + Keyword.Reserved: "bold #004461", # class: 'kr' + Keyword.Type: "bold #004461", # class: 'kt' + Operator: "#582800", # class: 'o' + Operator.Word: "bold #004461", # class: 'ow' - like keywords + Punctuation: "bold #000000", # class: 'p' # because special names such as Name.Class, Name.Function, etc. # are not recognized as such later in the parsing, we choose them # to look the same as ordinary variables. - Name: "#000000", # class: 'n' - Name.Attribute: "#c4a000", # class: 'na' - to be revised - Name.Builtin: "#004461", # class: 'nb' - Name.Builtin.Pseudo: "#3465a4", # class: 'bp' - Name.Class: "#000000", # class: 'nc' - to be revised - Name.Constant: "#000000", # class: 'no' - to be revised - Name.Decorator: "#888", # class: 'nd' - to be revised - Name.Entity: "#ce5c00", # class: 'ni' - Name.Exception: "bold #cc0000", # class: 'ne' - Name.Function: "#000000", # class: 'nf' - Name.Property: "#000000", # class: 'py' - Name.Label: "#f57900", # class: 'nl' - Name.Namespace: "#000000", # class: 'nn' - to be revised - Name.Other: "#000000", # class: 'nx' - Name.Tag: "bold #004461", # class: 'nt' - like a keyword - Name.Variable: "#000000", # class: 'nv' - to be revised - Name.Variable.Class: "#000000", # class: 'vc' - to be revised - Name.Variable.Global: "#000000", # class: 'vg' - to be revised - Name.Variable.Instance: "#000000", # class: 'vi' - to be revised - - Number: "#990000", # class: 'm' - - Literal: "#000000", # class: 'l' - Literal.Date: "#000000", # class: 'ld' - - String: "#4e9a06", # class: 's' - String.Backtick: "#4e9a06", # class: 'sb' - String.Char: "#4e9a06", # class: 'sc' - String.Doc: "italic #8f5902", # class: 'sd' - like a comment - String.Double: "#4e9a06", # class: 's2' - String.Escape: "#4e9a06", # class: 'se' - String.Heredoc: "#4e9a06", # class: 'sh' - String.Interpol: "#4e9a06", # class: 'si' - String.Other: "#4e9a06", # class: 'sx' - String.Regex: "#4e9a06", # class: 'sr' - String.Single: "#4e9a06", # class: 's1' - String.Symbol: "#4e9a06", # class: 'ss' - - Generic: "#000000", # class: 'g' - Generic.Deleted: "#a40000", # class: 'gd' - Generic.Emph: "italic #000000", # class: 'ge' - Generic.Error: "#ef2929", # class: 'gr' - Generic.Heading: "bold #000080", # class: 'gh' - Generic.Inserted: "#00A000", # class: 'gi' - Generic.Output: "#888", # class: 'go' - Generic.Prompt: "#745334", # class: 'gp' - Generic.Strong: "bold #000000", # class: 'gs' - Generic.Subheading: "bold #800080", # class: 'gu' - Generic.Traceback: "bold #a40000", # class: 'gt' + Name: "#000000", # class: 'n' + Name.Attribute: "#c4a000", # class: 'na' - to be revised + Name.Builtin: "#004461", # class: 'nb' + Name.Builtin.Pseudo: "#3465a4", # class: 'bp' + Name.Class: "#000000", # class: 'nc' - to be revised + Name.Constant: "#000000", # class: 'no' - to be revised + Name.Decorator: "#888", # class: 'nd' - to be revised + Name.Entity: "#ce5c00", # class: 'ni' + Name.Exception: "bold #cc0000", # class: 'ne' + Name.Function: "#000000", # class: 'nf' + Name.Property: "#000000", # class: 'py' + Name.Label: "#f57900", # class: 'nl' + Name.Namespace: "#000000", # class: 'nn' - to be revised + Name.Other: "#000000", # class: 'nx' + Name.Tag: "bold #004461", # class: 'nt' - like a keyword + Name.Variable: "#000000", # class: 'nv' - to be revised + Name.Variable.Class: "#000000", # class: 'vc' - to be revised + Name.Variable.Global: "#000000", # class: 'vg' - to be revised + Name.Variable.Instance: "#000000", # class: 'vi' - to be revised + Number: "#990000", # class: 'm' + Literal: "#000000", # class: 'l' + Literal.Date: "#000000", # class: 'ld' + String: "#4e9a06", # class: 's' + String.Backtick: "#4e9a06", # class: 'sb' + String.Char: "#4e9a06", # class: 'sc' + String.Doc: "italic #8f5902", # class: 'sd' - like a comment + String.Double: "#4e9a06", # class: 's2' + String.Escape: "#4e9a06", # class: 'se' + String.Heredoc: "#4e9a06", # class: 'sh' + String.Interpol: "#4e9a06", # class: 'si' + String.Other: "#4e9a06", # class: 'sx' + String.Regex: "#4e9a06", # class: 'sr' + String.Single: "#4e9a06", # class: 's1' + String.Symbol: "#4e9a06", # class: 'ss' + Generic: "#000000", # class: 'g' + Generic.Deleted: "#a40000", # class: 'gd' + Generic.Emph: "italic #000000", # class: 'ge' + Generic.Error: "#ef2929", # class: 'gr' + Generic.Heading: "bold #000080", # class: 'gh' + Generic.Inserted: "#00A000", # class: 'gi' + Generic.Output: "#888", # class: 'go' + Generic.Prompt: "#745334", # class: 'gp' + Generic.Strong: "bold #000000", # class: 'gs' + Generic.Subheading: "bold #800080", # class: 'gu' + Generic.Traceback: "bold #a40000", # class: 'gt' } diff --git a/tests/config/test_methods.py b/tests/config/test_methods.py index 9471a79..b0154fb 100644 --- a/tests/config/test_methods.py +++ b/tests/config/test_methods.py @@ -50,7 +50,10 @@ def test_define_with_decorator(): calls = [] def my_handler(*args, **kwargs): - calls.append((args, kwargs, )) + calls.append(( + args, + kwargs, + )) Concrete = MethodBasedConfigurable(my_handler) @@ -74,7 +77,10 @@ def test_late_binding_method_decoration(): @MethodBasedConfigurable(foo='foo') def Concrete(*args, **kwargs): - calls.append((args, kwargs, )) + calls.append(( + args, + kwargs, + )) assert callable(Concrete.handler) t = Concrete(bar='baz') @@ -89,7 +95,10 @@ def test_define_with_argument(): calls = [] def concrete_handler(*args, **kwargs): - calls.append((args, kwargs, )) + calls.append(( + args, + kwargs, + )) t = MethodBasedConfigurable(concrete_handler, 'foo', bar='baz') assert callable(t.handler) @@ -103,7 +112,10 @@ def test_define_with_inheritance(): class Inheriting(MethodBasedConfigurable): def handler(self, *args, **kwargs): - calls.append((args, kwargs, )) + calls.append(( + args, + kwargs, + )) t = Inheriting('foo', bar='baz') assert callable(t.handler) @@ -120,7 +132,10 @@ def test_inheritance_then_decorate(): @Inheriting def Concrete(*args, **kwargs): - calls.append((args, kwargs, )) + calls.append(( + args, + kwargs, + )) assert callable(Concrete.handler) t = Concrete('foo', bar='baz') diff --git a/tests/config/test_methods_partial.py b/tests/config/test_methods_partial.py index 6b44a0e..e2a1a65 100644 --- a/tests/config/test_methods_partial.py +++ b/tests/config/test_methods_partial.py @@ -53,7 +53,10 @@ def test_partial(): assert len(ci.options) == 4 assert len(ci.processors) == 1 assert ci.partial - assert ci.partial[0] == (f1, f2, ) + assert ci.partial[0] == ( + f1, + f2, + ) assert not len(ci.partial[1]) c = C('foo') diff --git a/tests/config/test_services.py b/tests/config/test_services.py index b12ae78..469b0c1 100644 --- a/tests/config/test_services.py +++ b/tests/config/test_services.py @@ -28,9 +28,7 @@ SERVICES = Container( class MyServiceDependantConfigurable(Configurable): - printer = Service( - PrinterInterface, - ) + printer = Service(PrinterInterface, ) def __call__(self, printer: PrinterInterface, *args): return printer.print(*args) diff --git a/tests/io/test_csv.py b/tests/io/test_csv.py index 9a9480c..2b7c55b 100644 --- a/tests/io/test_csv.py +++ b/tests/io/test_csv.py @@ -24,9 +24,12 @@ def test_write_csv_to_file_arg0(tmpdir): getattr(context, 'file') -@pytest.mark.parametrize('add_kwargs', ({}, { - 'ioformat': settings.IOFORMAT_KWARGS, -}, )) +@pytest.mark.parametrize('add_kwargs', ( + {}, + { + 'ioformat': settings.IOFORMAT_KWARGS, + }, +)) def test_write_csv_to_file_kwargs(tmpdir, add_kwargs): fs, filename, services = csv_tester.get_services_for_writer(tmpdir) diff --git a/tests/io/test_json.py b/tests/io/test_json.py index 75350ce..1cfa8af 100644 --- a/tests/io/test_json.py +++ b/tests/io/test_json.py @@ -20,9 +20,12 @@ def test_write_json_arg0(tmpdir): assert fp.read() == '[{"foo": "bar"}]' -@pytest.mark.parametrize('add_kwargs', ({}, { - 'ioformat': settings.IOFORMAT_KWARGS, -}, )) +@pytest.mark.parametrize('add_kwargs', ( + {}, + { + 'ioformat': settings.IOFORMAT_KWARGS, + }, +)) def test_write_json_kwargs(tmpdir, add_kwargs): fs, filename, services = json_tester.get_services_for_writer(tmpdir) diff --git a/tests/structs/test_bags.py b/tests/structs/test_bags.py index df9cc3c..d52a6c6 100644 --- a/tests/structs/test_bags.py +++ b/tests/structs/test_bags.py @@ -5,7 +5,10 @@ from bonobo import Bag from bonobo.constants import INHERIT_INPUT from bonobo.structs import Token -args = ('foo', 'bar', ) +args = ( + 'foo', + 'bar', +) kwargs = dict(acme='corp') @@ -38,11 +41,17 @@ def test_inherit(): assert bag.kwargs == {'a': 1} assert bag.flags is () - assert bag2.args == ('a', 'b', ) + assert bag2.args == ( + 'a', + 'b', + ) assert bag2.kwargs == {'a': 1, 'b': 2} assert INHERIT_INPUT in bag2.flags - assert bag3.args == ('a', 'c', ) + assert bag3.args == ( + 'a', + 'c', + ) assert bag3.kwargs == {'a': 1, 'c': 3} assert bag3.flags is () @@ -51,12 +60,19 @@ def test_inherit(): assert bag4.flags is () bag4.set_parent(bag) - assert bag4.args == ('a', 'd', ) + assert bag4.args == ( + 'a', + 'd', + ) assert bag4.kwargs == {'a': 1, 'd': 4} assert bag4.flags is () bag4.set_parent(bag3) - assert bag4.args == ('a', 'c', 'd', ) + assert bag4.args == ( + 'a', + 'c', + 'd', + ) assert bag4.kwargs == {'a': 1, 'c': 3, 'd': 4} assert bag4.flags is () diff --git a/tests/util/test_statistics.py b/tests/util/test_statistics.py index bb787eb..9eae0c0 100644 --- a/tests/util/test_statistics.py +++ b/tests/util/test_statistics.py @@ -3,7 +3,10 @@ from bonobo.util.statistics import WithStatistics class MyThingWithStats(WithStatistics): def get_statistics(self, *args, **kwargs): - return (('foo', 42), ('bar', 69), ) + return ( + ('foo', 42), + ('bar', 69), + ) def test_with_statistics():