Fix typos in docstrings and comments
Update a comment to be more meaningful Change-Id: Ie1aa46917c1a253db92a0dc819803a1d3e795b07
This commit is contained in:
parent
09e9272c59
commit
9faa9d47aa
glanceclient
@ -51,7 +51,7 @@ REQUIRED_FIELDS_ON_DATA = ('disk_format', 'container_format')
|
|||||||
# Decorator for cli-args
|
# Decorator for cli-args
|
||||||
def arg(*args, **kwargs):
|
def arg(*args, **kwargs):
|
||||||
def _decorator(func):
|
def _decorator(func):
|
||||||
# Because of the sematics of decorator composition if we just append
|
# Because of the semantics of decorator composition if we just append
|
||||||
# to the options list positional options will appear to be backwards.
|
# to the options list positional options will appear to be backwards.
|
||||||
func.__dict__.setdefault('arguments', []).insert(0, (args, kwargs))
|
func.__dict__.setdefault('arguments', []).insert(0, (args, kwargs))
|
||||||
return func
|
return func
|
||||||
@ -133,7 +133,7 @@ def schema_args(schema_getter, omit=None):
|
|||||||
if isinstance(type_str, list):
|
if isinstance(type_str, list):
|
||||||
# NOTE(flaper87): This means the server has
|
# NOTE(flaper87): This means the server has
|
||||||
# returned something like `['null', 'string']`,
|
# returned something like `['null', 'string']`,
|
||||||
# therfore we use the first non-`null` type as
|
# therefore we use the first non-`null` type as
|
||||||
# the valid type.
|
# the valid type.
|
||||||
for t in type_str:
|
for t in type_str:
|
||||||
if t != 'null':
|
if t != 'null':
|
||||||
@ -159,7 +159,7 @@ def schema_args(schema_getter, omit=None):
|
|||||||
|
|
||||||
# NOTE(flaper87): Make sure all values are `str/unicode`
|
# NOTE(flaper87): Make sure all values are `str/unicode`
|
||||||
# for the `join` to succeed. Enum types can also be `None`
|
# for the `join` to succeed. Enum types can also be `None`
|
||||||
# therfore, join's call would fail without the following
|
# therefore, join's call would fail without the following
|
||||||
# list comprehension
|
# list comprehension
|
||||||
vals = [six.text_type(val) for val in property.get('enum')]
|
vals = [six.text_type(val) for val in property.get('enum')]
|
||||||
description += ('Valid values: ' + ', '.join(vals))
|
description += ('Valid values: ' + ', '.join(vals))
|
||||||
|
@ -214,7 +214,8 @@ class OpenStackImagesShell(object):
|
|||||||
|
|
||||||
def _find_actions(self, subparsers, actions_module):
|
def _find_actions(self, subparsers, actions_module):
|
||||||
for attr in (a for a in dir(actions_module) if a.startswith('do_')):
|
for attr in (a for a in dir(actions_module) if a.startswith('do_')):
|
||||||
# I prefer to be hypen-separated instead of underscores.
|
# Replace underscores with hyphens in the commands
|
||||||
|
# displayed to the user
|
||||||
command = attr[3:].replace('_', '-')
|
command = attr[3:].replace('_', '-')
|
||||||
callback = getattr(actions_module, attr)
|
callback = getattr(actions_module, attr)
|
||||||
desc = callback.__doc__ or ''
|
desc = callback.__doc__ or ''
|
||||||
@ -457,7 +458,7 @@ class OpenStackImagesShell(object):
|
|||||||
except OSError as e:
|
except OSError as e:
|
||||||
# This avoids glanceclient to crash if it can't write to
|
# This avoids glanceclient to crash if it can't write to
|
||||||
# ~/.glanceclient, which may happen on some env (for me,
|
# ~/.glanceclient, which may happen on some env (for me,
|
||||||
# it happens in Jenkins, as Glanceclient can't write to
|
# it happens in Jenkins, as glanceclient can't write to
|
||||||
# /var/lib/jenkins).
|
# /var/lib/jenkins).
|
||||||
msg = '%s' % e
|
msg = '%s' % e
|
||||||
print(encodeutils.safe_decode(msg), file=sys.stderr)
|
print(encodeutils.safe_decode(msg), file=sys.stderr)
|
||||||
@ -519,7 +520,7 @@ class OpenStackImagesShell(object):
|
|||||||
endpoint = self._get_image_url(options)
|
endpoint = self._get_image_url(options)
|
||||||
endpoint, url_version = utils.strip_version(endpoint)
|
endpoint, url_version = utils.strip_version(endpoint)
|
||||||
except ValueError:
|
except ValueError:
|
||||||
# NOTE(flaper87): ValueError is raised if no endpoint is povided
|
# NOTE(flaper87): ValueError is raised if no endpoint is provided
|
||||||
url_version = None
|
url_version = None
|
||||||
|
|
||||||
# build available subcommands based on version
|
# build available subcommands based on version
|
||||||
|
@ -253,7 +253,7 @@ class Controller(object):
|
|||||||
|
|
||||||
:param image_id: ID of the image to modify.
|
:param image_id: ID of the image to modify.
|
||||||
:param remove_props: List of property names to remove
|
:param remove_props: List of property names to remove
|
||||||
:param \*\*kwargs: Image attribute names and their new values.
|
:param kwargs: Image attribute names and their new values.
|
||||||
"""
|
"""
|
||||||
unvalidated_image = self.get(image_id)
|
unvalidated_image = self.get(image_id)
|
||||||
image = self.model(**unvalidated_image)
|
image = self.model(**unvalidated_image)
|
||||||
|
@ -202,7 +202,7 @@ class ResourceTypeController(object):
|
|||||||
return self.model(**body)
|
return self.model(**body)
|
||||||
|
|
||||||
def deassociate(self, namespace, resource):
|
def deassociate(self, namespace, resource):
|
||||||
"""Deasociate a resource type with a namespace."""
|
"""Deassociate a resource type with a namespace."""
|
||||||
url = '/v2/metadefs/namespaces/{0}/resource_types/{1}'. \
|
url = '/v2/metadefs/namespaces/{0}/resource_types/{1}'. \
|
||||||
format(namespace, resource)
|
format(namespace, resource)
|
||||||
self.http_client.delete(url)
|
self.http_client.delete(url)
|
||||||
@ -337,7 +337,7 @@ class ObjectController(object):
|
|||||||
"""Update an object.
|
"""Update an object.
|
||||||
|
|
||||||
:param namespace: Name of a namespace the object belongs.
|
:param namespace: Name of a namespace the object belongs.
|
||||||
:param prop_name: Name of an object (old one).
|
:param object_name: Name of an object (old one).
|
||||||
:param kwargs: Unpacked object.
|
:param kwargs: Unpacked object.
|
||||||
"""
|
"""
|
||||||
obj = self.get(namespace, object_name)
|
obj = self.get(namespace, object_name)
|
||||||
@ -441,7 +441,7 @@ class TagController(object):
|
|||||||
"""Update a tag.
|
"""Update a tag.
|
||||||
|
|
||||||
:param namespace: Name of a namespace the Tag belongs.
|
:param namespace: Name of a namespace the Tag belongs.
|
||||||
:param prop_name: Name of the Tag (old one).
|
:param tag_name: Name of the Tag (old one).
|
||||||
:param kwargs: Unpacked tag.
|
:param kwargs: Unpacked tag.
|
||||||
"""
|
"""
|
||||||
tag = self.get(namespace, tag_name)
|
tag = self.get(namespace, tag_name)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user