Fix D401 PEP8 violation.

Currently tox ignores D401 (401: First line should be in imperative mood).
This change removes it and make keystoneauth docstring compliantwith it.

Change-Id: I136cf810f47c4c19f29216907a63f226930b5082
Partial-Bug: 1570049
changes/44/305944/2
Navid Pustchi 7 years ago
parent 99e74ad7a5
commit aabc213040
  1. 2
      keystone/assignment/V8_backends/sql.py
  2. 2
      keystone/assignment/backends/sql.py
  3. 12
      keystone/assignment/controllers.py
  4. 50
      keystone/assignment/core.py
  5. 2
      keystone/auth/controllers.py
  6. 8
      keystone/catalog/controllers.py
  7. 24
      keystone/catalog/core.py
  8. 2
      keystone/common/config.py
  9. 20
      keystone/common/controller.py
  10. 2
      keystone/common/dependency.py
  11. 2
      keystone/common/driver_hints.py
  12. 16
      keystone/common/ldap/core.py
  13. 18
      keystone/common/sql/core.py
  14. 2
      keystone/common/sql/migrate_repo/versions/073_insert_assignment_inherited_pk.py
  15. 2
      keystone/common/sql/migration_helpers.py
  16. 6
      keystone/common/utils.py
  17. 12
      keystone/common/wsgi.py
  18. 4
      keystone/contrib/s3/core.py
  19. 10
      keystone/credential/core.py
  20. 2
      keystone/endpoint_policy/backends/sql.py
  21. 16
      keystone/endpoint_policy/core.py
  22. 2
      keystone/exception.py
  23. 2
      keystone/federation/controllers.py
  24. 2
      keystone/federation/utils.py
  25. 24
      keystone/identity/backends/base.py
  26. 2
      keystone/identity/backends/ldap.py
  27. 2
      keystone/identity/controllers.py
  28. 14
      keystone/identity/core.py
  29. 6
      keystone/identity/mapping_backends/base.py
  30. 4
      keystone/identity/shadow_backends/base.py
  31. 2
      keystone/identity/shadow_backends/sql.py
  32. 2
      keystone/middleware/core.py
  33. 2
      keystone/models/revoke_model.py
  34. 4
      keystone/notifications.py
  35. 2
      keystone/policy/backends/rules.py
  36. 2
      keystone/resource/controllers.py
  37. 44
      keystone/resource/core.py
  38. 2
      keystone/revoke/core.py
  39. 2
      keystone/server/eventlet.py
  40. 8
      keystone/tests/hacking/checks.py
  41. 2
      keystone/tests/unit/assignment/test_backends.py
  42. 2
      keystone/tests/unit/backend/core_ldap.py
  43. 2
      keystone/tests/unit/backend/legacy_drivers/federation/V8/api_v3.py
  44. 8
      keystone/tests/unit/common/test_ldap.py
  45. 2
      keystone/tests/unit/contrib/federation/test_utils.py
  46. 8
      keystone/tests/unit/core.py
  47. 6
      keystone/tests/unit/fakeldap.py
  48. 4
      keystone/tests/unit/ksfixtures/appserver.py
  49. 12
      keystone/tests/unit/resource/test_backends.py
  50. 8
      keystone/tests/unit/rest.py
  51. 2
      keystone/tests/unit/test_associate_project_endpoint_extension.py
  52. 2
      keystone/tests/unit/test_auth.py
  53. 4
      keystone/tests/unit/test_backend_ldap.py
  54. 4
      keystone/tests/unit/test_backend_sql.py
  55. 4
      keystone/tests/unit/test_exception.py
  56. 2
      keystone/tests/unit/test_hacking_checks.py
  57. 2
      keystone/tests/unit/test_middleware.py
  58. 8
      keystone/tests/unit/test_sql_upgrade.py
  59. 4
      keystone/tests/unit/test_url_middleware.py
  60. 6
      keystone/tests/unit/test_v2.py
  61. 4
      keystone/tests/unit/test_v2_controller.py
  62. 18
      keystone/tests/unit/test_v3_assignment.py
  63. 4
      keystone/tests/unit/test_v3_catalog.py
  64. 16
      keystone/tests/unit/test_v3_federation.py
  65. 2
      keystone/tests/unit/test_v3_identity.py
  66. 2
      keystone/tests/unit/test_v3_protection.py
  67. 2
      keystone/tests/unit/test_v3_resource.py
  68. 4
      keystone/tests/unit/test_validation.py
  69. 2
      keystone/tests/unit/test_versions.py
  70. 4
      keystone/tests/unit/test_wsgi.py
  71. 2
      keystone/tests/unit/token/test_fernet_provider.py
  72. 6
      keystone/token/controllers.py
  73. 6
      keystone/token/persistence/backends/sql.py
  74. 8
      keystone/token/persistence/core.py
  75. 2
      keystone/token/providers/common.py
  76. 4
      keystone/token/providers/fernet/token_formatters.py
  77. 2
      keystone/trust/controllers.py
  78. 2
      keystone/version/controllers.py
  79. 2
      keystone/version/service.py
  80. 3
      tox.ini

@ -301,7 +301,7 @@ class Assignment(keystone_assignment.AssignmentDriverV8):
return [AssignmentType.USER_DOMAIN, AssignmentType.GROUP_DOMAIN]
def _get_assignment_types(self, user, group, project, domain):
"""Returns a list of role assignment types based on provided entities
"""Return a list of role assignment types based on provided entities
If one of user or group (the "actor") as well as one of project or
domain (the "target") are provided, the list will contain the role

@ -151,7 +151,7 @@ class Assignment(keystone_assignment.AssignmentDriverV9):
return [AssignmentType.USER_DOMAIN, AssignmentType.GROUP_DOMAIN]
def _get_assignment_types(self, user, group, project, domain):
"""Returns a list of role assignment types based on provided entities
"""Return a list of role assignment types based on provided entities
If one of user or group (the "actor") as well as one of project or
domain (the "target") are provided, the list will contain the role

@ -218,7 +218,7 @@ class RoleAssignmentV2(controller.V2Controller):
# COMPAT(diablo): CRUD extension
@controller.v2_deprecated
def create_role_ref(self, context, user_id, role):
"""This is actually used for adding a user to a tenant.
"""Used for adding a user to a tenant.
In the legacy data model adding a user to a tenant required setting
a role.
@ -237,7 +237,7 @@ class RoleAssignmentV2(controller.V2Controller):
# COMPAT(diablo): CRUD extension
@controller.v2_deprecated
def delete_role_ref(self, context, user_id, role_ref_id):
"""This is actually used for deleting a user from a tenant.
"""Used for deleting a user from a tenant.
In the legacy data model removing a user from a tenant required
deleting a role.
@ -616,7 +616,7 @@ class GrantAssignmentV3(controller.V3Controller):
@controller.protected(callback=_check_grant_protection)
def create_grant(self, context, role_id, user_id=None,
group_id=None, domain_id=None, project_id=None):
"""Grants a role to a user or group on either a domain or project."""
"""Grant a role to a user or group on either a domain or project."""
self._require_domain_xor_project(domain_id, project_id)
self._require_user_xor_group(user_id, group_id)
@ -627,7 +627,7 @@ class GrantAssignmentV3(controller.V3Controller):
@controller.protected(callback=_check_grant_protection)
def list_grants(self, context, user_id=None,
group_id=None, domain_id=None, project_id=None):
"""Lists roles granted to user/group on either a domain or project."""
"""List roles granted to user/group on either a domain or project."""
self._require_domain_xor_project(domain_id, project_id)
self._require_user_xor_group(user_id, group_id)
@ -639,7 +639,7 @@ class GrantAssignmentV3(controller.V3Controller):
@controller.protected(callback=_check_grant_protection)
def check_grant(self, context, role_id, user_id=None,
group_id=None, domain_id=None, project_id=None):
"""Checks if a role has been granted on either a domain or project."""
"""Check if a role has been granted on either a domain or project."""
self._require_domain_xor_project(domain_id, project_id)
self._require_user_xor_group(user_id, group_id)
@ -654,7 +654,7 @@ class GrantAssignmentV3(controller.V3Controller):
_check_grant_protection, allow_no_user=True))
def revoke_grant(self, context, role_id, user_id=None,
group_id=None, domain_id=None, project_id=None):
"""Revokes a role from user/group on either a domain or project."""
"""Revoke a role from user/group on either a domain or project."""
self._require_domain_xor_project(domain_id, project_id)
self._require_user_xor_group(user_id, group_id)

@ -435,7 +435,7 @@ class Manager(manager.Manager):
def _expand_indirect_assignment(self, ref, user_id=None, project_id=None,
subtree_ids=None, expand_groups=True):
"""Returns a list of expanded role assignments.
"""Return a list of expanded role assignments.
This methods is called for each discovered assignment that either needs
a group assignment expanded into individual user assignments, or needs
@ -457,7 +457,7 @@ class Manager(manager.Manager):
"""
def create_group_assignment(base_ref, user_id):
"""Creates a group assignment from the provided ref."""
"""Create a group assignment from the provided ref."""
ref = copy.deepcopy(base_ref)
ref['user_id'] = user_id
@ -468,7 +468,7 @@ class Manager(manager.Manager):
return ref
def expand_group_assignment(ref, user_id):
"""Expands group role assignment.
"""Expand group role assignment.
For any group role assignment on a target, it is replaced by a list
of role assignments containing one for each user of that group on
@ -511,7 +511,7 @@ class Manager(manager.Manager):
def expand_inherited_assignment(ref, user_id, project_id, subtree_ids,
expand_groups):
"""Expands inherited role assignments.
"""Expand inherited role assignments.
If expand_groups is True and this is a group role assignment on a
target, replace it by a list of role assignments containing one for
@ -561,7 +561,7 @@ class Manager(manager.Manager):
"""
def create_inherited_assignment(base_ref, project_id):
"""Creates a project assignment from the provided ref.
"""Create a project assignment from the provided ref.
base_ref can either be a project or domain inherited
assignment ref.
@ -1130,7 +1130,7 @@ class AssignmentDriverBase(object):
def create_grant(self, role_id, user_id=None, group_id=None,
domain_id=None, project_id=None,
inherited_to_projects=False):
"""Creates a new assignment/grant.
"""Create a new assignment/grant.
If the assignment is to a domain, then optionally it may be
specified as inherited to owned projects (this requires
@ -1143,14 +1143,14 @@ class AssignmentDriverBase(object):
def list_grant_role_ids(self, user_id=None, group_id=None,
domain_id=None, project_id=None,
inherited_to_projects=False):
"""Lists role ids for assignments/grants."""
"""List role ids for assignments/grants."""
raise exception.NotImplemented() # pragma: no cover
@abc.abstractmethod
def check_grant_role_id(self, role_id, user_id=None, group_id=None,
domain_id=None, project_id=None,
inherited_to_projects=False):
"""Checks an assignment/grant role id.
"""Check an assignment/grant role id.
:raises keystone.exception.RoleAssignmentNotFound: If the role
assignment doesn't exist.
@ -1163,7 +1163,7 @@ class AssignmentDriverBase(object):
def delete_grant(self, role_id, user_id=None, group_id=None,
domain_id=None, project_id=None,
inherited_to_projects=False):
"""Deletes assignments/grants.
"""Delete assignments/grants.
:raises keystone.exception.RoleAssignmentNotFound: If the role
assignment doesn't exist.
@ -1176,7 +1176,7 @@ class AssignmentDriverBase(object):
user_id=None, group_ids=None,
domain_id=None, project_ids=None,
inherited_to_projects=None):
"""Returns a list of role assignments for actors on targets.
"""Return a list of role assignments for actors on targets.
Available parameters represent values in which the returned role
assignments attributes need to be filtered on.
@ -1186,7 +1186,7 @@ class AssignmentDriverBase(object):
@abc.abstractmethod
def delete_project_assignments(self, project_id):
"""Deletes all assignments for a project.
"""Delete all assignments for a project.
:raises keystone.exception.ProjectNotFound: If the project doesn't
exist.
@ -1196,12 +1196,12 @@ class AssignmentDriverBase(object):
@abc.abstractmethod
def delete_role_assignments(self, role_id):
"""Deletes all assignments for a role."""
"""Delete all assignments for a role."""
raise exception.NotImplemented() # pragma: no cover
@abc.abstractmethod
def delete_user_assignments(self, user_id):
"""Deletes all assignments for a user.
"""Delete all assignments for a user.
:raises keystone.exception.RoleNotFound: If the role doesn't exist.
@ -1210,7 +1210,7 @@ class AssignmentDriverBase(object):
@abc.abstractmethod
def delete_group_assignments(self, group_id):
"""Deletes all assignments for a group.
"""Delete all assignments for a group.
:raises keystone.exception.RoleNotFound: If the role doesn't exist.
@ -1230,7 +1230,7 @@ class AssignmentDriverV8(AssignmentDriverBase):
@abc.abstractmethod
def list_user_ids_for_project(self, tenant_id):
"""Lists all user IDs with a role assignment in the specified project.
"""List all user IDs with a role assignment in the specified project.
:returns: a list of user_ids or an empty set.
@ -1355,7 +1355,7 @@ class AssignmentDriverV9(AssignmentDriverBase):
@abc.abstractmethod
def delete_domain_assignments(self, domain_id):
"""Deletes all assignments for a domain."""
"""Delete all assignments for a domain."""
raise exception.NotImplemented()
@ -1390,7 +1390,7 @@ class V9AssignmentWrapperForV8Driver(AssignmentDriverV9):
self.driver = wrapped_driver
def delete_domain_assignments(self, domain_id):
"""Deletes all assignments for a domain."""
"""Delete all assignments for a domain."""
msg = _LW('delete_domain_assignments method not found in custom '
'assignment driver. Domain assignments for domain (%s) to '
'users from other domains will not be removed. This was '
@ -1561,7 +1561,7 @@ class RoleDriverBase(object):
@abc.abstractmethod
def create_role(self, role_id, role):
"""Creates a new role.
"""Create a new role.
:raises keystone.exception.Conflict: If a duplicate role exists.
@ -1606,7 +1606,7 @@ class RoleDriverBase(object):
@abc.abstractmethod
def update_role(self, role_id, role):
"""Updates an existing role.
"""Update an existing role.
:raises keystone.exception.RoleNotFound: If the role doesn't exist.
:raises keystone.exception.Conflict: If a duplicate role exists.
@ -1616,7 +1616,7 @@ class RoleDriverBase(object):
@abc.abstractmethod
def delete_role(self, role_id):
"""Deletes an existing role.
"""Delete an existing role.
:raises keystone.exception.RoleNotFound: If the role doesn't exist.
@ -1647,7 +1647,7 @@ class RoleDriverV9(RoleDriverBase):
@abc.abstractmethod
def get_implied_role(self, prior_role_id, implied_role_id):
"""Fetches a role inference rule
"""Fetche a role inference rule
:raises keystone.exception.ImpliedRoleNotFound: If the implied role
doesn't exist.
@ -1657,7 +1657,7 @@ class RoleDriverV9(RoleDriverBase):
@abc.abstractmethod
def create_implied_role(self, prior_role_id, implied_role_id):
"""Creates a role inference rule
"""Create a role inference rule
:raises: keystone.exception.RoleNotFound: If the role doesn't exist.
@ -1666,7 +1666,7 @@ class RoleDriverV9(RoleDriverBase):
@abc.abstractmethod
def delete_implied_role(self, prior_role_id, implied_role_id):
"""Deletes a role inference rule
"""Delete a role inference rule
:raises keystone.exception.ImpliedRoleNotFound: If the implied role
doesn't exist.
@ -1676,12 +1676,12 @@ class RoleDriverV9(RoleDriverBase):
@abc.abstractmethod
def list_role_inference_rules(self):
"""Lists all the rules used to imply one role from another"""
"""List all the rules used to imply one role from another"""
raise exception.NotImplemented() # pragma: no cover
@abc.abstractmethod
def list_implied_roles(self, prior_role_id):
"""Lists roles implied from the prior role ID"""
"""List roles implied from the prior role ID"""
raise exception.NotImplemented() # pragma: no cover

@ -305,7 +305,7 @@ class AuthInfo(object):
self._validate_and_normalize_scope_data()
def get_method_names(self):
"""Returns the identity method names.
"""Return the identity method names.
:returns: list of auth method names

@ -408,7 +408,7 @@ class EndpointFilterV3Controller(controller.V3Controller):
@controller.protected()
def add_endpoint_to_project(self, context, project_id, endpoint_id):
"""Establishes an association between an endpoint and a project."""
"""Establish an association between an endpoint and a project."""
# NOTE(gyee): we just need to make sure endpoint and project exist
# first. We don't really care whether if project is disabled.
# The relationship can still be established even with a disabled
@ -420,7 +420,7 @@ class EndpointFilterV3Controller(controller.V3Controller):
@controller.protected()
def check_endpoint_in_project(self, context, project_id, endpoint_id):
"""Verifies endpoint is currently associated with given project."""
"""Verify endpoint is currently associated with given project."""
self.catalog_api.get_endpoint(endpoint_id)
self.resource_api.get_project(project_id)
self.catalog_api.check_endpoint_in_project(endpoint_id,
@ -474,7 +474,7 @@ class EndpointGroupV3Controller(controller.V3Controller):
@controller.protected()
@validation.validated(schema.endpoint_group_create, 'endpoint_group')
def create_endpoint_group(self, context, endpoint_group):
"""Creates an Endpoint Group with the associated filters."""
"""Create an Endpoint Group with the associated filters."""
ref = self._assign_unique_id(self._normalize_dict(endpoint_group))
self._require_attribute(ref, 'filters')
self._require_valid_filter(ref)
@ -590,7 +590,7 @@ class ProjectEndpointGroupV3Controller(controller.V3Controller):
@controller.protected()
def add_endpoint_group_to_project(self, context, endpoint_group_id,
project_id):
"""Creates an association between an endpoint group and project."""
"""Create an association between an endpoint group and project."""
self.resource_api.get_project(project_id)
self.catalog_api.get_endpoint_group(endpoint_group_id)
self.catalog_api.add_endpoint_group_to_project(

@ -56,7 +56,7 @@ MEMOIZE_COMPUTED_CATALOG = cache.get_memoization_decorator(
def format_url(url, substitutions, silent_keyerror_failures=None):
"""Formats a user-defined URL with the given substitutions.
"""Format a user-defined URL with the given substitutions.
:param string url: the URL to be formatted
:param dict substitutions: the dictionary used for substitution
@ -409,7 +409,7 @@ class CatalogDriverV8(object):
@abc.abstractmethod
def create_region(self, region_ref):
"""Creates a new region.
"""Create a new region.
:raises keystone.exception.Conflict: If the region already exists.
:raises keystone.exception.RegionNotFound: If the parent region
@ -453,7 +453,7 @@ class CatalogDriverV8(object):
@abc.abstractmethod
def delete_region(self, region_id):
"""Deletes an existing region.
"""Delete an existing region.
:raises keystone.exception.RegionNotFound: If the region doesn't exist.
@ -462,7 +462,7 @@ class CatalogDriverV8(object):
@abc.abstractmethod
def create_service(self, service_id, service_ref):
"""Creates a new service.
"""Create a new service.
:raises keystone.exception.Conflict: If a duplicate service exists.
@ -506,7 +506,7 @@ class CatalogDriverV8(object):
@abc.abstractmethod
def delete_service(self, service_id):
"""Deletes an existing service.
"""Delete an existing service.
:raises keystone.exception.ServiceNotFound: If the service doesn't
exist.
@ -516,7 +516,7 @@ class CatalogDriverV8(object):
@abc.abstractmethod
def create_endpoint(self, endpoint_id, endpoint_ref):
"""Creates a new endpoint for a service.
"""Create a new endpoint for a service.
:raises keystone.exception.Conflict: If a duplicate endpoint exists.
:raises keystone.exception.ServiceNotFound: If the service doesn't
@ -564,7 +564,7 @@ class CatalogDriverV8(object):
@abc.abstractmethod
def delete_endpoint(self, endpoint_id):
"""Deletes an endpoint for a service.
"""Delete an endpoint for a service.
:raises keystone.exception.EndpointNotFound: If the endpoint doesn't
exist.
@ -677,7 +677,7 @@ class CatalogDriverV8(object):
@abc.abstractmethod
def remove_endpoint_from_project(self, endpoint_id, project_id):
"""Removes an endpoint to project association.
"""Remove an endpoint to project association.
:param endpoint_id: identity of endpoint to remove
:type endpoint_id: string
@ -692,7 +692,7 @@ class CatalogDriverV8(object):
@abc.abstractmethod
def check_endpoint_in_project(self, endpoint_id, project_id):
"""Checks if an endpoint is associated with a project.
"""Check if an endpoint is associated with a project.
:param endpoint_id: identity of endpoint to check
:type endpoint_id: string
@ -729,7 +729,7 @@ class CatalogDriverV8(object):
@abc.abstractmethod
def delete_association_by_endpoint(self, endpoint_id):
"""Removes all the endpoints to project association with endpoint.
"""Remove all the endpoints to project association with endpoint.
:param endpoint_id: identity of endpoint to check
:type endpoint_id: string
@ -740,7 +740,7 @@ class CatalogDriverV8(object):
@abc.abstractmethod
def delete_association_by_project(self, project_id):
"""Removes all the endpoints to project association with project.
"""Remove all the endpoints to project association with project.
:param project_id: identity of the project to check
:type project_id: string
@ -805,7 +805,7 @@ class CatalogDriverV8(object):
@abc.abstractmethod
def add_endpoint_group_to_project(self, endpoint_group_id, project_id):
"""Adds an endpoint group to project association.
"""Add an endpoint group to project association.
:param endpoint_group_id: identity of endpoint to associate
:type endpoint_group_id: string

@ -1138,7 +1138,7 @@ def set_default_for_default_log_levels():
def setup_logging():
"""Sets up logging for the keystone package."""
"""Set up logging for the keystone package."""
log.setup(CONF, 'keystone')
logging.captureWarnings(True)

@ -108,7 +108,7 @@ def _build_policy_check_credentials(self, action, context, kwargs):
def protected(callback=None):
"""Wraps API calls with role based access controls (RBAC).
"""Wrap API calls with role based access controls (RBAC).
This handles both the protection of the API parameters as well as any
target entities for single-entity API calls.
@ -184,7 +184,7 @@ def protected(callback=None):
def filterprotected(*filters, **callback):
"""Wraps API list calls with role based access controls (RBAC).
"""Wrap API list calls with role based access controls (RBAC).
This handles both the protection of the API parameters as well as any
filters supplied.
@ -288,7 +288,7 @@ class V2Controller(wsgi.Application):
@staticmethod
def normalize_username_in_response(ref):
"""Adds username to outgoing user refs to match the v2 spec.
"""Add username to outgoing user refs to match the v2 spec.
Internally we use `name` to represent a user's name. The v2 spec
requires the use of `username` instead.
@ -300,7 +300,7 @@ class V2Controller(wsgi.Application):
@staticmethod
def normalize_username_in_request(ref):
"""Adds name in incoming user refs to match the v2 spec.
"""Add name in incoming user refs to match the v2 spec.
Internally we use `name` to represent a user's name. The v2 spec
requires the use of `username` instead.
@ -527,7 +527,7 @@ class V3Controller(wsgi.Application):
@classmethod
def limit(cls, refs, hints):
"""Limits a list of entities.
"""Limit a list of entities.
The underlying driver layer may have already truncated the collection
for us, but in case it was unable to handle truncation we check here.
@ -560,9 +560,9 @@ class V3Controller(wsgi.Application):
@classmethod
def filter_by_attributes(cls, refs, hints):
"""Filters a list of references by filter values."""
"""Filter a list of references by filter values."""
def _attr_match(ref_attr, val_attr):
"""Matches attributes allowing for booleans as strings.
"""Matche attributes allowing for booleans as strings.
We test explicitly for a value that defines it as 'False',
which also means that the existence of the attribute with
@ -575,7 +575,7 @@ class V3Controller(wsgi.Application):
return ref_attr == val_attr
def _inexact_attr_match(filter, ref):
"""Applies an inexact filter to a result dict.
"""Apply an inexact filter to a result dict.
:param filter: the filter in question
:param ref: the dict to check
@ -678,7 +678,7 @@ class V3Controller(wsgi.Application):
return hints
def _require_matching_id(self, value, ref):
"""Ensures the value matches the reference's ID, if any."""
"""Ensure the value matches the reference's ID, if any."""
if 'id' in ref and ref['id'] != value:
raise exception.ValidationError('Cannot change ID')
@ -705,7 +705,7 @@ class V3Controller(wsgi.Application):
raise exception.ValidationError(_('Cannot change Domain ID'))
def _assign_unique_id(self, ref):
"""Generates and assigns a unique identifier to a reference."""
"""Generate and assigns a unique identifier to a reference."""
ref = ref.copy()
ref['id'] = uuid.uuid4().hex
return ref

@ -173,7 +173,7 @@ def requires(*dependencies):
def resolve_future_dependencies(__provider_name=None):
"""Forces injection of all dependencies.
"""Force injection of all dependencies.
Before this function is called, circular dependencies may not have been
injected. This function should be called only once, after all global

@ -97,7 +97,7 @@ class Hints(object):
def add_filter(self, name, value, comparator='equals',
case_sensitive=False):
"""Adds a filter to the filters list, which is publicly accessible."""
"""Add a filter to the filters list, which is publicly accessible."""
self.filters.append({'name': name, 'value': value,
'comparator': comparator,
'case_sensitive': case_sensitive,

@ -235,7 +235,7 @@ def prep_case_insensitive(value):
def is_ava_value_equal(attribute_type, val1, val2):
"""Returns True if and only if the AVAs are equal.
"""Return True if and only if the AVAs are equal.
When comparing AVAs, the equality matching rule for the attribute type
should be taken into consideration. For simplicity, this implementation
@ -249,7 +249,7 @@ def is_ava_value_equal(attribute_type, val1, val2):
def is_rdn_equal(rdn1, rdn2):
"""Returns True if and only if the RDNs are equal.
"""Return True if and only if the RDNs are equal.
* RDNs must have the same number of AVAs.
* Each AVA of the RDNs must be the equal for the same attribute type. The
@ -284,7 +284,7 @@ def is_rdn_equal(rdn1, rdn2):
def is_dn_equal(dn1, dn2):
"""Returns True if and only if the DNs are equal.
"""Return True if and only if the DNs are equal.
Two DNs are equal if they've got the same number of RDNs and if the RDNs
are the same at each position. See RFC4517.
@ -311,7 +311,7 @@ def is_dn_equal(dn1, dn2):
def dn_startswith(descendant_dn, dn):
"""Returns True if and only if the descendant_dn is under the dn.
"""Return True if and only if the descendant_dn is under the dn.
:param descendant_dn: Either a string DN or a DN parsed by ldap.dn.str2dn.
:param dn: Either a string DN or a DN parsed by ldap.dn.str2dn.
@ -777,7 +777,7 @@ class PooledLDAPHandler(LDAPHandler):
filterstr='(objectClass=*)', attrlist=None, attrsonly=0,
serverctrls=None, clientctrls=None,
timeout=-1, sizelimit=0):
"""Asynchronous API to return a ``MsgId`` instance.
"""Return a ``MsgId`` instance, it asynchronous API.
The ``MsgId`` instance can be safely used in a call to ``result3()``.
@ -805,7 +805,7 @@ class PooledLDAPHandler(LDAPHandler):
def result3(self, msgid, all=1, timeout=None,
resp_ctrl_classes=None):
"""This method is used to wait for and return result.
"""Wait for and return the result.
This method returns the result of an operation previously initiated by
one of the LDAP asynchronous operation routines (eg search_ext()). It
@ -1238,7 +1238,7 @@ class BaseLdap(object):
return mapping
def _is_dumb_member(self, member_dn):
"""Checks that member is a dumb member.
"""Check that member is a dumb member.
:param member_dn: DN of member to be checked.
"""
@ -1709,7 +1709,7 @@ class BaseLdap(object):
'dots': '...' if len(not_deleted_nodes) > 3 else ''})
def filter_query(self, hints, query=None):
"""Applies filtering to a query.
"""Apply filtering to a query.
:param hints: contains the list of filters, which may be None,
indicating that there are no filters to be applied.

@ -130,7 +130,7 @@ class DictBase(models.ModelBase):
return cls(**new_d)
def to_dict(self, include_extra_dict=False):
"""Returns the model's attributes as a dictionary.
"""Return the model's attributes as a dictionary.
If include_extra_dict is True, 'extra' attributes are literally
included in the resulting dictionary twice, for backwards-compatibility
@ -156,11 +156,11 @@ class ModelDictMixin(object):
@classmethod
def from_dict(cls, d):
"""Returns a model instance from a dictionary."""
"""Return a model instance from a dictionary."""
return cls(**d)
def to_dict(self):
"""Returns the model's attributes as a dictionary."""
"""Return the model's attributes as a dictionary."""
names = (column.name for column in self.__table__.columns)
return {name: getattr(self, name) for name in names}
@ -259,7 +259,7 @@ class _WontMatch(Exception):
def _filter(model, query, hints):
"""Applies filtering to a query.
"""Apply filtering to a query.
:param model: the table model in question
:param query: query to apply filters to
@ -271,7 +271,7 @@ def _filter(model, query, hints):
"""
def inexact_filter(model, query, filter_, satisfied_filters):
"""Applies an inexact filter to a query.
"""Apply an inexact filter to a query.
:param model: the table model in question
:param query: query to apply filters to
@ -312,7 +312,7 @@ def _filter(model, query, hints):
return query.filter(query_term)
def exact_filter(model, query, filter_, satisfied_filters):
"""Applies an exact filter to a query.
"""Apply an exact filter to a query.
:param model: the table model in question
:param query: query to apply filters to
@ -357,7 +357,7 @@ def _filter(model, query, hints):
def _limit(query, hints):
"""Applies a limit to a query.
"""Apply a limit to a query.
:param query: query to apply filters to
:param hints: contains the list of filters and limit details.
@ -375,7 +375,7 @@ def _limit(query, hints):
def filter_limit_query(model, query, hints):
"""Applies filtering and limit to a query.
"""Apply filtering and limit to a query.
:param model: table model
:param query: query to apply filters to
@ -412,7 +412,7 @@ def filter_limit_query(model, query, hints):
def handle_conflicts(conflict_type='object'):
"""Converts select sqlalchemy exceptions into HTTP 409 Conflict."""
"""Convert select sqlalchemy exceptions into HTTP 409 Conflict."""
_conflict_msg = 'Conflict %(conflict_type)s: %(details)s'
def decorator(method):

@ -18,7 +18,7 @@ from keystone.assignment.backends import sql as assignment_sql
def upgrade(migrate_engine):
"""Inserts inherited column to assignment table PK constraints.
"""Insert inherited column to assignment table PK constraints.
For non-SQLite databases, it changes the constraint in the existing table.

@ -95,7 +95,7 @@ def add_constraints(constraints):
def rename_tables_with_constraints(renames, constraints, engine):
"""Renames tables with foreign key constraints.
"""Rename tables with foreign key constraints.
Tables are renamed after first removing constraints. The constraints are
replaced after the rename is complete.

@ -51,7 +51,7 @@ RESOURCE_ID_NAMESPACE = uuid.UUID('4332ecab-770b-4288-a680-b9aca3b1b153')
def resource_uuid(value):
"""Converts input to valid UUID hex digits."""
"""Convert input to valid UUID hex digits."""
try:
uuid.UUID(value)
return value
@ -173,7 +173,7 @@ def check_password(password, hashed):
def attr_as_boolean(val_attr):
"""Returns the boolean value, decoded from a string.
"""Return the boolean value, decoded from a string.
We test explicitly for a value meaning False, which can be one of
several formats as specified in oslo strutils.FALSE_STRINGS.
@ -537,7 +537,7 @@ def strtime():
def get_token_ref(context):
"""Retrieves KeystoneToken object from the auth context and returns it.
"""Retrieve KeystoneToken object from the auth context and returns it.
:param dict context: The request context.
:raises keystone.exception.Unauthorized: If auth context cannot be found.

@ -113,7 +113,7 @@ def validate_token_bind(context, token_ref):
def best_match_language(req):
"""Determines the best available locale.
"""Determine the best available locale.
This returns best available locale based on the Accept-Language HTTP
header passed in the request.
@ -153,7 +153,7 @@ class BaseApplication(object):
return cls(**local_config)
def __call__(self, environ, start_response):
r"""Subclasses will probably want to implement __call__ like this:
r"""Provide subclasses how to implement __call__, probably like this:
@webob.dec.wsgify()
def __call__(self, req):
@ -333,7 +333,7 @@ class Application(BaseApplication):
return ref.get(attribute) is None or ref.get(attribute) == ''
def _require_attribute(self, ref, attribute):
"""Ensures the reference contains the specified attribute.
"""Ensure the reference contains the specified attribute.
Raise a ValidationError if the given attribute is not present
"""
@ -342,7 +342,7 @@ class Application(BaseApplication):
raise exception.ValidationError(message=msg)
def _require_attributes(self, ref, attrs):
"""Ensures the reference contains the specified attributes.
"""Ensure the reference contains the specified attributes.
Raise a ValidationError if any of the given attributes is not present
"""
@ -726,7 +726,7 @@ class V3ExtensionRouter(ExtensionRouter, RoutersBase):
def render_response(body=None, status=None, headers=None, method=None):
"""Forms a WSGI response."""
"""Form a WSGI response."""
if headers is None:
headers = []
else:
@ -801,7 +801,7 @@ def render_response(body=None, status=None, headers=None, method=None):
def render_exception(error, context=None, request=None, user_locale=None):
"""Forms a WSGI response based on the current error."""
"""Form a WSGI response based on the current error."""
error_message = error.args[0]
message = oslo_i18n.translate(error_message, desired_locale=user_locale)
if message is error_message:

@ -82,7 +82,7 @@ class S3Controller(controllers.Ec2Controller):
message=_('Credential signature mismatch'))
def _calculate_signature_v1(self, string_to_sign, secret_key):
"""Calculates a v1 signature.
"""Calculate a v1 signature.
:param bytes string_to_sign: String that contains request params and
is used for calculate signature of request
@ -99,7 +99,7 @@ class S3Controller(controllers.Ec2Controller):
return signed
def _calculate_signature_v4(self, string_to_sign, secret_key):
"""Calculates a v4 signature.
"""Calculate a v4 signature.
:param bytes string_to_sign: String that contains request params and
is used for calculate signature of request

@ -56,7 +56,7 @@ class CredentialDriverV8(object):
@abc.abstractmethod
def create_credential(self, credential_id, credential):
"""Creates a new credential.
"""Create a new credential.
:raises keystone.exception.Conflict: If a duplicate credential exists.
@ -101,7 +101,7 @@ class CredentialDriverV8(object):
@abc.abstractmethod
def update_credential(self, credential_id, credential):
"""Updates an existing credential.
"""Update an existing credential.
:raises keystone.exception.CredentialNotFound: If credential doesn't
exist.
@ -112,7 +112,7 @@ class CredentialDriverV8(object):
@abc.abstractmethod
def delete_credential(self, credential_id):
"""Deletes an existing credential.
"""Delete an existing credential.
:raises keystone.exception.CredentialNotFound: If credential doesn't
exist.
@ -122,12 +122,12 @@ class CredentialDriverV8(object):
@abc.abstractmethod
def delete_credentials_for_project(self, project_id):
"""Deletes all credentials for a project."""
"""Delete all credentials for a project."""
self._delete_credentials(lambda cr: cr['project_id'] == project_id)
@abc.abstractmethod
def delete_credentials_for_user(self, user_id):
"""Deletes all credentials for a user."""
"""Delete all credentials for a user."""
self._delete_credentials(lambda cr: cr['user_id'] == user_id)
def _delete_credentials(self, match_fn):

@ -35,7 +35,7 @@ class PolicyAssociation(sql.ModelBase, sql.ModelDictMixin):
'region_id'),)
def to_dict(self):
"""Returns the model's attributes as a dictionary.
"""Return the model's attributes as a dictionary.
We override the standard method in order to hide the id column,
since this only exists to provide the table with a primary key.

@ -273,7 +273,7 @@ class EndpointPolicyDriverV8(object):
@abc.abstractmethod
def create_policy_association(self, policy_id, endpoint_id=None,
service_id=None, region_id=None):
"""Creates a policy association.
"""Create a policy association.
:param policy_id: identity of policy that is being associated
:type policy_id: string
@ -297,7 +297,7 @@ class EndpointPolicyDriverV8(object):
@abc.abstractmethod
def check_policy_association(self, policy_id, endpoint_id=None,
service_id=None, region_id=None):
"""Checks existence a policy association.
"""Check existence a policy association.
:param policy_id: identity of policy that is being associated
:type policy_id: string
@ -317,7 +317,7 @@ class EndpointPolicyDriverV8(object):
@abc.abstractmethod
def delete_policy_association(self, policy_id, endpoint_id=None,
service_id=None, region_id=None):
"""Deletes a policy association.
"""Delete a policy association.
:param policy_id: identity of policy that is being associated
:type policy_id: string
@ -335,7 +335,7 @@ class EndpointPolicyDriverV8(object):
@abc.abstractmethod
def get_policy_association(self, endpoint_id=None,
service_id=None, region_id=None):
"""Gets the policy for an explicit association.
"""Get the policy for an explicit association.
This method is not exposed as a public API, but is used by
get_policy_for_endpoint().
@ -393,7 +393,7 @@ class EndpointPolicyDriverV8(object):
@abc.abstractmethod
def delete_association_by_endpoint(self, endpoint_id):
"""Removes all the policy associations with the specific endpoint.
"""Remove all the policy associations with the specific endpoint.
:param endpoint_id: identity of endpoint to check
:type endpoint_id: string
@ -404,7 +404,7 @@ class EndpointPolicyDriverV8(object):
@abc.abstractmethod
def delete_association_by_service(self, service_id):
"""Removes all the policy associations with the specific service.
"""Remove all the policy associations with the specific service.
:param service_id: identity of endpoint to check
:type service_id: string
@ -415,7 +415,7 @@ class EndpointPolicyDriverV8(object):
@abc.abstractmethod
def delete_association_by_region(self, region_id):
"""Removes all the policy associations with the specific region.
"""Remove all the policy associations with the specific region.
:param region_id: identity of endpoint to check
:type region_id: string
@ -426,7 +426,7 @@ class EndpointPolicyDriverV8(object):
@abc.abstractmethod
def delete_association_by_policy(self, policy_id):
"""Removes all the policy associations with the specific policy.
"""Remove all the policy associations with the specific policy.
:param policy_id: identity of endpoint to check
:type policy_id: string

@ -69,7 +69,7 @@ class Error(Exception):
super(Error, self).__init__(message)
def _build_message(self, message, **kwargs):
"""Builds and returns an exception message.
"""Build and returns an exception message.
:raises KeyError: given insufficient kwargs

@ -330,7 +330,7 @@ class Auth(auth_controllers.Auth):
return self.render_html_response(host, token_id)
def render_html_response(self, host, token_id):
"""Forms an HTML Form from a template with autosubmit."""
"""Form an HTML Form from a template with autosubmit."""
headers = [('Content-Type', 'text/html')]
with open(CONF.federation.sso_callback_template) as template:

@ -202,7 +202,7 @@ class DirectMaps(object):
self._matches = []
def add(self, values):
"""Adds a matched value to the list of matches.
"""Add a matched value to the list of matches.
:param list value: the match to save

@ -64,7 +64,7 @@ class IdentityDriverV8(object):
CONF.identity.list_limit or CONF.list_limit)
def is_domain_aware(self):
"""Indicates if Driver supports domains."""
"""Indicate if Driver supports domains."""
return True
def default_assignment_driver(self):
@ -74,7 +74,7 @@ class IdentityDriverV8(object):
@property
def is_sql(self):
"""Indicates if this Driver uses SQL."""
"""Indicate if this Driver uses SQL."""
return False
@property
@ -83,7 +83,7 @@ class IdentityDriverV8(object):
CONF.identity.domain_specific_drivers_enabled)
def generates_uuids(self):
"""Indicates if Driver generates UUIDs as the local entity ID."""
"""Indicate if Driver generates UUIDs as the local entity ID."""
return True
@abc.abstractmethod
@ -99,7 +99,7 @@ class IdentityDriverV8(object):
@abc.abstractmethod
def create_user(self, user_id, user):
"""Creates a new user.
"""Create a new user.
:raises keystone.exception.Conflict: If a duplicate user exists.
@ -143,7 +143,7 @@ class IdentityDriverV8(object):
@abc.abstractmethod
def update_user(self, user_id, user):
"""Updates an existing user.
"""Update an existing user.
:raises keystone.exception.UserNotFound: If the user doesn't exist.
:raises keystone.exception.Conflict: If a duplicate user exists.
@ -153,7 +153,7 @@ class IdentityDriverV8(object):
@abc.abstractmethod
def add_user_to_group(self, user_id, group_id):
"""Adds a user to a group.
"""Add a user to a group.
:raises keystone.exception.UserNotFound: If the user doesn't exist.
:raises keystone.exception.GroupNotFound: If the group doesn't exist.
@ -163,7 +163,7 @@ class IdentityDriverV8(object):
@abc.abstractmethod
def check_user_in_group(self, user_id, group_id):
"""Checks if a user is a member of a group.
"""Check if a user is a member of a group.
:raises keystone.exception.UserNotFound: If the user doesn't exist.
:raises keystone.exception.GroupNotFound: If the group doesn't exist.
@ -173,7 +173,7 @@ class IdentityDriverV8(object):
@abc.abstractmethod
def remove_user_from_group(self, user_id, group_id):
"""Removes a user from a group.
"""Remove a user from a group.
:raises