diff options
author | Jenkins <jenkins@review.openstack.org> | 2015-01-20 11:37:38 +0000 |
---|---|---|
committer | Gerrit Code Review <review@openstack.org> | 2015-01-20 11:37:38 +0000 |
commit | 7f27b6b285334b89abdccdb8d22677a9ecdc2a43 (patch) | |
tree | 6275c549a9d51c411b389385f4d8ea021174215a | |
parent | e9b8bc6a3f1a4dd94c363ba713a6cb0e15e59ac3 (diff) | |
parent | 00f9e3f3a032caef21be6e4d50749e3ab403ba56 (diff) | |
download | python-ceilometerclient-7f27b6b285334b89abdccdb8d22677a9ecdc2a43.tar.gz |
Merge "Allow all pep8 checks"
-rw-r--r-- | ceilometerclient/client.py | 3 | ||||
-rw-r--r-- | ceilometerclient/common/base.py | 16 | ||||
-rw-r--r-- | ceilometerclient/common/utils.py | 3 | ||||
-rw-r--r-- | ceilometerclient/v2/options.py | 38 | ||||
-rw-r--r-- | ceilometerclient/v2/shell.py | 4 | ||||
-rw-r--r-- | tox.ini | 3 |
6 files changed, 33 insertions, 34 deletions
diff --git a/ceilometerclient/client.py b/ceilometerclient/client.py index 9ee3742..c0a8be5 100644 --- a/ceilometerclient/client.py +++ b/ceilometerclient/client.py @@ -245,8 +245,7 @@ def _adjust_params(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 5e3fee7..7e8f80f 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 bc9507b..b5bbe79 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 e16013c..bf80ce5 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 290867e..b5f4655 100644 --- a/ceilometerclient/v2/shell.py +++ b/ceilometerclient/v2/shell.py @@ -787,9 +787,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'] @@ -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 |