Allow all pep8 checks
Fix H405 pep8 issue. H904 issue check was ignored, although there were no places in client code violating this rule. Change-Id: If3b84eb8abb03511d7f77cabfa2955f472a60f23
This commit is contained in:
@@ -223,8 +223,7 @@ def Client(version, *args, **kwargs):
|
||||
|
||||
|
||||
def get_client(version, **kwargs):
|
||||
"""Get an authenticated client, based on the credentials
|
||||
in the keyword args.
|
||||
"""Get an authenticated client, based on the credentials in the kwargs.
|
||||
|
||||
:param api_version: the API version to use ('1' or '2')
|
||||
:param kwargs: keyword args containing credentials, either:
|
||||
|
||||
@@ -31,7 +31,9 @@ except NameError:
|
||||
|
||||
|
||||
def getid(obj):
|
||||
"""Abstracts the common pattern of allowing both an object or an
|
||||
"""Extracts object ID.
|
||||
|
||||
Abstracts the common pattern of allowing both an object or an
|
||||
object's ID (UUID) as a parameter when dealing with relationships.
|
||||
"""
|
||||
try:
|
||||
@@ -41,8 +43,10 @@ def getid(obj):
|
||||
|
||||
|
||||
class Manager(object):
|
||||
"""Managers interact with a particular type of API
|
||||
(samples, meters, alarms, etc.) and provide CRUD operations for them.
|
||||
"""Managers interact with a particular type of API.
|
||||
|
||||
It works with samples, meters, alarms, etc. and provide CRUD operations for
|
||||
them.
|
||||
"""
|
||||
resource_class = None
|
||||
|
||||
@@ -91,8 +95,10 @@ class Manager(object):
|
||||
|
||||
|
||||
class Resource(base.Resource):
|
||||
"""A resource represents a particular instance of an object (tenant, user,
|
||||
etc). This is pretty much just a bag for attributes.
|
||||
"""A resource represents a particular instance of an object.
|
||||
|
||||
Resource might be tenant, user, etc.
|
||||
This is pretty much just a bag for attributes.
|
||||
|
||||
:param manager: Manager object
|
||||
:param info: dictionary representing resource attributes
|
||||
|
||||
@@ -157,8 +157,7 @@ def args_array_to_dict(kwargs, key_to_convert):
|
||||
|
||||
|
||||
def args_array_to_list_of_dicts(kwargs, key_to_convert):
|
||||
"""Converts ['a=1;b=2','c=3;d=4'] to [{a:1,b:2},{c:3,d:4}]
|
||||
"""
|
||||
"""Converts ['a=1;b=2','c=3;d=4'] to [{a:1,b:2},{c:3,d:4}]."""
|
||||
values_to_convert = kwargs.get(key_to_convert)
|
||||
if values_to_convert:
|
||||
try:
|
||||
|
||||
@@ -29,18 +29,19 @@ DATA_TYPE_RE = re.compile(r'^(string|integer|float|datetime|boolean)(::)(.+)$')
|
||||
|
||||
|
||||
def build_url(path, q, params=None):
|
||||
'''This converts from a list of dicts and a list of params to
|
||||
what the rest api needs, so from:
|
||||
"[{field=this,op=le,value=34},
|
||||
{field=that,op=eq,value=foo,type=string}],
|
||||
['foo=bar','sna=fu']"
|
||||
"""Convert list of dicts and a list of params to query url format.
|
||||
|
||||
This will convert the following:
|
||||
"[{field=this,op=le,value=34},
|
||||
{field=that,op=eq,value=foo,type=string}],
|
||||
['foo=bar','sna=fu']"
|
||||
to:
|
||||
"?q.field=this&q.field=that&
|
||||
q.op=le&q.op=eq&
|
||||
q.type=&q.type=string&
|
||||
q.value=34&q.value=foo&
|
||||
foo=bar&sna=fu"
|
||||
'''
|
||||
"?q.field=this&q.field=that&
|
||||
q.op=le&q.op=eq&
|
||||
q.type=&q.type=string&
|
||||
q.value=34&q.value=foo&
|
||||
foo=bar&sna=fu"
|
||||
"""
|
||||
if q:
|
||||
query_params = {'q.field': [],
|
||||
'q.value': [],
|
||||
@@ -67,13 +68,13 @@ def build_url(path, q, params=None):
|
||||
|
||||
|
||||
def cli_to_array(cli_query):
|
||||
"""This converts from the cli list of queries to what is required
|
||||
by the python api.
|
||||
so from:
|
||||
"this<=34;that=string::foo"
|
||||
"""Convert CLI list of queries to the Python API format.
|
||||
|
||||
This will convert the following:
|
||||
"this<=34;that=string::foo"
|
||||
to
|
||||
"[{field=this,op=le,value=34,type=''},
|
||||
{field=that,op=eq,value=foo,type=string}]"
|
||||
"[{field=this,op=le,value=34,type=''},
|
||||
{field=that,op=eq,value=foo,type=string}]"
|
||||
|
||||
"""
|
||||
|
||||
@@ -81,8 +82,7 @@ def cli_to_array(cli_query):
|
||||
return None
|
||||
|
||||
def split_by_op(query):
|
||||
"""Split a single query string to field, operator, value.
|
||||
"""
|
||||
"""Split a single query string to field, operator, value."""
|
||||
|
||||
def _value_error(message):
|
||||
raise ValueError('invalid query %(query)s: missing %(message)s' %
|
||||
|
||||
@@ -786,9 +786,7 @@ def do_trait_description_list(cc, args={}):
|
||||
help='The name of the trait to list.',
|
||||
required=True, action=NotEmptyAction)
|
||||
def do_trait_list(cc, args={}):
|
||||
'''List trait all traits with name <trait_name> for Event Type
|
||||
<event_type>.
|
||||
'''
|
||||
'''List all traits with name <trait_name> for Event Type <event_type>.'''
|
||||
traits = cc.traits.list(args.event_type, args.trait_name)
|
||||
field_labels = ['Trait Name', 'Value', 'Data Type']
|
||||
fields = ['name', 'value', 'type']
|
||||
|
||||
3
tox.ini
3
tox.ini
@@ -29,8 +29,5 @@ commands=
|
||||
python setup.py build_sphinx
|
||||
|
||||
[flake8]
|
||||
# H405 multi line docstring summary not separated with an empty line
|
||||
# H904 Wrap long lines in parentheses instead of a backslash
|
||||
ignore = H405,H904
|
||||
show-source = True
|
||||
exclude = .venv,.git,.tox,dist,doc,*openstack/common*,*lib/python*,*egg,build,tools
|
||||
|
||||
Reference in New Issue
Block a user