Merge pull request #44 from hartym/code_quality

Code quality
This commit is contained in:
Romain Dorgueil
2017-05-01 02:18:55 -07:00
committed by GitHub
10 changed files with 12 additions and 26 deletions

View File

@ -1,4 +1,4 @@
---
exclude_paths:
- bonobo/examples
- bonobo/ext
- bonobo/examples/
- bonobo/ext/

View File

@ -3,14 +3,12 @@ import os
def execute():
try:
import edgy.project
from edgy.project.__main__ import handle_init
except ImportError as exc:
raise ImportError(
'You must install "edgy.project" to use this command.\n\n $ pip install edgy.project\n'
) from exc
from edgy.project.__main__ import handle_init
return handle_init(os.path.join(os.getcwd(), 'Projectfile'))

View File

@ -20,7 +20,7 @@ def get_default_services(filename, services=None):
}
try:
exec(code, context)
except Exception as exc:
except Exception:
raise
return {
**context[DEFAULT_SERVICES_ATTR](),
@ -55,7 +55,7 @@ def execute(file, quiet=False):
'but it is something that will be implemented in the future.\n\nExpected: 1, got: {}.'
).format(len(graphs))
name, graph = list(graphs.items())[0]
graph = list(graphs.values())[0]
# todo if console and not quiet, then add the console plugin
# todo when better console plugin, add it if console and just disable display

View File

@ -53,4 +53,4 @@ class Configurable(metaclass=ConfigurableMeta):
)
for name, value in kwargs.items():
setattr(self, name, kwargs[name])
setattr(self, name, value)

View File

@ -52,9 +52,9 @@ def contextual(cls_or_func):
setattr(cls_or_func, _CONTEXT_PROCESSORS_ATTR, [])
_processors = getattr(cls_or_func, _CONTEXT_PROCESSORS_ATTR)
for name, value in cls_or_func.__dict__.items():
if isinstance(value, ContextProcessor):
_processors.append(value)
for processor in cls_or_func.__dict__.values():
if isinstance(processor, ContextProcessor):
_processors.append(processor)
# This is needed for python 3.5, python 3.6 should be fine, but it's considered an implementation detail.
_processors.sort(key=lambda proc: proc._creation_counter)

View File

@ -14,10 +14,6 @@ from edgy.project.feature import Feature, SUPPORT_PRIORITY
class BonoboFeature(Feature):
requires = {'python'}
@subscribe('edgy.project.feature.make.on_generate', priority=SUPPORT_PRIORITY)
def on_make_generate(self, event):
makefile = event.makefile
@subscribe('edgy.project.on_start', priority=SUPPORT_PRIORITY)
def on_start(self, event):
package_path = event.setup['name'].replace('.', os.sep)

View File

@ -24,11 +24,3 @@ class JupyterOutputPlugin(Plugin):
finalize = run
"""
TODO JUPYTER WIDGET
###################
# close the widget? what does it do?
https://ipywidgets.readthedocs.io/en/latest/examples/Widget%20Basics.html#Closing-widgets
"""

View File

@ -50,7 +50,7 @@ class CsvReader(CsvHandler, FileReader):
field_count = len(headers.value)
if self.skip and self.skip > 0:
for i in range(0, self.skip):
for _ in range(0, self.skip):
next(reader)
for row in reader:

View File

@ -21,7 +21,7 @@ def test_file_writer_in_context(tmpdir, lines, output):
context.start()
context.recv(BEGIN, *map(Bag, lines), END)
for i in range(len(lines)):
for _ in range(len(lines)):
context.step()
context.stop()

View File

@ -18,7 +18,7 @@ def test_entrypoint():
def test_no_command(capsys):
with pytest.raises(SystemExit):
entrypoint([])
out, err = capsys.readouterr()
_, err = capsys.readouterr()
assert 'error: the following arguments are required: command' in err