Fixing D105, D203, and D205 PEP257

Currently tox ignores D105, D203, and D205.
D105: Missing docstring in magic method.
D203: 1 blank required before class docstring.
D205: Blank line required between one-line summary and description.
This change removes it and make keystone docstring compliant with it.

Change-Id: Id916612dd246e02159907d286e448545120f3655
This commit is contained in:
Navid Pustchi
2016-04-22 16:15:14 +00:00
parent 61a135cf7d
commit ce574c31ad
8 changed files with 9 additions and 4 deletions

View File

@@ -103,6 +103,7 @@ class AuthContext(dict):
'expires_at'])
def __setitem__(self, key, val):
"""Override __setitem__ to prevent conflicting values."""
if key in self.IDENTITY_ATTRIBUTES and key in self:
existing_val = self[key]
if key == 'expires_at':

View File

@@ -429,6 +429,7 @@ class KeyValueStoreLock(object):
self.key)
def __exit__(self, exc_type, exc_val, exc_tb):
"""Release the lock."""
self.release()

View File

@@ -868,6 +868,7 @@ class KeystoneLDAPHandler(LDAPHandler):
self.page_size = 0
def __enter__(self):
"""Enter runtime context."""
return self
def _disable_paging(self):
@@ -1083,6 +1084,7 @@ class KeystoneLDAPHandler(LDAPHandler):
return self.conn.delete_ext_s(dn_utf8, serverctrls, clientctrls)
def __exit__(self, exc_type, exc_val, exc_tb):
"""Exit runtime context, unbind LDAP."""
self.unbind_s()

View File

@@ -23,6 +23,7 @@ class Model(dict):
"""Base model class."""
def __hash__(self):
"""Define hash behavior where hash of service ID is returned."""
return self['id'].__hash__()
@property

View File

@@ -147,6 +147,7 @@ class DictBase(models.ModelBase):
return d
def __getitem__(self, key):
"""Evaluate if key is in extra or not, to return correct item."""
if key in self.extra:
return self.extra[key]
return getattr(self, key)

View File

@@ -498,6 +498,7 @@ class WhiteListedItemFilter(object):
self._data = data
def __getitem__(self, name):
"""Evaluation on an item access."""
if name not in self._whitelist:
raise KeyError
return self._data[name]

View File

@@ -63,6 +63,7 @@ class KeystoneToken(dict):
'both project and domain.'))
def __repr__(self):
"""Return string representation of KeystoneToken."""
desc = ('<%(type)s (audit_id=%(audit_id)s, '
'audit_chain_id=%(audit_chain_id)s) at %(loc)s>')
self_cls_name = reflection.get_class_name(self,

View File

@@ -130,10 +130,7 @@ show-source = true
# D102: Missing docstring in public method
# D103: Missing docstring in public function
# D104: Missing docstring in public package
# D105: Missing docstring in magic method
# D203: 1 blank required before class docstring.
# D205: Blank line required between one-line summary and description.
ignore = D100,D101,D102,D103,D104,D105,D203,D205
ignore = D100,D101,D102,D103,D104
exclude=.venv,.git,.tox,build,dist,doc,*openstack/common*,*lib/python*,*egg,tools,vendor,.update-venv,*.ini,*.po,*.pot
max-complexity=24