diff --git a/Makefile b/Makefile index f9a4758..2b68f2c 100644 --- a/Makefile +++ b/Makefile @@ -1,4 +1,4 @@ -# Generated by Medikit 0.4.3 on 2018-01-16. +# Generated by Medikit 0.4.7 on 2018-02-03. # All changes will be overriden. PACKAGE ?= bonobo diff --git a/Projectfile b/Projectfile index 61ae5ab..96e3b65 100644 --- a/Projectfile +++ b/Projectfile @@ -70,11 +70,17 @@ python.add_requirements( ], ) + @listen(make.on_generate) def on_make_generate(event): event.makefile['SPHINX_AUTOBUILD'] = '$(PYTHON_DIRNAME)/sphinx-autobuild' - event.makefile.add_target('watch-$(SPHINX_SOURCEDIR)', ''' + event.makefile.add_target( + 'watch-$(SPHINX_SOURCEDIR)', + ''' $(SPHINX_AUTOBUILD) $(SPHINX_SOURCEDIR) $(shell mktemp -d) - ''', phony=True) + ''', + phony=True + ) + # vim: ft=python: diff --git a/bin/update_apidoc.py b/bin/update_apidoc.py index adf5e41..a03dc63 100644 --- a/bin/update_apidoc.py +++ b/bin/update_apidoc.py @@ -40,13 +40,14 @@ modules = [ ] - def underlined_filter(txt, chr): return txt + '\n' + chr * len(txt) -env = Environment(loader=DictLoader({ - 'module': ''' +env = Environment( + loader=DictLoader({ + 'module': + ''' {{ (':mod:`'~title~' <'~name~'>`') | underlined('=') }} .. currentmodule:: {{ name }} @@ -55,7 +56,9 @@ env = Environment(loader=DictLoader({ .. automodule:: {{ name }} {% for opt in automodule_options %} :{{ opt }}:{{ "\n" }}{% endfor %} - '''[1:-1] + '\n'})) + ''' [1:-1] + '\n' + }) +) env.filters['underlined'] = underlined_filter for module in modules: diff --git a/bonobo/config/configurables.py b/bonobo/config/configurables.py index e9cd202..50f41fc 100644 --- a/bonobo/config/configurables.py +++ b/bonobo/config/configurables.py @@ -47,15 +47,7 @@ class ConfigurableMeta(type): prefix = ':param {}: '.format(_param) for lineno, line in enumerate((_value.__doc__ or '').split('\n')): _options_doc.append((' ' * len(prefix) if lineno else prefix) + line) - cls.__doc__ = '\n\n'.join( - map( - str.strip, - filter(None, ( - cls.__doc__, - '\n'.join(_options_doc) - )) - ) - ) + cls.__doc__ = '\n\n'.join(map(str.strip, filter(None, (cls.__doc__, '\n'.join(_options_doc))))) @property def __options__(cls): diff --git a/bonobo/contrib/django/commands.py b/bonobo/contrib/django/commands.py index c0d744c..eda6141 100644 --- a/bonobo/contrib/django/commands.py +++ b/bonobo/contrib/django/commands.py @@ -56,7 +56,7 @@ class ETLCommand(BaseCommand): graph_coll = self.get_graph(*args, **options) if not isinstance(graph_coll, GeneratorType): - graph_coll = (graph_coll,) + graph_coll = (graph_coll, ) for i, graph in enumerate(graph_coll): assert isinstance(graph, bonobo.Graph), 'Invalid graph provided.' diff --git a/bonobo/nodes/io/base.py b/bonobo/nodes/io/base.py index 037992f..d2cca60 100644 --- a/bonobo/nodes/io/base.py +++ b/bonobo/nodes/io/base.py @@ -12,9 +12,11 @@ class FileHandler(Configurable): encoding (str): which encoding to use when opening the file. """ - path = Option(str, required=True, positional=True, __doc__=''' + path = Option( + str, required=True, positional=True, __doc__=''' Path to use within the provided filesystem. - ''') # type: str + ''' + ) # type: str eol = Option(str, default='\n', __doc__=''' Character to use as line separator. ''') # type: str diff --git a/bonobo/nodes/io/csv.py b/bonobo/nodes/io/csv.py index 34db6cc..d7d03fb 100644 --- a/bonobo/nodes/io/csv.py +++ b/bonobo/nodes/io/csv.py @@ -33,7 +33,7 @@ class CsvHandler(FileHandler): doublequote = Option(str, default=csv.excel.doublequote, required=False) skipinitialspace = Option(str, default=csv.excel.skipinitialspace, required=False) lineterminator = Option(str, default=csv.excel.lineterminator, required=False) - quoting = Option(str, default=csv.excel.quoting, required=False) + quoting = Option(int, default=csv.excel.quoting, required=False) # Fields (renamed from headers) headers = RenamedOption('fields') @@ -57,9 +57,13 @@ class CsvReader(FileReader, CsvHandler): Reads a CSV and yield the values as dicts. """ - skip = Option(int, default=0, __doc__=''' + skip = Option( + int, + default=0, + __doc__=''' If set and greater than zero, the reader will skip this amount of lines. - ''') + ''' + ) @Method( positional=False, diff --git a/bonobo/structs/graphs.py b/bonobo/structs/graphs.py index a18fc45..292d7b2 100644 --- a/bonobo/structs/graphs.py +++ b/bonobo/structs/graphs.py @@ -151,7 +151,10 @@ class Graph: return '{}: {}'.format(type(exc).__name__, str(exc)) def _resolve_index(self, mixed): - """ Find the index based on various strategies for a node, probably an input or output of chain. Supported inputs are indexes, node values or names. + """ + Find the index based on various strategies for a node, probably an input or output of chain. Supported + inputs are indexes, node values or names. + """ if mixed is None: return None diff --git a/bonobo/util/api.py b/bonobo/util/api.py index 1561207..7bfba02 100644 --- a/bonobo/util/api.py +++ b/bonobo/util/api.py @@ -14,8 +14,8 @@ class ApiHelper: from inspect import signature parameters = list(signature(x).parameters) required_parameters = {'plugins', 'services', 'strategy'} - assert len(parameters) > 0 and parameters[ - 0] == 'graph', 'First parameter of a graph api function must be "graph".' + assert len(parameters + ) > 0 and parameters[0] == 'graph', 'First parameter of a graph api function must be "graph".' assert required_parameters.intersection( parameters ) == required_parameters, 'Graph api functions must define the following parameters: ' + ', '.join( diff --git a/bonobo/util/collections.py b/bonobo/util/collections.py index de706f4..3e46738 100644 --- a/bonobo/util/collections.py +++ b/bonobo/util/collections.py @@ -26,7 +26,7 @@ def ensure_tuple(tuple_or_mixed, *, cls=tuple): if isinstance(tuple_or_mixed, tuple): return tuple.__new__(cls, tuple_or_mixed) - return tuple.__new__(cls, (tuple_or_mixed,)) + return tuple.__new__(cls, (tuple_or_mixed, )) def cast(type_): diff --git a/docs/conf.py b/docs/conf.py index 355804e..877ebd7 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -61,10 +61,13 @@ language = None # This patterns also effect to html_static_path and html_extra_path exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store'] - autoclass_content = 'both' autodoc_member_order = 'groupwise' -autodoc_default_flags =['members', 'undoc-members', 'show-inheritance', ] +autodoc_default_flags = [ + 'members', + 'undoc-members', + 'show-inheritance', +] add_module_names = False pygments_style = 'sphinx' diff --git a/requirements-dev.txt b/requirements-dev.txt index d5a3662..ab71e69 100644 --- a/requirements-dev.txt +++ b/requirements-dev.txt @@ -1,10 +1,10 @@ -e .[dev] alabaster==0.7.10 -arrow==0.12.0 +arrow==0.12.1 attrs==17.4.0 babel==2.5.3 binaryornot==0.4.4 -certifi==2017.11.5 +certifi==2018.1.18 chardet==3.0.4 click==6.7 cookiecutter==1.5.1 @@ -23,7 +23,7 @@ pygments==2.2.0 pytest-cov==2.5.1 pytest-sugar==0.8.0 pytest-timeout==1.2.1 -pytest==3.3.2 +pytest==3.4.0 python-dateutil==2.6.1 pytz==2017.3 requests==2.18.4 diff --git a/requirements-docker.txt b/requirements-docker.txt index 9bf4324..e685085 100644 --- a/requirements-docker.txt +++ b/requirements-docker.txt @@ -1,12 +1,12 @@ -e .[docker] appdirs==1.4.3 bonobo-docker==0.6.0 -certifi==2017.11.5 +certifi==2018.1.18 chardet==3.0.4 colorama==0.3.9 docker-pycreds==0.2.1 docker==2.7.0 -fs==2.0.17 +fs==2.0.18 graphviz==0.8.2 idna==2.6 jinja2==2.10 diff --git a/requirements-jupyter.txt b/requirements-jupyter.txt index 8df50eb..fa0f4c4 100644 --- a/requirements-jupyter.txt +++ b/requirements-jupyter.txt @@ -4,14 +4,14 @@ bleach==2.1.2 decorator==4.2.1 entrypoints==0.2.3 html5lib==1.0.1 -ipykernel==4.7.0 +ipykernel==4.8.0 ipython-genutils==0.2.0 ipython==6.2.1 ipywidgets==6.0.1 jedi==0.11.1 jinja2==2.10 jsonschema==2.6.0 -jupyter-client==5.2.1 +jupyter-client==5.2.2 jupyter-console==5.2.0 jupyter-core==4.4.0 jupyter==1.0.0 @@ -19,7 +19,7 @@ markupsafe==1.0 mistune==0.8.3 nbconvert==5.3.1 nbformat==4.4.0 -notebook==5.2.2 +notebook==5.4.0 pandocfilters==1.4.2 parso==0.1.1 pexpect==4.3.1 @@ -28,8 +28,9 @@ prompt-toolkit==1.0.15 ptyprocess==0.5.2 pygments==2.2.0 python-dateutil==2.6.1 -pyzmq==16.0.3 +pyzmq==16.0.4 qtconsole==4.3.1 +send2trash==1.4.2 simplegeneric==0.8.1 six==1.11.0 terminado==0.8.1 diff --git a/requirements-sqlalchemy.txt b/requirements-sqlalchemy.txt index 6bf275a..21287e7 100644 --- a/requirements-sqlalchemy.txt +++ b/requirements-sqlalchemy.txt @@ -1,10 +1,10 @@ -e .[sqlalchemy] appdirs==1.4.3 bonobo-sqlalchemy==0.6.0 -certifi==2017.11.5 +certifi==2018.1.18 chardet==3.0.4 colorama==0.3.9 -fs==2.0.17 +fs==2.0.18 graphviz==0.8.2 idna==2.6 jinja2==2.10 @@ -18,7 +18,7 @@ python-slugify==1.2.4 pytz==2017.3 requests==2.18.4 six==1.11.0 -sqlalchemy==1.2.1 +sqlalchemy==1.2.2 stevedore==1.28.0 unidecode==1.0.22 urllib3==1.22 diff --git a/requirements.txt b/requirements.txt index 57e16eb..15c7fcf 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,9 +1,9 @@ -e . appdirs==1.4.3 -certifi==2017.11.5 +certifi==2018.1.18 chardet==3.0.4 colorama==0.3.9 -fs==2.0.17 +fs==2.0.18 graphviz==0.8.2 idna==2.6 jinja2==2.10 diff --git a/tests/config/test_configurables.py b/tests/config/test_configurables.py index 29ff2b8..bee501e 100644 --- a/tests/config/test_configurables.py +++ b/tests/config/test_configurables.py @@ -1,5 +1,3 @@ -import pprint - import pytest from bonobo.config.configurables import Configurable diff --git a/tests/nodes/io/test_csv.py b/tests/nodes/io/test_csv.py index 491c6b9..f862ca7 100644 --- a/tests/nodes/io/test_csv.py +++ b/tests/nodes/io/test_csv.py @@ -1,11 +1,13 @@ from collections import namedtuple +from csv import QUOTE_ALL from unittest import TestCase import pytest from bonobo import CsvReader, CsvWriter from bonobo.constants import EMPTY -from bonobo.util.testing import FilesystemTester, BufferingNodeExecutionContext, WriterTest, ConfigurableNodeTest, ReaderTest +from bonobo.util.testing import FilesystemTester, BufferingNodeExecutionContext, WriterTest, ConfigurableNodeTest, \ + ReaderTest csv_tester = FilesystemTester('csv') csv_tester.input_data = 'a,b,c\na foo,b foo,c foo\na bar,b bar,c bar' @@ -90,6 +92,13 @@ class CsvReaderTest(Csv, ReaderTest, TestCase): self.check_output(context) assert context.get_output_fields() == ('x', 'y') + @incontext(quoting=QUOTE_ALL) + def test_quoting(self, context): + context.write_sync(EMPTY) + context.stop() + self.check_output(context) + assert context.get_output_fields() == ('id', 'name') + class CsvWriterTest(Csv, WriterTest, TestCase): @incontext() diff --git a/tests/util/test_collections.py b/tests/util/test_collections.py index f502afd..bdc6ec1 100644 --- a/tests/util/test_collections.py +++ b/tests/util/test_collections.py @@ -14,8 +14,8 @@ def test_sortedlist(): def test_ensure_tuple(): - assert ensure_tuple('a') == ('a',) - assert ensure_tuple(('a',)) == ('a',) + assert ensure_tuple('a') == ('a', ) + assert ensure_tuple(('a', )) == ('a', ) assert ensure_tuple(()) is ()