diff --git a/ceilometerclient/common/base.py b/ceilometerclient/common/base.py index ae1ecfcf..337ce601 100644 --- a/ceilometerclient/common/base.py +++ b/ceilometerclient/common/base.py @@ -29,9 +29,8 @@ except NameError: def getid(obj): - """ - Abstracts the common pattern of allowing both an object or an object's ID - (UUID) as a parameter when dealing with relationships. + """Abstracts the common pattern of allowing both an object or an + object's ID (UUID) as a parameter when dealing with relationships. """ try: return obj.id @@ -40,9 +39,8 @@ def getid(obj): class Manager(object): - """ - Managers interact with a particular type of API (servers, flavors, images, - etc.) and provide CRUD operations for them. + """Managers interact with a particular type of API + (samples, meters, alarms, etc.) and provide CRUD operations for them. """ resource_class = None @@ -78,8 +76,7 @@ class Manager(object): class Resource(object): - """ - A resource represents a particular instance of an object (tenant, user, + """A resource represents a particular instance of an object (tenant, user, etc). This is pretty much just a bag for attributes. :param manager: Manager object diff --git a/ceilometerclient/common/http.py b/ceilometerclient/common/http.py index 85b01f9b..a773c415 100644 --- a/ceilometerclient/common/http.py +++ b/ceilometerclient/common/http.py @@ -124,7 +124,7 @@ class HTTPClient(object): return '%s/%s' % (base_url.rstrip('/'), url.lstrip('/')) def _http_request(self, url, method, **kwargs): - """ Send an http request with the specified characteristics. + """Send an http request with the specified characteristics. Wrapper around httplib.HTTP(S)Connection.request to handle tasks such as setting headers and error handling. @@ -224,8 +224,7 @@ class VerifiedHTTPSConnection(httplib.HTTPSConnection): self.insecure = insecure def connect(self): - """ - Connect to a host on a given (SSL) port. + """Connect to a host on a given (SSL) port. If ca_file is pointing somewhere, use it to check Server Certificate. Redefined/copied and extended from httplib.py:1105 (Python 2.6.x). @@ -253,7 +252,7 @@ class VerifiedHTTPSConnection(httplib.HTTPSConnection): @staticmethod def get_system_ca_file(): - """"Return path to system default CA file""" + """Return path to system default CA file.""" # Standard CA file locations for Debian/Ubuntu, RedHat/Fedora, # Suse, FreeBSD/OpenBSD ca_path = ['/etc/ssl/certs/ca-certificates.crt', diff --git a/ceilometerclient/exc.py b/ceilometerclient/exc.py index d3d3cab6..83e182d8 100644 --- a/ceilometerclient/exc.py +++ b/ceilometerclient/exc.py @@ -23,7 +23,7 @@ class BaseException(Exception): class CommandError(BaseException): - """Invalid usage of CLI""" + """Invalid usage of CLI.""" class InvalidEndpoint(BaseException): @@ -35,11 +35,11 @@ class CommunicationError(BaseException): class ClientException(Exception): - """DEPRECATED""" + """DEPRECATED.""" class HTTPException(ClientException): - """Base exception for all HTTP-derived exceptions""" + """Base exception for all HTTP-derived exceptions.""" code = 'N/A' def __init__(self, details=None): @@ -60,7 +60,7 @@ class HTTPMultipleChoices(HTTPException): class BadRequest(HTTPException): - """DEPRECATED""" + """DEPRECATED.""" code = 400 @@ -69,7 +69,7 @@ class HTTPBadRequest(BadRequest): class Unauthorized(HTTPException): - """DEPRECATED""" + """DEPRECATED.""" code = 401 @@ -78,7 +78,7 @@ class HTTPUnauthorized(Unauthorized): class Forbidden(HTTPException): - """DEPRECATED""" + """DEPRECATED.""" code = 403 @@ -87,7 +87,7 @@ class HTTPForbidden(Forbidden): class NotFound(HTTPException): - """DEPRECATED""" + """DEPRECATED.""" code = 404 @@ -100,7 +100,7 @@ class HTTPMethodNotAllowed(HTTPException): class Conflict(HTTPException): - """DEPRECATED""" + """DEPRECATED.""" code = 409 @@ -109,7 +109,7 @@ class HTTPConflict(Conflict): class OverLimit(HTTPException): - """DEPRECATED""" + """DEPRECATED.""" code = 413 @@ -130,7 +130,7 @@ class HTTPBadGateway(HTTPException): class ServiceUnavailable(HTTPException): - """DEPRECATED""" + """DEPRECATED.""" code = 503 @@ -154,10 +154,10 @@ def from_response(response): class NoTokenLookupException(Exception): - """DEPRECATED""" + """DEPRECATED.""" pass class EndpointNotFound(Exception): - """DEPRECATED""" + """DEPRECATED.""" pass diff --git a/ceilometerclient/shell.py b/ceilometerclient/shell.py index 87b48405..51fa32b7 100644 --- a/ceilometerclient/shell.py +++ b/ceilometerclient/shell.py @@ -313,9 +313,7 @@ class CeilometerShell(object): @utils.arg('command', metavar='', nargs='?', help='Display help for ') def do_help(self, args): - """ - Display help about this program or one of its subcommands. - """ + """Display help about this program or one of its subcommands.""" if getattr(args, 'command', None): if args.command in self.subcommands: self.subcommands[args.command].print_help() diff --git a/ceilometerclient/v1/client.py b/ceilometerclient/v1/client.py index af4b7ae4..5fcb8a18 100644 --- a/ceilometerclient/v1/client.py +++ b/ceilometerclient/v1/client.py @@ -28,7 +28,7 @@ class Client(http.HTTPClient): """ def __init__(self, *args, **kwargs): - """ Initialize a new client for the Ceilometer v1 API. """ + """Initialize a new client for the Ceilometer v1 API.""" super(Client, self).__init__(*args, **kwargs) self.meters = meters.MeterManager(self) self.samples = meters.SampleManager(self) diff --git a/ceilometerclient/v1/shell.py b/ceilometerclient/v1/shell.py index 99240631..9718412a 100644 --- a/ceilometerclient/v1/shell.py +++ b/ceilometerclient/v1/shell.py @@ -36,7 +36,7 @@ import ceilometerclient.exc as exc help='ISO date in UTC which limits events by ' 'timestamp <= this value') def do_sample_list(cc, args): - '''List the samples for this meters''' + '''List the samples for this meters.''' fields = {'counter_name': args.counter_name, 'resource_id': args.resource_id, 'user_id': args.user_id, @@ -84,7 +84,7 @@ def do_meter_list(cc, args={}): @utils.arg('-s', '--source', metavar='', help='ID of the resource to show projects for.') def do_user_list(cc, args={}): - '''List the users''' + '''List the users.''' kwargs = {'source': args.source} users = cc.users.list(**kwargs) field_labels = ['User ID'] @@ -108,7 +108,7 @@ def do_user_list(cc, args={}): help='ISO date in UTC which limits resouces by ' 'last update time <= this value') def do_resource_list(cc, args={}): - '''List the resources''' + '''List the resources.''' kwargs = {'source': args.source, 'user_id': args.user_id, 'project_id': args.project_id, @@ -126,7 +126,7 @@ def do_resource_list(cc, args={}): @utils.arg('-s', '--source', metavar='', help='ID of the resource to show projects for.') def do_project_list(cc, args={}): - '''List the projects''' + '''List the projects.''' kwargs = {'source': args.source} projects = cc.projects.list(**kwargs) diff --git a/ceilometerclient/v2/client.py b/ceilometerclient/v2/client.py index d3c64e17..c2e84c50 100644 --- a/ceilometerclient/v2/client.py +++ b/ceilometerclient/v2/client.py @@ -32,7 +32,7 @@ class Client(http.HTTPClient): """ def __init__(self, *args, **kwargs): - """ Initialize a new client for the Ceilometer v1 API. """ + """Initialize a new client for the Ceilometer v1 API.""" super(Client, self).__init__(*args, **kwargs) self.meters = meters.MeterManager(self) self.samples = samples.SampleManager(self) diff --git a/ceilometerclient/v2/options.py b/ceilometerclient/v2/options.py index cd3767f9..35ceafdf 100644 --- a/ceilometerclient/v2/options.py +++ b/ceilometerclient/v2/options.py @@ -16,9 +16,7 @@ import urllib def build_url(path, q): - ''' - This converts from a list of dict's to what the rest api needs - so from: + '''This converts from a list of dict's to what the rest api needs so from: "[{field=this,op=le,value=34},{field=that,op=eq,value=foo}]" to: "?q.field=this&q.op=le&q.value=34& @@ -39,8 +37,7 @@ def build_url(path, q): def cli_to_array(cli_query): - ''' - This converts from the cli list of queries to what is required + '''This converts from the cli list of queries to what is required by the python api. so from: "this<=34;that=foo" diff --git a/ceilometerclient/v2/shell.py b/ceilometerclient/v2/shell.py index a775a893..1bec237f 100644 --- a/ceilometerclient/v2/shell.py +++ b/ceilometerclient/v2/shell.py @@ -26,7 +26,7 @@ import ceilometerclient.exc as exc @utils.arg('-m', '--meter', metavar='', help='Name of meter to show samples for.') def do_statistics(cc, args): - '''List the statistics for this meters''' + '''List the statistics for this meters.''' fields = {'meter_name': args.meter, 'q': options.cli_to_array(args.query)} if args.meter is None: @@ -50,7 +50,7 @@ def do_statistics(cc, args): @utils.arg('-m', '--meter', metavar='', help='Name of meter to show samples for.') def do_sample_list(cc, args): - '''List the samples for this meters''' + '''List the samples for this meters.''' fields = {'meter_name': args.meter, 'q': options.cli_to_array(args.query)} if args.meter is None: @@ -71,7 +71,7 @@ def do_sample_list(cc, args): @utils.arg('-q', '--query', metavar='', help='key[op]value; list.') def do_meter_list(cc, args={}): - '''List the user's meters''' + '''List the user's meters.''' meters = cc.meters.list(q=options.cli_to_array(args.query)) field_labels = ['Name', 'Type', 'Unit', 'Resource ID', 'User ID', 'Project ID'] @@ -84,7 +84,7 @@ def do_meter_list(cc, args={}): @utils.arg('-q', '--query', metavar='', help='key[op]value; list.') def do_alarm_list(cc, args={}): - '''List the user's alarms''' + '''List the user's alarms.''' alarms = cc.alarms.list(q=options.cli_to_array(args.query)) # omit action initially to keep output width sane # (can switch over to vertical formatting when available from CLIFF) @@ -101,7 +101,7 @@ def do_alarm_list(cc, args={}): @utils.arg('-a', '--alarm_id', metavar='', help='ID of the alarm to show.') def do_alarm_show(cc, args={}): - '''Show an alarm''' + '''Show an alarm.''' if args.alarm_id is None: raise exc.CommandError('Alarm ID not provided (-a )') try: @@ -120,7 +120,7 @@ def do_alarm_show(cc, args={}): @utils.arg('-q', '--query', metavar='', help='key[op]value; list.') def do_resource_list(cc, args={}): - '''List the resources''' + '''List the resources.''' resources = cc.resources.list(q=options.cli_to_array(args.query)) field_labels = ['Resource ID', 'Source', 'User ID', 'Project ID'] @@ -132,7 +132,7 @@ def do_resource_list(cc, args={}): @utils.arg('-r', '--resource_id', metavar='', help='ID of the resource to show.') def do_resource_show(cc, args={}): - '''Show the resource''' + '''Show the resource.''' if args.resource_id is None: raise exc.CommandError('Resource id not provided (-r )') try: