Merge "Fixing D105 PEP257"

This commit is contained in:
Jenkins 2016-05-04 23:31:52 +00:00 committed by Gerrit Code Review
commit fb2fef9100
14 changed files with 17 additions and 2 deletions

View File

@ -460,6 +460,7 @@ class Resource(object):
self._loaded = loaded
def __repr__(self):
"""Return string representation of resource attributes."""
reprkeys = sorted(k
for k in self.__dict__.keys()
if k[0] != '_' and k != 'manager')
@ -485,6 +486,7 @@ class Resource(object):
pass
def __getattr__(self, k):
"""Checking attrbiute existence."""
if k not in self.__dict__:
# NOTE(bcwaldon): disallow lazy-loading if already loaded once
if not self.is_loaded():
@ -513,6 +515,7 @@ class Resource(object):
{'x_request_id': self.manager.client.last_request_id})
def __eq__(self, other):
"""Define equality for resources."""
if not isinstance(other, Resource):
return NotImplemented
# two resources of different types are not equal

View File

@ -864,6 +864,7 @@ class HTTPClient(baseclient.Client, base.BaseAuthPlugin):
deprecated_adapter_variables = {'region_name': None}
def __getattr__(self, name):
"""Fetch deprecated session variables."""
try:
var_name = self.deprecated_session_variables[name]
except KeyError: # nosec(cjschaef): try adapter variable or raise
@ -890,6 +891,7 @@ class HTTPClient(baseclient.Client, base.BaseAuthPlugin):
raise AttributeError(_("Unknown Attribute: %s") % name)
def __setattr__(self, name, val):
"""Assign value to deprecated seesion variables."""
try:
var_name = self.deprecated_session_variables[name]
except KeyError: # nosec(cjschaef): try adapter variable or call

View File

@ -37,6 +37,7 @@ class MockPlugin(base.BaseAuthPlugin):
self._data = kwargs
def __getitem__(self, key):
"""Get the data of the key."""
return self._data[key]
def get_token(self, *args, **kwargs):

View File

@ -18,6 +18,7 @@ from keystoneclient import base
class EC2(base.Resource):
def __repr__(self):
"""Return string representation of EC2 resource information."""
return "<EC2 %s>" % self._info
def delete(self):

View File

@ -20,6 +20,7 @@ class Endpoint(base.Resource):
"""Represents a Keystone endpoint."""
def __repr__(self):
"""Return string representation of endpoint resource information."""
return "<Endpoint %s>" % self._info

View File

@ -17,6 +17,7 @@ class Extension(base.Resource):
"""Represents an Identity API extension."""
def __repr__(self):
"""Return string representation of extension resource information."""
return "<Extension %s>" % self._info

View File

@ -21,6 +21,7 @@ class Role(base.Resource):
"""Represents a Keystone role."""
def __repr__(self):
"""Return string representation of role resource information."""
return "<Role %s>" % self._info
def delete(self):

View File

@ -21,6 +21,7 @@ class Service(base.Resource):
"""Represents a Keystone service."""
def __repr__(self):
"""Return string representation of service resource information."""
return "<Service %s>" % self._info

View File

@ -34,6 +34,7 @@ class Tenant(base.Resource):
"""
def __repr__(self):
"""Return string representation of tenant resource information."""
return "<Tenant %s>" % self._info
def delete(self):

View File

@ -21,6 +21,7 @@ from keystoneclient.i18n import _
class Token(base.Resource):
def __repr__(self):
"""Return string representation of resource information."""
return "<Token %s>" % self._info
@property

View File

@ -23,6 +23,7 @@ class User(base.Resource):
"""Represents a Keystone user."""
def __repr__(self):
"""Return string representation of user resource information."""
return "<User %s>" % self._info
def delete(self):

View File

@ -58,6 +58,7 @@ class OAuthManagerOptionalImportProxy(object):
"""
def __getattribute__(self, name):
"""Return error when name is related to oauthlib and not exist."""
if name in ('access_tokens', 'consumers', 'request_tokens'):
raise NotImplementedError(
_('To use %r oauthlib must be installed') % name)

View File

@ -16,6 +16,7 @@ from keystoneclient import base
class EC2(base.Resource):
def __repr__(self):
"""Return string representation of EC2 resource information."""
return "<EC2 %s>" % self._info

View File

@ -45,8 +45,7 @@ passenv = OS_*
# D102: Missing docstring in public method
# D103: Missing docstring in public function
# D104: Missing docstring in public package
# D105: Missing docstring in magic method
ignore = D100,D101,D102,D103,D104,D105
ignore = D100,D101,D102,D103,D104
show-source = True
exclude = .venv,.tox,dist,doc,*egg,build,*openstack/common*