diff --git a/ceilometerclient/client.py b/ceilometerclient/client.py index feacf7c6..ff506d75 100644 --- a/ceilometerclient/client.py +++ b/ceilometerclient/client.py @@ -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: diff --git a/ceilometerclient/common/base.py b/ceilometerclient/common/base.py index 5e3fee71..7e8f80f5 100644 --- a/ceilometerclient/common/base.py +++ b/ceilometerclient/common/base.py @@ -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 diff --git a/ceilometerclient/common/utils.py b/ceilometerclient/common/utils.py index bc9507bd..b5bbe791 100644 --- a/ceilometerclient/common/utils.py +++ b/ceilometerclient/common/utils.py @@ -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: diff --git a/ceilometerclient/v2/options.py b/ceilometerclient/v2/options.py index ee85c42a..e20eea70 100644 --- a/ceilometerclient/v2/options.py +++ b/ceilometerclient/v2/options.py @@ -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' % diff --git a/ceilometerclient/v2/shell.py b/ceilometerclient/v2/shell.py index aa6b4b19..c03f02ec 100644 --- a/ceilometerclient/v2/shell.py +++ b/ceilometerclient/v2/shell.py @@ -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 for Event Type - . - ''' + '''List all traits with name for Event Type .''' traits = cc.traits.list(args.event_type, args.trait_name) field_labels = ['Trait Name', 'Value', 'Data Type'] fields = ['name', 'value', 'type'] diff --git a/tox.ini b/tox.ini index 480a6d6e..ed2658f6 100644 --- a/tox.ini +++ b/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