Fix H4xx docstring issues
Completes blueprint openstack-hacking-compliant Change-Id: Ib286972b65e0e3282db483718421f7f28e8c6cd1
This commit is contained in:
@@ -32,8 +32,10 @@ class TestDataContainer(object):
|
||||
|
||||
|
||||
class TestResponse(requests.Response):
|
||||
""" Class used to wrap requests.Response and provide some
|
||||
convenience to initialize with a dict """
|
||||
"""Class used to wrap requests.Response.
|
||||
|
||||
It also provides some convenience to initialize with a dict.
|
||||
"""
|
||||
|
||||
def __init__(self, data):
|
||||
self._text = None
|
||||
|
@@ -185,7 +185,8 @@ class User(models.AnonymousUser):
|
||||
return "<%s: %s>" % (self.__class__.__name__, self.username)
|
||||
|
||||
def is_token_expired(self):
|
||||
"""
|
||||
"""Determine if the token is expired.
|
||||
|
||||
Returns ``True`` if the token is expired, ``False`` if not, and
|
||||
``None`` if there is no token set.
|
||||
"""
|
||||
@@ -199,8 +200,9 @@ class User(models.AnonymousUser):
|
||||
utils.check_token_expiration(self.token))
|
||||
|
||||
def is_anonymous(self):
|
||||
"""
|
||||
Returns ``True`` if the user is not authenticated,``False`` otherwise.
|
||||
"""Return if the user is not authenticated.
|
||||
|
||||
Returns ``True`` if not authenticated,``False`` otherwise.
|
||||
"""
|
||||
return not self.is_authenticated()
|
||||
|
||||
@@ -210,9 +212,9 @@ class User(models.AnonymousUser):
|
||||
|
||||
@property
|
||||
def is_superuser(self):
|
||||
"""
|
||||
Evaluates whether this user has admin privileges. Returns
|
||||
``True`` or ``False``.
|
||||
"""Evaluates whether this user has admin privileges.
|
||||
|
||||
Returns ``True`` or ``False``.
|
||||
"""
|
||||
return 'admin' in [role['name'].lower() for role in self.roles]
|
||||
|
||||
@@ -243,9 +245,9 @@ class User(models.AnonymousUser):
|
||||
self._authorized_tenants = tenant_list
|
||||
|
||||
def default_services_region(self):
|
||||
"""
|
||||
Returns the first endpoint region for first non-identity service
|
||||
in the service catalog
|
||||
"""Returns the first endpoint region for first non-identity service.
|
||||
|
||||
Extracted from the service catalog.
|
||||
"""
|
||||
if self.service_catalog:
|
||||
for service in self.service_catalog:
|
||||
@@ -265,9 +267,7 @@ class User(models.AnonymousUser):
|
||||
|
||||
@property
|
||||
def available_services_regions(self):
|
||||
"""
|
||||
Returns list of unique region name values found in service catalog
|
||||
"""
|
||||
"""Returns list of unique region name values in service catalog."""
|
||||
regions = []
|
||||
if self.service_catalog:
|
||||
for service in self.service_catalog:
|
||||
@@ -289,10 +289,10 @@ class User(models.AnonymousUser):
|
||||
# Check for OR'd permission rules, check that user has one of the
|
||||
# required permission.
|
||||
def has_a_matching_perm(self, perm_list, obj=None):
|
||||
"""
|
||||
Returns True if the user has one of the specified permissions. If
|
||||
object is passed, it checks if the user has any of the required perms
|
||||
for this object.
|
||||
"""Returns True if the user has one of the specified permissions.
|
||||
|
||||
If object is passed, it checks if the user has any of the required
|
||||
perms for this object.
|
||||
"""
|
||||
# If there are no permissions to check, just return true
|
||||
if not perm_list:
|
||||
@@ -316,8 +316,8 @@ class User(models.AnonymousUser):
|
||||
# ('openstack.roles.admin', ('openstack.roles.L3-support',
|
||||
# 'openstack.roles.L2-support'),)
|
||||
def has_perms(self, perm_list, obj=None):
|
||||
"""
|
||||
Returns True if the user has all of the specified permissions.
|
||||
"""Returns True if the user has all of the specified permissions.
|
||||
|
||||
Tuples in the list will possess the required permissions if
|
||||
the user has a permissions matching one of the elements of
|
||||
that tuple
|
||||
|
@@ -80,10 +80,9 @@ def check_token_expiration(token):
|
||||
# Added in Django 1.4.3, 1.5b2
|
||||
# Vendored here for compatibility with old Django versions.
|
||||
def is_safe_url(url, host=None):
|
||||
"""
|
||||
Return ``True`` if the url is a safe redirection (i.e. it doesn't point to
|
||||
a different host).
|
||||
"""Return ``True`` if the url is a safe redirection.
|
||||
|
||||
The safe redirection means that it doesn't point to a different host.
|
||||
Always returns ``False`` on an empty url.
|
||||
"""
|
||||
if not url:
|
||||
|
@@ -188,9 +188,10 @@ def switch(request, tenant_id, redirect_field_name=auth.REDIRECT_FIELD_NAME):
|
||||
@login_required
|
||||
def switch_region(request, region_name,
|
||||
redirect_field_name=auth.REDIRECT_FIELD_NAME):
|
||||
"""
|
||||
Switches the non-identity services region that is being managed
|
||||
for the scoped project.
|
||||
"""Switches the user's region for all services except Identity service.
|
||||
|
||||
The region will be switched if the given region is one of the regions
|
||||
available for the scoped project. Otherwise the region is not switched.
|
||||
"""
|
||||
if region_name in request.user.available_services_regions:
|
||||
request.session['services_region'] = region_name
|
||||
|
3
tox.ini
3
tox.ini
@@ -41,9 +41,8 @@ downloadcache = ~/cache/pip
|
||||
[flake8]
|
||||
builtins = _
|
||||
exclude = .venv,.git,.tox,dist,doc,*openstack/common*,*lib/python*,*egg,build,panel_template,dash_template,local_settings.py
|
||||
# H4xx docstrings
|
||||
# H803 git commit title should not end with period (disabled on purpose, see bug #1236621)
|
||||
ignore = H4,H803
|
||||
ignore = H803
|
||||
|
||||
[hacking]
|
||||
import_exceptions = django.conf.settings,
|
||||
|
Reference in New Issue
Block a user