Pin pep8 to 1.3.3
pep8 1.3.3 is pretty much standard across the openstack projects. Pin pep8 1.3.3 and fix associated warnings/errors. Change-Id: I7230857889d261320a0dab2c261c9f85dc0ee602 Signed-off-by: Chuck Short <chuck.short@canonical.com>
This commit is contained in:
@@ -89,7 +89,7 @@ class Resource(object):
|
||||
|
||||
def __getattr__(self, k):
|
||||
if k not in self.__dict__:
|
||||
#NOTE(bcwaldon): disallow lazy-loading if already loaded once
|
||||
# NOTE(bcwaldon): disallow lazy-loading if already loaded once
|
||||
if not self.is_loaded():
|
||||
self.get()
|
||||
return self.__getattr__(k)
|
||||
@@ -100,7 +100,7 @@ class Resource(object):
|
||||
|
||||
def __repr__(self):
|
||||
reprkeys = sorted(k for k in self.__dict__.keys() if k[0] != '_' and
|
||||
k != 'manager')
|
||||
k != 'manager')
|
||||
info = ", ".join("%s=%s" % (k, getattr(self, k)) for k in reprkeys)
|
||||
return "<%s %s>" % (self.__class__.__name__, info)
|
||||
|
||||
|
||||
@@ -42,120 +42,127 @@ class CeilometerShell(object):
|
||||
|
||||
# Global arguments
|
||||
parser.add_argument('-h', '--help',
|
||||
action='store_true',
|
||||
help=argparse.SUPPRESS,
|
||||
)
|
||||
action='store_true',
|
||||
help=argparse.SUPPRESS,
|
||||
)
|
||||
|
||||
parser.add_argument('-d', '--debug',
|
||||
default=bool(utils.env('CEILOMETERCLIENT_DEBUG')),
|
||||
action='store_true',
|
||||
help='Defaults to env[CEILOMETERCLIENT_DEBUG]')
|
||||
default=bool(utils.env('CEILOMETERCLIENT_DEBUG')),
|
||||
action='store_true',
|
||||
help='Defaults to env[CEILOMETERCLIENT_DEBUG]')
|
||||
|
||||
parser.add_argument('-v', '--verbose',
|
||||
default=False, action="store_true",
|
||||
help="Print more verbose output")
|
||||
default=False, action="store_true",
|
||||
help="Print more verbose output")
|
||||
|
||||
parser.add_argument('-k', '--insecure',
|
||||
default=False,
|
||||
action='store_true',
|
||||
help="Explicitly allow glanceclient to perform \"insecure\" "
|
||||
"SSL (https) requests. The server's certificate will "
|
||||
"not be verified against any certificate authorities. "
|
||||
"This option should be used with caution.")
|
||||
default=False,
|
||||
action='store_true',
|
||||
help="Explicitly allow glanceclient to perform "
|
||||
"\"insecure\" SSL (https) requests. "
|
||||
"The server's certificate will "
|
||||
"not be verified against any certificate "
|
||||
"authorities. This option should be used with "
|
||||
"caution.")
|
||||
|
||||
parser.add_argument('--cert-file',
|
||||
help='Path of certificate file to use in SSL connection. This '
|
||||
'file can optionally be prepended with the private key.')
|
||||
help='Path of certificate file to use in SSL '
|
||||
'connection. This file can optionally be prepended'
|
||||
' with the private key.')
|
||||
|
||||
parser.add_argument('--key-file',
|
||||
help='Path of client key to use in SSL connection. This option is '
|
||||
'not necessary if your key is prepended to your cert file.')
|
||||
help='Path of client key to use in SSL connection.'
|
||||
' This option is not necessary if your key is '
|
||||
'prepended to your cert file.')
|
||||
|
||||
parser.add_argument('--ca-file',
|
||||
help='Path of CA SSL certificate(s) used to verify the remote '
|
||||
'server\'s certificate. Without this option glance looks '
|
||||
'for the default system CA certificates.')
|
||||
help='Path of CA SSL certificate(s) used to verify'
|
||||
' the remote server certificate. Without this '
|
||||
'option glance looks for the default system '
|
||||
'CA certificates.')
|
||||
|
||||
parser.add_argument('--timeout',
|
||||
default=600,
|
||||
help='Number of seconds to wait for a response')
|
||||
default=600,
|
||||
help='Number of seconds to wait for a response')
|
||||
|
||||
parser.add_argument('--os-username',
|
||||
default=utils.env('OS_USERNAME'),
|
||||
help='Defaults to env[OS_USERNAME]')
|
||||
default=utils.env('OS_USERNAME'),
|
||||
help='Defaults to env[OS_USERNAME]')
|
||||
|
||||
parser.add_argument('--os_username',
|
||||
help=argparse.SUPPRESS)
|
||||
help=argparse.SUPPRESS)
|
||||
|
||||
parser.add_argument('--os-password',
|
||||
default=utils.env('OS_PASSWORD'),
|
||||
help='Defaults to env[OS_PASSWORD]')
|
||||
default=utils.env('OS_PASSWORD'),
|
||||
help='Defaults to env[OS_PASSWORD]')
|
||||
|
||||
parser.add_argument('--os_password',
|
||||
help=argparse.SUPPRESS)
|
||||
help=argparse.SUPPRESS)
|
||||
|
||||
parser.add_argument('--os-tenant-id',
|
||||
default=utils.env('OS_TENANT_ID'),
|
||||
help='Defaults to env[OS_TENANT_ID]')
|
||||
default=utils.env('OS_TENANT_ID'),
|
||||
help='Defaults to env[OS_TENANT_ID]')
|
||||
|
||||
parser.add_argument('--os_tenant_id',
|
||||
help=argparse.SUPPRESS)
|
||||
help=argparse.SUPPRESS)
|
||||
|
||||
parser.add_argument('--os-tenant-name',
|
||||
default=utils.env('OS_TENANT_NAME'),
|
||||
help='Defaults to env[OS_TENANT_NAME]')
|
||||
default=utils.env('OS_TENANT_NAME'),
|
||||
help='Defaults to env[OS_TENANT_NAME]')
|
||||
|
||||
parser.add_argument('--os_tenant_name',
|
||||
help=argparse.SUPPRESS)
|
||||
help=argparse.SUPPRESS)
|
||||
|
||||
parser.add_argument('--os-auth-url',
|
||||
default=utils.env('OS_AUTH_URL'),
|
||||
help='Defaults to env[OS_AUTH_URL]')
|
||||
default=utils.env('OS_AUTH_URL'),
|
||||
help='Defaults to env[OS_AUTH_URL]')
|
||||
|
||||
parser.add_argument('--os_auth_url',
|
||||
help=argparse.SUPPRESS)
|
||||
help=argparse.SUPPRESS)
|
||||
|
||||
parser.add_argument('--os-region-name',
|
||||
default=utils.env('OS_REGION_NAME'),
|
||||
help='Defaults to env[OS_REGION_NAME]')
|
||||
default=utils.env('OS_REGION_NAME'),
|
||||
help='Defaults to env[OS_REGION_NAME]')
|
||||
|
||||
parser.add_argument('--os_region_name',
|
||||
help=argparse.SUPPRESS)
|
||||
help=argparse.SUPPRESS)
|
||||
|
||||
parser.add_argument('--os-auth-token',
|
||||
default=utils.env('OS_AUTH_TOKEN'),
|
||||
help='Defaults to env[OS_AUTH_TOKEN]')
|
||||
default=utils.env('OS_AUTH_TOKEN'),
|
||||
help='Defaults to env[OS_AUTH_TOKEN]')
|
||||
|
||||
parser.add_argument('--os_auth_token',
|
||||
help=argparse.SUPPRESS)
|
||||
help=argparse.SUPPRESS)
|
||||
|
||||
parser.add_argument('--ceilometer-url',
|
||||
default=utils.env('CEILOMETER_URL'),
|
||||
help='Defaults to env[CEILOMETER_URL]')
|
||||
default=utils.env('CEILOMETER_URL'),
|
||||
help='Defaults to env[CEILOMETER_URL]')
|
||||
|
||||
parser.add_argument('--ceilometer_url',
|
||||
help=argparse.SUPPRESS)
|
||||
help=argparse.SUPPRESS)
|
||||
|
||||
parser.add_argument('--ceilometer-api-version',
|
||||
default=utils.env('CEILOMETER_API_VERSION', default='1'),
|
||||
help='Defaults to env[CEILOMETER_API_VERSION] or 1')
|
||||
default=utils.env(
|
||||
'CEILOMETER_API_VERSION', default='1'),
|
||||
help='Defaults to env[CEILOMETER_API_VERSION] '
|
||||
'or 1')
|
||||
|
||||
parser.add_argument('--ceilometer_api_version',
|
||||
help=argparse.SUPPRESS)
|
||||
help=argparse.SUPPRESS)
|
||||
|
||||
parser.add_argument('--os-service-type',
|
||||
default=utils.env('OS_SERVICE_TYPE'),
|
||||
help='Defaults to env[OS_SERVICE_TYPE]')
|
||||
default=utils.env('OS_SERVICE_TYPE'),
|
||||
help='Defaults to env[OS_SERVICE_TYPE]')
|
||||
|
||||
parser.add_argument('--os_service_type',
|
||||
help=argparse.SUPPRESS)
|
||||
help=argparse.SUPPRESS)
|
||||
|
||||
parser.add_argument('--os-endpoint-type',
|
||||
default=utils.env('OS_ENDPOINT_TYPE'),
|
||||
help='Defaults to env[OS_ENDPOINT_TYPE]')
|
||||
default=utils.env('OS_ENDPOINT_TYPE'),
|
||||
help='Defaults to env[OS_ENDPOINT_TYPE]')
|
||||
|
||||
parser.add_argument('--os_endpoint_type',
|
||||
help=argparse.SUPPRESS)
|
||||
help=argparse.SUPPRESS)
|
||||
|
||||
return parser
|
||||
|
||||
@@ -179,16 +186,12 @@ class CeilometerShell(object):
|
||||
help = desc.strip().split('\n')[0]
|
||||
arguments = getattr(callback, 'arguments', [])
|
||||
|
||||
subparser = subparsers.add_parser(command,
|
||||
help=help,
|
||||
description=desc,
|
||||
add_help=False,
|
||||
formatter_class=HelpFormatter
|
||||
)
|
||||
subparser.add_argument('-h', '--help',
|
||||
action='help',
|
||||
help=argparse.SUPPRESS,
|
||||
)
|
||||
subparser = subparsers.add_parser(command, help=help,
|
||||
description=desc,
|
||||
add_help=False,
|
||||
formatter_class=HelpFormatter)
|
||||
subparser.add_argument('-h', '--help', action='help',
|
||||
help=argparse.SUPPRESS)
|
||||
self.subcommands[command] = subparser
|
||||
for (args, kwargs) in arguments:
|
||||
subparser.add_argument(*args, **kwargs)
|
||||
@@ -213,8 +216,8 @@ class CeilometerShell(object):
|
||||
def _get_endpoint(self, client, **kwargs):
|
||||
"""Get an endpoint using the provided keystone client."""
|
||||
return client.service_catalog.url_for(
|
||||
service_type=kwargs.get('service_type') or 'metering',
|
||||
endpoint_type=kwargs.get('endpoint_type') or 'publicURL')
|
||||
service_type=kwargs.get('service_type') or 'metering',
|
||||
endpoint_type=kwargs.get('endpoint_type') or 'publicURL')
|
||||
|
||||
def _setup_debugging(self, debug):
|
||||
if debug:
|
||||
@@ -255,19 +258,21 @@ class CeilometerShell(object):
|
||||
|
||||
if not args.os_username:
|
||||
raise exc.CommandError("You must provide a username via"
|
||||
" either --os-username or env[OS_USERNAME]")
|
||||
" either --os-username or env[OS_USERNAME]")
|
||||
|
||||
if not args.os_password:
|
||||
raise exc.CommandError("You must provide a password via"
|
||||
" either --os-password or env[OS_PASSWORD]")
|
||||
" either --os-password or env[OS_PASSWORD]")
|
||||
|
||||
if not (args.os_tenant_id or args.os_tenant_name):
|
||||
raise exc.CommandError("You must provide a tenant_id via"
|
||||
" either --os-tenant-id or via env[OS_TENANT_ID]")
|
||||
" either --os-tenant-id or via "
|
||||
"env[OS_TENANT_ID]")
|
||||
|
||||
if not args.os_auth_url:
|
||||
raise exc.CommandError("You must provide an auth url via"
|
||||
" either --os-auth-url or via env[OS_AUTH_URL]")
|
||||
" either --os-auth-url or via "
|
||||
"env[OS_AUTH_URL]")
|
||||
kwargs = {
|
||||
'username': args.os_username,
|
||||
'password': args.os_password,
|
||||
@@ -282,7 +287,7 @@ class CeilometerShell(object):
|
||||
token = args.os_auth_token or _ksclient.auth_token
|
||||
|
||||
endpoint = args.ceilometer_url or \
|
||||
self._get_endpoint(_ksclient, **kwargs)
|
||||
self._get_endpoint(_ksclient, **kwargs)
|
||||
|
||||
kwargs = {
|
||||
'token': token,
|
||||
|
||||
@@ -91,7 +91,7 @@ class ResourceManager(base.Manager):
|
||||
class Sample(base.Resource):
|
||||
def __init__(self, manager, info, loaded=False):
|
||||
smaller = dict((k, v) for (k, v) in info.iteritems()
|
||||
if k not in ('metadata', 'message_signature'))
|
||||
if k not in ('metadata', 'message_signature'))
|
||||
super(Sample, self).__init__(manager, smaller, loaded)
|
||||
|
||||
def __repr__(self):
|
||||
|
||||
@@ -46,7 +46,7 @@ def do_sample_list(cc, args):
|
||||
fields = ['resource_id', 'counter_name', 'counter_type',
|
||||
'counter_volume', 'timestamp']
|
||||
utils.print_list(samples, fields, field_labels,
|
||||
sortby=0)
|
||||
sortby=0)
|
||||
|
||||
|
||||
@utils.arg('-s', '--source', metavar='<SOURCE>',
|
||||
|
||||
@@ -6,7 +6,7 @@ nose-exclude
|
||||
nosexcover
|
||||
openstack.nose_plugin
|
||||
nosehtmloutput
|
||||
pep8==1.2
|
||||
pep8==1.3.3
|
||||
setuptools-git>=0.4
|
||||
sphinx>=1.1.2
|
||||
unittest2
|
||||
unittest2
|
||||
|
||||
Reference in New Issue
Block a user