Flake8 fixes
This commit is contained in:
parent
2fa8b3c41b
commit
480859c123
@ -21,7 +21,6 @@ import collections
|
||||
import json
|
||||
|
||||
import click
|
||||
import collections
|
||||
from fabric import api as fabric_api
|
||||
import networkx as nx
|
||||
|
||||
|
@ -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')
|
||||
|
@ -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)
|
||||
|
@ -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')
|
||||
|
@ -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
|
||||
|
||||
|
@ -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)
|
||||
|
||||
|
@ -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,
|
||||
|
@ -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
|
||||
|
@ -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:
|
||||
|
Loading…
Reference in New Issue
Block a user