Merge remote-tracking branch 'upstream/develop' into develop

This commit is contained in:
Romain Dorgueil
2018-10-29 07:23:58 +01:00
34 changed files with 231 additions and 208 deletions

File diff suppressed because one or more lines are too long

View File

@ -6,7 +6,6 @@ All objects in this module are considered very safe to use, and backward compati
to another is maximal.
"""
from bonobo.execution.strategies import create_strategy
from bonobo.nodes import *
from bonobo.nodes import __all__ as _all_nodes
@ -187,7 +186,7 @@ def get_examples_path(*pathsegments):
import os
import pathlib
return str(pathlib.Path(os.path.dirname(__file__), 'examples', *pathsegments))
return str(pathlib.Path(os.path.dirname(__file__), "examples", *pathsegments))
@api.register
@ -196,3 +195,4 @@ def open_examples_fs(*pathsegments):
api.register_group(get_argument_parser, parse_args)

View File

@ -1 +1 @@
__version__ = '0.6.3'
__version__ = "0.6.3"

1
bonobo/bonobo.svg Normal file

File diff suppressed because one or more lines are too long

After

Width:  |  Height:  |  Size: 5.4 KiB

View File

@ -4,10 +4,11 @@ import runpy
import sys
from contextlib import contextmanager
from mondrian import humanizer
import bonobo.util.environ
from bonobo.util import get_name
from bonobo.util.environ import get_argument_parser, parse_args
from mondrian import humanizer
class BaseCommand:

View File

@ -1,8 +1,9 @@
from mondrian import humanizer
import bonobo
from bonobo.commands import BaseCommand
from bonobo.registry import READER, WRITER, default_registry
from bonobo.util.resolvers import _resolve_options, _resolve_transformations
from mondrian import humanizer
class ConvertCommand(BaseCommand):

View File

@ -1,9 +1,9 @@
import os
from jinja2 import Environment, FileSystemLoader
from mondrian import humanizer
from bonobo.commands import BaseCommand
from mondrian import humanizer
class InitCommand(BaseCommand):
@ -31,16 +31,12 @@ class InitCommand(BaseCommand):
with open(filename, "w+") as f:
f.write(template.render(name=name))
print(
humanizer.Success(
"Generated {} using template {!r}.".format(filename, template_name)
)
)
print(humanizer.Success("Generated {} using template {!r}.".format(filename, template_name)))
def create_package(self, *, filename):
_, ext = os.path.splitext(filename)
if ext != '':
raise ValueError('Package names should not have an extension.')
if ext != "":
raise ValueError("Package names should not have an extension.")
try:
import medikit.commands
@ -60,16 +56,16 @@ class InitCommand(BaseCommand):
print(
humanizer.Success(
'Package "{}" has been created.'.format(package_name),
'',
"",
"Install it...",
'',
"",
" $ `pip install --editable {}`".format(filename),
'',
"",
"Then maybe run the example...",
'',
"",
" $ `python -m {}`".format(package_name),
'',
"Enjoy!"
"",
"Enjoy!",
)
)

View File

@ -1,6 +1,7 @@
from bonobo.commands import BaseCommand
from mondrian import humanizer
from bonobo.commands import BaseCommand
def get_versions(*, all=False, quiet=None):
import bonobo

View File

@ -5,7 +5,7 @@ configurable transformations, either class-based or function-based.
"""
from bonobo.config.configurables import Configurable
from bonobo.config.functools import transformation_factory
from bonobo.config.functools import transformation_factory, partial
from bonobo.config.options import Method, Option
from bonobo.config.processors import ContextProcessor, use_context, use_context_processor, use_raw_input, use_no_input
from bonobo.config.services import Container, Exclusive, Service, use, create_container
@ -23,6 +23,7 @@ __all__ = [
"Option",
"Service",
"create_container",
"partial",
"requires",
"transformation_factory",
"use",

View File

@ -1,6 +1,9 @@
import functools
import itertools
from bonobo.config.services import use
from bonobo.util import get_name
def transformation_factory(f):
@functools.wraps(f)
@ -14,3 +17,11 @@ def transformation_factory(f):
_transformation_factory._partial = True
return _transformation_factory
class partial(functools.partial):
@property
def __name__(self):
return get_name(self.func)
def using(self, *service_names):
return use(*service_names)(self)

View File

@ -1,4 +1,4 @@
from collections import Iterable
from collections.abc import Iterable
from contextlib import contextmanager
from functools import partial
from inspect import signature

View File

@ -68,7 +68,7 @@ class Container(dict):
if len(args) == 1:
if len(kwargs):
raise ValueError(
'You can either use {} with one positional argument or with keyword arguments, not both.'.format(
"You can either use {} with one positional argument or with keyword arguments, not both.".format(
cls.__name__
)
)

View File

@ -127,8 +127,7 @@ class CsvWriter(FileWriter, CsvHandler):
)
context.writer(values)
else:
for arg in values:
context.writer(ensure_tuple(arg))
context.writer(ensure_tuple(values))
return NOT_MODIFIED

View File

@ -134,7 +134,7 @@ def BagType(typename, fields, *, verbose=False, module=None):
if type(name) is not str:
raise TypeError("Type names and field names must be strings, got {name!r}".format(name=name))
if not isinstance(name, str):
raise TypeError('Type names and field names must be strings, got {name!r}'.format(name=name))
raise TypeError("Type names and field names must be strings, got {name!r}".format(name=name))
if not i:
if not name.isidentifier():
raise ValueError("Type names must be valid identifiers: {name!r}".format(name=name))

View File

@ -6,7 +6,7 @@ import warnings
from contextlib import contextmanager
__escape_decoder = codecs.getdecoder("unicode_escape")
__posix_variable = re.compile("\$\{[^\}]*\}")
__posix_variable = re.compile(r"\$\{[^\}]*\}")
def parse_var(var):

View File

@ -24,7 +24,7 @@ def sweeten_errors():
length = len(pre_re.sub("\\1\\2\\3", arg))
arg = pre_re.sub(w("\\1") + term.bold("\\2") + w("\\3"), arg)
arg = re.sub("^ \$ (.*)", term.lightblack(" $ ") + term.reset("\\1"), arg)
arg = re.sub(r"^ \$ (.*)", term.lightblack(" $ ") + term.reset("\\1"), arg)
return (arg, length)

View File

@ -1,2 +1,2 @@
CLEAR_EOL = "\033[0K"
MOVE_CURSOR_UP = '\033[{}A'.format
MOVE_CURSOR_UP = "\033[{}A".format