Fix various smaller pep8 issues

Change-Id: Icc015418e0e231311ac0a0cc507fa3f8842d8811
This commit is contained in:
Dirk Mueller 2013-06-20 20:43:19 +02:00
parent f524528770
commit 61ce60358e
5 changed files with 19 additions and 26 deletions

View file

@ -99,8 +99,8 @@ class Resource(object):
return self.__dict__[k]
def __repr__(self):
reprkeys = sorted(k for k in self.__dict__.keys() if k[0] != '_' and
k != 'manager')
reprkeys = sorted(k for k in self.__dict__.keys()
if k[0] != '_' and k != 'manager')
info = ", ".join("%s=%s" % (k, getattr(self, k)) for k in reprkeys)
return "<%s %s>" % (self.__class__.__name__, info)

View file

@ -43,8 +43,7 @@ class HeatShell(object):
# Global arguments
parser.add_argument('-h', '--help',
action='store_true',
help=argparse.SUPPRESS,
)
help=argparse.SUPPRESS)
parser.add_argument('-d', '--debug',
default=bool(utils.env('HEATCLIENT_DEBUG')),
@ -123,8 +122,8 @@ class HeatShell(object):
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)
@ -195,12 +194,10 @@ class HeatShell(object):
help=help,
description=desc,
add_help=False,
formatter_class=HelpFormatter
)
formatter_class=HelpFormatter)
subparser.add_argument('-h', '--help',
action='help',
help=argparse.SUPPRESS,
)
help=argparse.SUPPRESS)
self.subcommands[command] = subparser
for (args, kwargs) in arguments:
subparser.add_argument(*args, **kwargs)
@ -225,8 +222,8 @@ class HeatShell(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 'orchestration',
endpoint_type=kwargs.get('endpoint_type') or 'publicURL')
service_type=kwargs.get('service_type') or 'orchestration',
endpoint_type=kwargs.get('endpoint_type') or 'publicURL')
def _setup_debugging(self, debug):
if debug:

View file

@ -10,17 +10,15 @@ def script_keystone_client():
password='password',
tenant_id='',
tenant_name='tenant_name',
username='username').AndReturn(
FakeKeystone('abcd1234'))
username='username').AndReturn(FakeKeystone('abcd1234'))
def script_heat_list():
resp_dict = {"stacks": [{
"id": "1",
"stack_name": "teststack",
"stack_status": 'CREATE_COMPLETE',
"creation_time": "2012-10-25T01:58:47Z"
},
"id": "1",
"stack_name": "teststack",
"stack_status": 'CREATE_COMPLETE',
"creation_time": "2012-10-25T01:58:47Z"},
{
"id": "2",
"stack_name": "teststack2",

View file

@ -82,14 +82,13 @@ class StackManager(base.Manager):
def create(self, **kwargs):
"""Create a stack."""
resp, body = self.api.json_request(
'POST', '/stacks', body=kwargs)
resp, body = self.api.json_request('POST', '/stacks', body=kwargs)
def update(self, **kwargs):
"""Update a stack."""
stack_id = kwargs.pop('stack_id')
resp, body = self.api.json_request(
'PUT', '/stacks/%s' % stack_id, body=kwargs)
resp, body = self.api.json_request('PUT', '/stacks/%s' % stack_id,
body=kwargs)
def delete(self, stack_id):
"""Delete a stack."""
@ -115,8 +114,7 @@ class StackManager(base.Manager):
def validate(self, **kwargs):
"""Validate a stack template."""
resp, body = self.api.json_request(
'POST', '/validate', body=kwargs)
resp, body = self.api.json_request('POST', '/validate', body=kwargs)
return body

View file

@ -22,6 +22,6 @@ downloadcache = ~/cache/pip
[flake8]
show-source = True
ignore = E12,H302,H303,H304,H403,H404,F403,F821,F841
ignore = E121,E128,H302,H303,H304,H403,H404,F403,F821,F841
builtins = _
exclude=.venv,.git,.tox,dist,doc,*openstack/common*,*lib/python*,*egg,build