Merge "Start Gating on Pyflakes and Hacking"

This commit is contained in:
Jenkins
2013-06-12 06:22:52 +00:00
committed by Gerrit Code Review
20 changed files with 38 additions and 35 deletions

View File

@@ -107,7 +107,7 @@ class Manager(utils.HookableMixin):
cache_dir = os.path.expanduser(os.path.join(base_dir, uniqifier)) cache_dir = os.path.expanduser(os.path.join(base_dir, uniqifier))
try: try:
os.makedirs(cache_dir, 0755) os.makedirs(cache_dir, 0o755)
except OSError: except OSError:
# NOTE(kiall): This is typicaly either permission denied while # NOTE(kiall): This is typicaly either permission denied while
# attempting to create the directory, or the directory # attempting to create the directory, or the directory

View File

@@ -207,7 +207,8 @@ class HTTPClient(object):
def _extract_service_catalog(self, url, resp, body, extract_token=True): def _extract_service_catalog(self, url, resp, body, extract_token=True):
"""See what the auth service told us and process the response. """See what the auth service told us and process the response.
We may get redirected to another site, fail or actually get We may get redirected to another site, fail or actually get
back a service catalog with a token and our endpoints.""" back a service catalog with a token and our endpoints.
"""
if resp.status_code == 200: # content must always present if resp.status_code == 200: # content must always present
try: try:

View File

@@ -6,7 +6,8 @@ Exception definitions.
class UnsupportedVersion(Exception): class UnsupportedVersion(Exception):
"""Indicates that the user is trying to use an unsupported """Indicates that the user is trying to use an unsupported
version of the API""" version of the API.
"""
pass pass
@@ -24,7 +25,8 @@ class NoUniqueMatch(Exception):
class NoTokenLookupException(Exception): class NoTokenLookupException(Exception):
"""This form of authentication does not support looking up """This form of authentication does not support looking up
endpoints from an existing token.""" endpoints from an existing token.
"""
pass pass

View File

@@ -33,7 +33,8 @@ class ServiceCatalog(object):
service_name=None, volume_service_name=None): service_name=None, volume_service_name=None):
"""Fetch the public URL from the Compute service for """Fetch the public URL from the Compute service for
a particular endpoint attribute. If none given, return a particular endpoint attribute. If none given, return
the first. See tests for sample service catalog.""" the first. See tests for sample service catalog.
"""
matching_endpoints = [] matching_endpoints = []
if 'endpoints' in self.catalog: if 'endpoints' in self.catalog:
# We have a bastardized service catalog. Treat it special. :/ # We have a bastardized service catalog. Treat it special. :/
@@ -44,7 +45,7 @@ class ServiceCatalog(object):
raise cinderclient.exceptions.EndpointNotFound() raise cinderclient.exceptions.EndpointNotFound()
# We don't always get a service catalog back ... # We don't always get a service catalog back ...
if not 'serviceCatalog' in self.catalog['access']: if 'serviceCatalog' not in self.catalog['access']:
return None return None
# Full catalog ... # Full catalog ...

View File

@@ -1,5 +1,4 @@
import cStringIO import cStringIO
import os
import re import re
import sys import sys

View File

@@ -79,7 +79,7 @@ class FindResourceTestCase(test_utils.TestCase):
class CaptureStdout(object): class CaptureStdout(object):
"""Context manager for capturing stdout from statments in its's block""" """Context manager for capturing stdout from statments in its's block."""
def __enter__(self): def __enter__(self):
self.real_stdout = sys.stdout self.real_stdout = sys.stdout
self.stringio = StringIO.StringIO() self.stringio = StringIO.StringIO()

View File

@@ -23,8 +23,9 @@ class TestCase(testtools.TestCase):
class TestResponse(requests.Response): class TestResponse(requests.Response):
""" Class used to wrap requests.Response and provide some """Class used to wrap requests.Response and provide some
convenience to initialize with a dict """ convenience to initialize with a dict.
"""
def __init__(self, data): def __init__(self, data):
self._text = None self._text = None

View File

@@ -15,8 +15,6 @@
# License for the specific language governing permissions and limitations # License for the specific language governing permissions and limitations
# under the License. # under the License.
import os
import fixtures import fixtures
from cinderclient import client from cinderclient import client

View File

@@ -1,4 +1,3 @@
from cinderclient import exceptions
from cinderclient.v1 import volume_types from cinderclient.v1 import volume_types
from cinderclient.tests import utils from cinderclient.tests import utils
from cinderclient.tests.v1 import fakes from cinderclient.tests.v1 import fakes

View File

@@ -14,4 +14,4 @@
# License for the specific language governing permissions and limitations # License for the specific language governing permissions and limitations
# under the License. # under the License.
from cinderclient.v1.client import Client from cinderclient.v1.client import Client # noqa

View File

@@ -4,7 +4,7 @@ from cinderclient import base
class Limits(base.Resource): class Limits(base.Resource):
"""A collection of RateLimit and AbsoluteLimit objects""" """A collection of RateLimit and AbsoluteLimit objects."""
def __repr__(self): def __repr__(self):
return "<Limits>" return "<Limits>"
@@ -26,7 +26,7 @@ class Limits(base.Resource):
class RateLimit(object): class RateLimit(object):
"""Data model that represents a flattened view of a single rate limit""" """Data model that represents a flattened view of a single rate limit."""
def __init__(self, verb, uri, regex, value, remain, def __init__(self, verb, uri, regex, value, remain,
unit, next_available): unit, next_available):
@@ -52,7 +52,7 @@ class RateLimit(object):
class AbsoluteLimit(object): class AbsoluteLimit(object):
"""Data model that represents a single absolute limit""" """Data model that represents a single absolute limit."""
def __init__(self, name, value): def __init__(self, name, value):
self.name = name self.name = name
@@ -66,7 +66,7 @@ class AbsoluteLimit(object):
class LimitsManager(base.Manager): class LimitsManager(base.Manager):
"""Manager object used to interact with limits resource""" """Manager object used to interact with limits resource."""
resource_class = Limits resource_class = Limits

View File

@@ -21,7 +21,8 @@ class QuotaClassSet(base.Resource):
@property @property
def id(self): def id(self):
"""QuotaClassSet does not have a 'id' attribute but base.Resource """QuotaClassSet does not have a 'id' attribute but base.Resource
needs it to self-refresh and QuotaSet is indexed by class_name""" needs it to self-refresh and QuotaSet is indexed by class_name.
"""
return self.class_name return self.class_name
def update(self, *args, **kwargs): def update(self, *args, **kwargs):

View File

@@ -20,8 +20,9 @@ class QuotaSet(base.Resource):
@property @property
def id(self): def id(self):
"""QuotaSet does not have a 'id' attribute but base.Resource needs it """QuotaSet does not have a 'id' attribute but base. Resource needs it
to self-refresh and QuotaSet is indexed by tenant_id""" to self-refresh and QuotaSet is indexed by tenant_id.
"""
return self.tenant_id return self.tenant_id
def update(self, *args, **kwargs): def update(self, *args, **kwargs):

View File

@@ -462,7 +462,7 @@ def do_type_create(cs, args):
help="Unique ID of the volume type to delete") help="Unique ID of the volume type to delete")
@utils.service_type('volume') @utils.service_type('volume')
def do_type_delete(cs, args): def do_type_delete(cs, args):
"""Delete a specific volume type""" """Delete a specific volume type."""
cs.volume_types.delete(args.id) cs.volume_types.delete(args.id)
@@ -493,14 +493,14 @@ def do_type_key(cs, args):
def do_endpoints(cs, args): def do_endpoints(cs, args):
"""Discover endpoints that get returned from the authenticate services""" """Discover endpoints that get returned from the authenticate services."""
catalog = cs.client.service_catalog.catalog catalog = cs.client.service_catalog.catalog
for e in catalog['access']['serviceCatalog']: for e in catalog['access']['serviceCatalog']:
utils.print_dict(e['endpoints'][0], e['name']) utils.print_dict(e['endpoints'][0], e['name'])
def do_credentials(cs, args): def do_credentials(cs, args):
"""Show user credentials returned from auth""" """Show user credentials returned from auth."""
catalog = cs.client.service_catalog.catalog catalog = cs.client.service_catalog.catalog
utils.print_dict(catalog['access']['user'], "User Credentials") utils.print_dict(catalog['access']['user'], "User Credentials")
utils.print_dict(catalog['access']['token'], "Token") utils.print_dict(catalog['access']['token'], "Token")

View File

@@ -14,4 +14,4 @@
# License for the specific language governing permissions and limitations # License for the specific language governing permissions and limitations
# under the License. # under the License.
from cinderclient.v2.client import Client from cinderclient.v2.client import Client # noqa

View File

@@ -4,7 +4,7 @@ from cinderclient import base
class Limits(base.Resource): class Limits(base.Resource):
"""A collection of RateLimit and AbsoluteLimit objects""" """A collection of RateLimit and AbsoluteLimit objects."""
def __repr__(self): def __repr__(self):
return "<Limits>" return "<Limits>"
@@ -26,7 +26,7 @@ class Limits(base.Resource):
class RateLimit(object): class RateLimit(object):
"""Data model that represents a flattened view of a single rate limit""" """Data model that represents a flattened view of a single rate limit."""
def __init__(self, verb, uri, regex, value, remain, def __init__(self, verb, uri, regex, value, remain,
unit, next_available): unit, next_available):
@@ -52,7 +52,7 @@ class RateLimit(object):
class AbsoluteLimit(object): class AbsoluteLimit(object):
"""Data model that represents a single absolute limit""" """Data model that represents a single absolute limit."""
def __init__(self, name, value): def __init__(self, name, value):
self.name = name self.name = name
@@ -66,7 +66,7 @@ class AbsoluteLimit(object):
class LimitsManager(base.Manager): class LimitsManager(base.Manager):
"""Manager object used to interact with limits resource""" """Manager object used to interact with limits resource."""
resource_class = Limits resource_class = Limits

View File

@@ -20,7 +20,7 @@ class QuotaClassSet(base.Resource):
@property @property
def id(self): def id(self):
"""Needed by base.Resource to self-refresh and be indexed""" """Needed by base.Resource to self-refresh and be indexed."""
return self.class_name return self.class_name
def update(self, *args, **kwargs): def update(self, *args, **kwargs):

View File

@@ -20,7 +20,7 @@ class QuotaSet(base.Resource):
@property @property
def id(self): def id(self):
"""Needed by base.Resource to self-refresh and be indexed""" """Needed by base.Resource to self-refresh and be indexed."""
return self.tenant_id return self.tenant_id
def update(self, *args, **kwargs): def update(self, *args, **kwargs):

View File

@@ -507,7 +507,7 @@ def do_type_create(cs, args):
help="Unique ID of the volume type to delete") help="Unique ID of the volume type to delete")
@utils.service_type('volume') @utils.service_type('volume')
def do_type_delete(cs, args): def do_type_delete(cs, args):
"""Delete a specific volume type""" """Delete a specific volume type."""
cs.volume_types.delete(args.id) cs.volume_types.delete(args.id)
@@ -537,14 +537,14 @@ def do_type_key(cs, args):
def do_endpoints(cs, args): def do_endpoints(cs, args):
"""Discover endpoints that get returned from the authenticate services""" """Discover endpoints that get returned from the authenticate services."""
catalog = cs.client.service_catalog.catalog catalog = cs.client.service_catalog.catalog
for e in catalog['access']['serviceCatalog']: for e in catalog['access']['serviceCatalog']:
utils.print_dict(e['endpoints'][0], e['name']) utils.print_dict(e['endpoints'][0], e['name'])
def do_credentials(cs, args): def do_credentials(cs, args):
"""Show user credentials returned from auth""" """Show user credentials returned from auth."""
catalog = cs.client.service_catalog.catalog catalog = cs.client.service_catalog.catalog
utils.print_dict(catalog['access']['user'], "User Credentials") utils.print_dict(catalog['access']['user'], "User Credentials")
utils.print_dict(catalog['access']['token'], "Token") utils.print_dict(catalog['access']['token'], "Token")

View File

@@ -25,5 +25,5 @@ downloadcache = ~/cache/pip
[flake8] [flake8]
show-source = True show-source = True
ignore = F,H ignore = F811,F821,H302,H306,H404
exclude=.venv,.git,.tox,dist,doc,*openstack/common*,*lib/python*,*egg,build,tools exclude=.venv,.git,.tox,dist,doc,*openstack/common*,*lib/python*,*egg,build,tools