summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNavid Pustchi <npustchi@gmail.com>2016-05-04 19:14:01 +0000
committerNavid Pustchi <npustchi@gmail.com>2016-05-04 19:47:14 +0000
commit01500be7fb8d4fdf6d072a1eacf4df87abe86c8c (patch)
tree0dc74328f8e8104acdc60e72e81b44e985f4ed0f
parent4c180e691fe1deed3b253016c28e8f6987436074 (diff)
downloadpython-keystoneclient-01500be7fb8d4fdf6d072a1eacf4df87abe86c8c.tar.gz
Fixing D105 PEP257
Currently tox ignores D105. D105: Missing docstring in magic method. This change removes it and make keystoneclient docstring compliant with it. Change-Id: I34dfc164891880425f542f8f8aa3426ec8640c96
-rw-r--r--keystoneclient/base.py3
-rw-r--r--keystoneclient/httpclient.py2
-rw-r--r--keystoneclient/tests/unit/auth/utils.py1
-rw-r--r--keystoneclient/v2_0/ec2.py1
-rw-r--r--keystoneclient/v2_0/endpoints.py1
-rw-r--r--keystoneclient/v2_0/extensions.py1
-rw-r--r--keystoneclient/v2_0/roles.py1
-rw-r--r--keystoneclient/v2_0/services.py1
-rw-r--r--keystoneclient/v2_0/tenants.py1
-rw-r--r--keystoneclient/v2_0/tokens.py1
-rw-r--r--keystoneclient/v2_0/users.py1
-rw-r--r--keystoneclient/v3/contrib/oauth1/core.py1
-rw-r--r--keystoneclient/v3/ec2.py1
-rw-r--r--tox.ini3
14 files changed, 17 insertions, 2 deletions
diff --git a/keystoneclient/base.py b/keystoneclient/base.py
index 8b36123..d028d97 100644
--- a/keystoneclient/base.py
+++ b/keystoneclient/base.py
@@ -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
diff --git a/keystoneclient/httpclient.py b/keystoneclient/httpclient.py
index 96f33b0..28b8422 100644
--- a/keystoneclient/httpclient.py
+++ b/keystoneclient/httpclient.py
@@ -868,6 +868,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
@@ -894,6 +895,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
diff --git a/keystoneclient/tests/unit/auth/utils.py b/keystoneclient/tests/unit/auth/utils.py
index 051fef3..d5926e2 100644
--- a/keystoneclient/tests/unit/auth/utils.py
+++ b/keystoneclient/tests/unit/auth/utils.py
@@ -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):
diff --git a/keystoneclient/v2_0/ec2.py b/keystoneclient/v2_0/ec2.py
index 6a94716..0abe98b 100644
--- a/keystoneclient/v2_0/ec2.py
+++ b/keystoneclient/v2_0/ec2.py
@@ -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):
diff --git a/keystoneclient/v2_0/endpoints.py b/keystoneclient/v2_0/endpoints.py
index 0f98c6c..13ac399 100644
--- a/keystoneclient/v2_0/endpoints.py
+++ b/keystoneclient/v2_0/endpoints.py
@@ -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
diff --git a/keystoneclient/v2_0/extensions.py b/keystoneclient/v2_0/extensions.py
index 6e772af..f1c4027 100644
--- a/keystoneclient/v2_0/extensions.py
+++ b/keystoneclient/v2_0/extensions.py
@@ -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
diff --git a/keystoneclient/v2_0/roles.py b/keystoneclient/v2_0/roles.py
index bdda53c..b918084 100644
--- a/keystoneclient/v2_0/roles.py
+++ b/keystoneclient/v2_0/roles.py
@@ -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):
diff --git a/keystoneclient/v2_0/services.py b/keystoneclient/v2_0/services.py
index 7a64f74..8f20b4d 100644
--- a/keystoneclient/v2_0/services.py
+++ b/keystoneclient/v2_0/services.py
@@ -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
diff --git a/keystoneclient/v2_0/tenants.py b/keystoneclient/v2_0/tenants.py
index 9c86b9c..ff40aca 100644
--- a/keystoneclient/v2_0/tenants.py
+++ b/keystoneclient/v2_0/tenants.py
@@ -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):
diff --git a/keystoneclient/v2_0/tokens.py b/keystoneclient/v2_0/tokens.py
index fe367eb..2e18507 100644
--- a/keystoneclient/v2_0/tokens.py
+++ b/keystoneclient/v2_0/tokens.py
@@ -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
diff --git a/keystoneclient/v2_0/users.py b/keystoneclient/v2_0/users.py
index 6f42cf4..b791166 100644
--- a/keystoneclient/v2_0/users.py
+++ b/keystoneclient/v2_0/users.py
@@ -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):
diff --git a/keystoneclient/v3/contrib/oauth1/core.py b/keystoneclient/v3/contrib/oauth1/core.py
index 8d10325..4b0278e 100644
--- a/keystoneclient/v3/contrib/oauth1/core.py
+++ b/keystoneclient/v3/contrib/oauth1/core.py
@@ -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)
diff --git a/keystoneclient/v3/ec2.py b/keystoneclient/v3/ec2.py
index 488cf1c..038406b 100644
--- a/keystoneclient/v3/ec2.py
+++ b/keystoneclient/v3/ec2.py
@@ -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
diff --git a/tox.ini b/tox.ini
index e180fbc..ad5dbe6 100644
--- a/tox.ini
+++ b/tox.ini
@@ -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*