Enables H403 pep8 rules

Updates tox.ini to reduce ignored rules.

Updates code for H403 violation.

Change-Id: Iee7b34a27c62ce8cb0f26166b3c16e3386e2fecd
This commit is contained in:
Sushil Kumar 2013-12-12 03:55:50 +00:00 committed by Gerrit Code Review
parent 3ecaeb416e
commit 953734d727
7 changed files with 15 additions and 8 deletions

View File

@ -254,7 +254,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.
"""
# content must always present # content must always present
if resp.status_code == 200 or resp.status_code == 201: if resp.status_code == 200 or resp.status_code == 201:

View File

@ -24,7 +24,8 @@ class DecryptionFailure(Exception):
def decrypt_password(private_key, password): def decrypt_password(private_key, password):
"""Base64 decodes password and unecrypts it with private key. """Base64 decodes password and unecrypts it with private key.
Requires openssl binary available in the path""" Requires openssl binary available in the path.
"""
unencoded = base64.b64decode(password) unencoded = base64.b64decode(password)
cmd = ['openssl', 'rsautl', '-decrypt', '-inkey', private_key] cmd = ['openssl', 'rsautl', '-decrypt', '-inkey', private_key]
proc = subprocess.Popen(cmd, stdin=subprocess.PIPE, proc = subprocess.Popen(cmd, stdin=subprocess.PIPE,

View File

@ -19,7 +19,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
@ -46,7 +47,8 @@ class AuthSystemNotFound(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

@ -36,7 +36,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. :/

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

@ -21,7 +21,8 @@ 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

@ -28,6 +28,6 @@ commands = python setup.py testr --coverage --testr-args='{posargs}'
downloadcache = ~/cache/pip downloadcache = ~/cache/pip
[flake8] [flake8]
ignore = E12,F841,F811,F821,H302,H403,H404 ignore = E12,F841,F811,F821,H302,H404
show-source = True show-source = True
exclude=.venv,.git,.tox,dist,doc,*openstack/common*,*lib/python*,*egg,build exclude=.venv,.git,.tox,dist,doc,*openstack/common*,*lib/python*,*egg,build