diff --git a/solar/cli/main.py b/solar/cli/main.py index cb6a95a5..6699b949 100644 --- a/solar/cli/main.py +++ b/solar/cli/main.py @@ -21,7 +21,6 @@ import collections import json import click -import collections from fabric import api as fabric_api import networkx as nx diff --git a/solar/cli/orch.py b/solar/cli/orch.py index 66015eb7..39220ed4 100755 --- a/solar/cli/orch.py +++ b/solar/cli/orch.py @@ -18,14 +18,14 @@ import time import click +from solar.cli.uids_history import remember_uid +from solar.cli.uids_history import SOLARUID +from solar import errors from solar.orchestration import filters from solar.orchestration import graph from solar.orchestration import tasks from solar.orchestration.traversal import states from solar.orchestration import utils -from solar.cli.uids_history import remember_uid -from solar.cli.uids_history import SOLARUID -from solar import errors @click.group(name='orch') diff --git a/solar/cli/resource.py b/solar/cli/resource.py index 5b147422..2aed97de 100644 --- a/solar/cli/resource.py +++ b/solar/cli/resource.py @@ -259,5 +259,5 @@ def remove(name, tag, f): if f: msg = 'Resource %s removed from database' % res.name else: - click.echo( - 'Resource %s will be removed after commiting changes.' % res.name) + msg = 'Resource %s will be removed after commiting changes.' % res.name # NOQA + click.echo(msg) diff --git a/solar/cli/system_log.py b/solar/cli/system_log.py index 15447187..a48e3fbb 100644 --- a/solar/cli/system_log.py +++ b/solar/cli/system_log.py @@ -17,13 +17,11 @@ import sys import click from solar.cli.uids_history import remember_uid -from solar.cli.uids_history import SOLARUID from solar.core import resource from solar.core import testing from solar import errors from solar.system_log import change from solar.system_log import data -from solar.system_log import operations @click.group() @@ -73,12 +71,6 @@ def process(): click.echo(uid) -@changes.command() -@click.argument('uid', type=SOLARUID) -def commit(uid): - operations.commit(uid) - - @changes.command() @click.option('-n', default=5, help='number of items to show') @click.option('-d', default=False, is_flag=True, help='detailed view') diff --git a/solar/cli/uids_history.py b/solar/cli/uids_history.py index 4673e1e1..b6217985 100644 --- a/solar/cli/uids_history.py +++ b/solar/cli/uids_history.py @@ -22,8 +22,8 @@ UIDS_HISTORY = os.path.join(os.getcwd(), '.solar_cli_uids') def remember_uid(uid): - """ - Remembers last 3 uids. + """Remembers last 3 uids. + Can be used then as `last`, `last1`, `last2` anywhere """ try: @@ -39,9 +39,7 @@ def remember_uid(uid): def get_uid(given_uid): - """ - Converts given uid to real uid. - """ + """Converts given uid to real uid.""" matched = re.search('last(\d*)', given_uid) if matched: try: @@ -59,8 +57,8 @@ def get_uid(given_uid): class SolarUIDParameterType(click.types.StringParamType): - """ - Type for solar changes uid. + """Type for solar changes uid. + Works like a string but can convert `last(\d+)` to valid uid. """ name = 'uid' @@ -71,7 +69,7 @@ class SolarUIDParameterType(click.types.StringParamType): value = get_uid(value) except IOError: msg = ("Unable to locate file %r so" - "you can't use 'last' shortcuts" % UIDS_HISTORY) + "you can't use 'last' shortcuts" % UIDS_HISTORY) raise click.BadParameter(msg) return value diff --git a/solar/core/log.py b/solar/core/log.py index 20dc2521..c89ec2a9 100644 --- a/solar/core/log.py +++ b/solar/core/log.py @@ -23,7 +23,8 @@ def setup_logger(): handler = logging.FileHandler('solar.log') handler.setLevel(logging.DEBUG) formatter = logging.Formatter( - '%(asctime)s %(levelname)s %(funcName)s (%(filename)s::%(lineno)s)::%(message)s') + '%(asctime)s %(levelname)s %(funcName)s' + ' (%(filename)s::%(lineno)s)::%(message)s') handler.setFormatter(formatter) log.addHandler(handler) diff --git a/solar/core/resource/resource.py b/solar/core/resource/resource.py index 9407f5fe..5f2f8fa1 100644 --- a/solar/core/resource/resource.py +++ b/solar/core/resource/resource.py @@ -216,7 +216,8 @@ class Resource(object): for (emitter_resource, emitter_input), (receiver_resource, receiver_input), meta in self.graph().edges(data=True): # NOQA if meta: receiver_input = '{}:{}|{}'.format(receiver_input, - meta['destination_key'], meta['tag']) + meta['destination_key'], + meta['tag']) rst.add( (emitter_resource, emitter_input, diff --git a/solar/core/resource/virtual_resource.py b/solar/core/resource/virtual_resource.py index 017b773a..ecab8455 100644 --- a/solar/core/resource/virtual_resource.py +++ b/solar/core/resource/virtual_resource.py @@ -113,7 +113,7 @@ def _get_template(name, content, kwargs, inputs): missing.append(input) if missing: raise Exception( - '[{0}] Validation error. Missing data in input: {1}'.format(name, missing)) + '[{0}] Validation error. Missing data in input: {1}'.format(name, missing)) # NOQA template = Template(content, trim_blocks=True, lstrip_blocks=True) template = template.render(str=str, zip=zip, **kwargs) return template diff --git a/solar/core/signals.py b/solar/core/signals.py index 039d4bac..c40c6290 100644 --- a/solar/core/signals.py +++ b/solar/core/signals.py @@ -83,7 +83,8 @@ def location_and_transports(emitter, receiver, orig_mapping): emitter_single_reverse = emitter_single.get('reverse') receiver_single_reverse = receiver_single.get('reverse') if inps_receiver is None and inps_emitter is not None: - # we don't connect automaticaly when receiver is None and emitter is not None + # we don't connect automaticaly when receiver is None and + # emitter is not None # for cases when we connect existing transports to other data # containers if receiver_single_reverse: diff --git a/tox.ini b/tox.ini index 0535ae20..c5a900e7 100644 --- a/tox.ini +++ b/tox.ini @@ -15,7 +15,7 @@ commands = ostestr --serial deps = hacking==0.10.2 usedevelop = False commands = - flake8 {posargs:solar} + flake8 {posargs:solar/cli} [testenv:venv] deps = -r{toxinidir}/requirements.txt