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:
@@ -103,6 +103,7 @@ class AuthContext(dict):
|
|||||||
'expires_at'])
|
'expires_at'])
|
||||||
|
|
||||||
def __setitem__(self, key, val):
|
def __setitem__(self, key, val):
|
||||||
|
"""Override __setitem__ to prevent conflicting values."""
|
||||||
if key in self.IDENTITY_ATTRIBUTES and key in self:
|
if key in self.IDENTITY_ATTRIBUTES and key in self:
|
||||||
existing_val = self[key]
|
existing_val = self[key]
|
||||||
if key == 'expires_at':
|
if key == 'expires_at':
|
||||||
|
|||||||
@@ -429,6 +429,7 @@ class KeyValueStoreLock(object):
|
|||||||
self.key)
|
self.key)
|
||||||
|
|
||||||
def __exit__(self, exc_type, exc_val, exc_tb):
|
def __exit__(self, exc_type, exc_val, exc_tb):
|
||||||
|
"""Release the lock."""
|
||||||
self.release()
|
self.release()
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -868,6 +868,7 @@ class KeystoneLDAPHandler(LDAPHandler):
|
|||||||
self.page_size = 0
|
self.page_size = 0
|
||||||
|
|
||||||
def __enter__(self):
|
def __enter__(self):
|
||||||
|
"""Enter runtime context."""
|
||||||
return self
|
return self
|
||||||
|
|
||||||
def _disable_paging(self):
|
def _disable_paging(self):
|
||||||
@@ -1083,6 +1084,7 @@ class KeystoneLDAPHandler(LDAPHandler):
|
|||||||
return self.conn.delete_ext_s(dn_utf8, serverctrls, clientctrls)
|
return self.conn.delete_ext_s(dn_utf8, serverctrls, clientctrls)
|
||||||
|
|
||||||
def __exit__(self, exc_type, exc_val, exc_tb):
|
def __exit__(self, exc_type, exc_val, exc_tb):
|
||||||
|
"""Exit runtime context, unbind LDAP."""
|
||||||
self.unbind_s()
|
self.unbind_s()
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -23,6 +23,7 @@ class Model(dict):
|
|||||||
"""Base model class."""
|
"""Base model class."""
|
||||||
|
|
||||||
def __hash__(self):
|
def __hash__(self):
|
||||||
|
"""Define hash behavior where hash of service ID is returned."""
|
||||||
return self['id'].__hash__()
|
return self['id'].__hash__()
|
||||||
|
|
||||||
@property
|
@property
|
||||||
|
|||||||
@@ -147,6 +147,7 @@ class DictBase(models.ModelBase):
|
|||||||
return d
|
return d
|
||||||
|
|
||||||
def __getitem__(self, key):
|
def __getitem__(self, key):
|
||||||
|
"""Evaluate if key is in extra or not, to return correct item."""
|
||||||
if key in self.extra:
|
if key in self.extra:
|
||||||
return self.extra[key]
|
return self.extra[key]
|
||||||
return getattr(self, key)
|
return getattr(self, key)
|
||||||
|
|||||||
@@ -498,6 +498,7 @@ class WhiteListedItemFilter(object):
|
|||||||
self._data = data
|
self._data = data
|
||||||
|
|
||||||
def __getitem__(self, name):
|
def __getitem__(self, name):
|
||||||
|
"""Evaluation on an item access."""
|
||||||
if name not in self._whitelist:
|
if name not in self._whitelist:
|
||||||
raise KeyError
|
raise KeyError
|
||||||
return self._data[name]
|
return self._data[name]
|
||||||
|
|||||||
@@ -63,6 +63,7 @@ class KeystoneToken(dict):
|
|||||||
'both project and domain.'))
|
'both project and domain.'))
|
||||||
|
|
||||||
def __repr__(self):
|
def __repr__(self):
|
||||||
|
"""Return string representation of KeystoneToken."""
|
||||||
desc = ('<%(type)s (audit_id=%(audit_id)s, '
|
desc = ('<%(type)s (audit_id=%(audit_id)s, '
|
||||||
'audit_chain_id=%(audit_chain_id)s) at %(loc)s>')
|
'audit_chain_id=%(audit_chain_id)s) at %(loc)s>')
|
||||||
self_cls_name = reflection.get_class_name(self,
|
self_cls_name = reflection.get_class_name(self,
|
||||||
|
|||||||
5
tox.ini
5
tox.ini
@@ -130,10 +130,7 @@ show-source = true
|
|||||||
# D102: Missing docstring in public method
|
# D102: Missing docstring in public method
|
||||||
# D103: Missing docstring in public function
|
# D103: Missing docstring in public function
|
||||||
# D104: Missing docstring in public package
|
# D104: Missing docstring in public package
|
||||||
# D105: Missing docstring in magic method
|
ignore = D100,D101,D102,D103,D104
|
||||||
# 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
|
|
||||||
|
|
||||||
exclude=.venv,.git,.tox,build,dist,doc,*openstack/common*,*lib/python*,*egg,tools,vendor,.update-venv,*.ini,*.po,*.pot
|
exclude=.venv,.git,.tox,build,dist,doc,*openstack/common*,*lib/python*,*egg,tools,vendor,.update-venv,*.ini,*.po,*.pot
|
||||||
max-complexity=24
|
max-complexity=24
|
||||||
|
|||||||
Reference in New Issue
Block a user