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):
|
def get_client(version, **kwargs):
|
||||||
"""Get an authenticated client, based on the credentials
|
"""Get an authenticated client, based on the credentials in the kwargs.
|
||||||
in the keyword args.
|
|
||||||
|
|
||||||
:param api_version: the API version to use ('1' or '2')
|
:param api_version: the API version to use ('1' or '2')
|
||||||
:param kwargs: keyword args containing credentials, either:
|
:param kwargs: keyword args containing credentials, either:
|
||||||
|
|||||||
@@ -31,7 +31,9 @@ except NameError:
|
|||||||
|
|
||||||
|
|
||||||
def getid(obj):
|
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.
|
object's ID (UUID) as a parameter when dealing with relationships.
|
||||||
"""
|
"""
|
||||||
try:
|
try:
|
||||||
@@ -41,8 +43,10 @@ def getid(obj):
|
|||||||
|
|
||||||
|
|
||||||
class Manager(object):
|
class Manager(object):
|
||||||
"""Managers interact with a particular type of API
|
"""Managers interact with a particular type of API.
|
||||||
(samples, meters, alarms, etc.) and provide CRUD operations for them.
|
|
||||||
|
It works with samples, meters, alarms, etc. and provide CRUD operations for
|
||||||
|
them.
|
||||||
"""
|
"""
|
||||||
resource_class = None
|
resource_class = None
|
||||||
|
|
||||||
@@ -91,8 +95,10 @@ class Manager(object):
|
|||||||
|
|
||||||
|
|
||||||
class Resource(base.Resource):
|
class Resource(base.Resource):
|
||||||
"""A resource represents a particular instance of an object (tenant, user,
|
"""A resource represents a particular instance of an object.
|
||||||
etc). This is pretty much just a bag for attributes.
|
|
||||||
|
Resource might be tenant, user, etc.
|
||||||
|
This is pretty much just a bag for attributes.
|
||||||
|
|
||||||
:param manager: Manager object
|
:param manager: Manager object
|
||||||
:param info: dictionary representing resource attributes
|
: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):
|
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)
|
values_to_convert = kwargs.get(key_to_convert)
|
||||||
if values_to_convert:
|
if values_to_convert:
|
||||||
try:
|
try:
|
||||||
|
|||||||
@@ -29,18 +29,19 @@ DATA_TYPE_RE = re.compile(r'^(string|integer|float|datetime|boolean)(::)(.+)$')
|
|||||||
|
|
||||||
|
|
||||||
def build_url(path, q, params=None):
|
def build_url(path, q, params=None):
|
||||||
'''This converts from a list of dicts and a list of params to
|
"""Convert list of dicts and a list of params to query url format.
|
||||||
what the rest api needs, so from:
|
|
||||||
"[{field=this,op=le,value=34},
|
This will convert the following:
|
||||||
{field=that,op=eq,value=foo,type=string}],
|
"[{field=this,op=le,value=34},
|
||||||
['foo=bar','sna=fu']"
|
{field=that,op=eq,value=foo,type=string}],
|
||||||
|
['foo=bar','sna=fu']"
|
||||||
to:
|
to:
|
||||||
"?q.field=this&q.field=that&
|
"?q.field=this&q.field=that&
|
||||||
q.op=le&q.op=eq&
|
q.op=le&q.op=eq&
|
||||||
q.type=&q.type=string&
|
q.type=&q.type=string&
|
||||||
q.value=34&q.value=foo&
|
q.value=34&q.value=foo&
|
||||||
foo=bar&sna=fu"
|
foo=bar&sna=fu"
|
||||||
'''
|
"""
|
||||||
if q:
|
if q:
|
||||||
query_params = {'q.field': [],
|
query_params = {'q.field': [],
|
||||||
'q.value': [],
|
'q.value': [],
|
||||||
@@ -67,13 +68,13 @@ def build_url(path, q, params=None):
|
|||||||
|
|
||||||
|
|
||||||
def cli_to_array(cli_query):
|
def cli_to_array(cli_query):
|
||||||
"""This converts from the cli list of queries to what is required
|
"""Convert CLI list of queries to the Python API format.
|
||||||
by the python api.
|
|
||||||
so from:
|
This will convert the following:
|
||||||
"this<=34;that=string::foo"
|
"this<=34;that=string::foo"
|
||||||
to
|
to
|
||||||
"[{field=this,op=le,value=34,type=''},
|
"[{field=this,op=le,value=34,type=''},
|
||||||
{field=that,op=eq,value=foo,type=string}]"
|
{field=that,op=eq,value=foo,type=string}]"
|
||||||
|
|
||||||
"""
|
"""
|
||||||
|
|
||||||
@@ -81,8 +82,7 @@ def cli_to_array(cli_query):
|
|||||||
return None
|
return None
|
||||||
|
|
||||||
def split_by_op(query):
|
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):
|
def _value_error(message):
|
||||||
raise ValueError('invalid query %(query)s: missing %(message)s' %
|
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.',
|
help='The name of the trait to list.',
|
||||||
required=True, action=NotEmptyAction)
|
required=True, action=NotEmptyAction)
|
||||||
def do_trait_list(cc, args={}):
|
def do_trait_list(cc, args={}):
|
||||||
'''List trait all traits with name <trait_name> for Event Type
|
'''List all traits with name <trait_name> for Event Type <event_type>.'''
|
||||||
<event_type>.
|
|
||||||
'''
|
|
||||||
traits = cc.traits.list(args.event_type, args.trait_name)
|
traits = cc.traits.list(args.event_type, args.trait_name)
|
||||||
field_labels = ['Trait Name', 'Value', 'Data Type']
|
field_labels = ['Trait Name', 'Value', 'Data Type']
|
||||||
fields = ['name', 'value', 'type']
|
fields = ['name', 'value', 'type']
|
||||||
|
|||||||
3
tox.ini
3
tox.ini
@@ -29,8 +29,5 @@ commands=
|
|||||||
python setup.py build_sphinx
|
python setup.py build_sphinx
|
||||||
|
|
||||||
[flake8]
|
[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
|
show-source = True
|
||||||
exclude = .venv,.git,.tox,dist,doc,*openstack/common*,*lib/python*,*egg,build,tools
|
exclude = .venv,.git,.tox,dist,doc,*openstack/common*,*lib/python*,*egg,build,tools
|
||||||
|
|||||||
Reference in New Issue
Block a user