[pm] Moving project artifact management to next edgy.project version.
This commit is contained in:
@ -6,6 +6,7 @@ from bonobo.util.objects import get_name
|
||||
|
||||
__all__ = []
|
||||
|
||||
|
||||
def register_api(x, __all__=__all__):
|
||||
__all__.append(get_name(x))
|
||||
return x
|
||||
|
||||
@ -9,7 +9,9 @@ def execute(name):
|
||||
'You must install "cookiecutter" to use this command.\n\n $ pip install edgy.project\n'
|
||||
) from exc
|
||||
|
||||
return cookiecutter('https://github.com/python-bonobo/cookiecutter-bonobo.git', extra_context={'name': name}, no_input=True)
|
||||
return cookiecutter(
|
||||
'https://github.com/python-bonobo/cookiecutter-bonobo.git', extra_context={'name': name}, no_input=True
|
||||
)
|
||||
|
||||
|
||||
def register(parser):
|
||||
|
||||
@ -4,9 +4,7 @@ from bonobo.util.pkgs import bonobo_packages
|
||||
|
||||
def format_version(mod, *, name=None, quiet=False):
|
||||
return ('{name} {version}' if quiet else '{name} v.{version} (in {location})').format(
|
||||
name=name or mod.__name__,
|
||||
version=mod.__version__,
|
||||
location=bonobo_packages[name or mod.__name__].location
|
||||
name=name or mod.__name__, version=mod.__version__, location=bonobo_packages[name or mod.__name__].location
|
||||
)
|
||||
|
||||
|
||||
|
||||
@ -6,7 +6,9 @@ import os
|
||||
def cleanse_sms(row):
|
||||
|
||||
if row['category'] == 'spam':
|
||||
row['sms_clean'] = '**MARKED AS SPAM** ' + row['sms'][0:50] + ('...' if len(row['sms']) > 50 else '')
|
||||
row['sms_clean'] = '**MARKED AS SPAM** ' + row['sms'][0:50] + (
|
||||
'...' if len(row['sms']) > 50 else ''
|
||||
)
|
||||
else:
|
||||
row['sms_clean'] = row['sms']
|
||||
|
||||
@ -14,14 +16,13 @@ def cleanse_sms(row):
|
||||
|
||||
|
||||
graph = bonobo.Graph(
|
||||
bonobo.PickleReader('spam.pkl'), # spam.pkl is within the gzipped tarball
|
||||
bonobo.PickleReader('spam.pkl'
|
||||
), # spam.pkl is within the gzipped tarball
|
||||
cleanse_sms,
|
||||
print
|
||||
)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
|
||||
'''
|
||||
This example shows how a different file system service can be injected
|
||||
into a transformation (as compressing pickled objects often makes sense
|
||||
@ -51,8 +52,10 @@ if __name__ == '__main__':
|
||||
'''
|
||||
|
||||
services = {
|
||||
'fs': TarFS(
|
||||
os.path.join(bonobo.get_examples_path(), 'datasets', 'spam.tgz')
|
||||
'fs':
|
||||
TarFS(
|
||||
os.path.
|
||||
join(bonobo.get_examples_path(), 'datasets', 'spam.tgz')
|
||||
)
|
||||
}
|
||||
bonobo.run(graph, services=services)
|
||||
|
||||
@ -1,7 +1,6 @@
|
||||
import bonobo
|
||||
import time
|
||||
|
||||
|
||||
from bonobo.constants import NOT_MODIFIED
|
||||
|
||||
|
||||
|
||||
@ -90,7 +90,8 @@ class ConsoleOutputPlugin(Plugin):
|
||||
' `-> ', ' '.join('{}{}{}: {}'.format(Style.BRIGHT, k, Style.RESET_ALL, v)
|
||||
for k, v in append), CLEAR_EOL
|
||||
)
|
||||
), file=sys.stderr
|
||||
),
|
||||
file=sys.stderr
|
||||
)
|
||||
t_cnt += 1
|
||||
|
||||
@ -116,4 +117,4 @@ class ConsoleOutputPlugin(Plugin):
|
||||
def memory_usage():
|
||||
import os, psutil
|
||||
process = psutil.Process(os.getpid())
|
||||
return process.memory_info()[0] / float(2 ** 20)
|
||||
return process.memory_info()[0] / float(2**20)
|
||||
|
||||
@ -82,7 +82,9 @@ class PrettyPrinter(Configurable):
|
||||
return ' '.join(((' ' if i else '-'), str(item), ':', str(value).strip()))
|
||||
|
||||
def _format_console(self, i, item, value):
|
||||
return ' '.join(((' ' if i else '•'), str(item), '=', str(value).strip().replace('\n', '\n' + CLEAR_EOL), CLEAR_EOL))
|
||||
return ' '.join(
|
||||
((' ' if i else '•'), str(item), '=', str(value).strip().replace('\n', '\n' + CLEAR_EOL), CLEAR_EOL)
|
||||
)
|
||||
|
||||
|
||||
pprint = PrettyPrinter()
|
||||
|
||||
Reference in New Issue
Block a user