Use triple double-quoted strings for docstrings

Change-Id: I1bc612866b9fc98be7e702565ba249bda4a54785
Story: 2006136
Task: 35632
This commit is contained in:
fpxie 2019-07-01 15:10:59 +08:00
parent fd498c843c
commit 1f4769dafd
18 changed files with 71 additions and 71 deletions

View File

@ -28,11 +28,11 @@ ALLOWED_WITHOUT_AUTH = '/'
class RequestContext(base_context.RequestContext):
'''Stores information about the security context.
"""Stores information about the security context.
The context encapsulates information related to the user accessing the
the system, as well as additional request information.
'''
"""
def __init__(self, auth_token=None, user=None, project=None,
domain=None, user_domain=None, project_domain=None,
@ -43,7 +43,7 @@ class RequestContext(base_context.RequestContext):
auth_token_info=None, region_name=None, roles=None,
password=None, **kwargs):
'''Initializer of request context.'''
# Initializer of request context.
# We still have 'tenant' param because oslo_context still use it.
super(RequestContext, self).__init__(
auth_token=auth_token, user=user, tenant=project,
@ -123,7 +123,7 @@ def get_admin_context(show_deleted=False):
def get_service_context(**args):
'''An abstraction layer for getting service context.'''
"""An abstraction layer for getting service context."""
pass

View File

@ -18,11 +18,11 @@
# SPDX-License-Identifier: Apache-2.0
#
'''
"""
Interface for database access.
SQLAlchemy is currently the only supported backend.
'''
"""
from oslo_config import cfg
from oslo_db import api

View File

@ -35,15 +35,15 @@ CONF = cfg.CONF
def do_db_version():
'''Print database's current migration level.'''
"""Print database's current migration level."""
print(api.db_version(api.get_engine()))
def do_db_sync():
'''Place a database under migration control and upgrade.
"""Place a database under migration control and upgrade.
DB is created first if necessary.
'''
"""
api.db_sync(api.get_engine(), CONF.command.version)

View File

@ -30,11 +30,11 @@ ALLOWED_WITHOUT_AUTH = '/'
class RequestContext(base_context.RequestContext):
'''Stores information about the security context.
"""Stores information about the security context.
The context encapsulates information related to the user accessing the
the system, as well as additional request information.
'''
"""
def __init__(self, auth_token=None, user=None, project=None,
domain=None, user_domain=None, project_domain=None,
@ -45,7 +45,7 @@ class RequestContext(base_context.RequestContext):
auth_token_info=None, region_name=None, roles=None,
password=None, **kwargs):
'''Initializer of request context.'''
"""Initializer of request context."""
# We still have 'tenant' param because oslo_context still use it.
super(RequestContext, self).__init__(
auth_token=auth_token, user=user, tenant=project,
@ -125,14 +125,14 @@ def get_admin_context(show_deleted=False):
def get_service_context(**args):
'''An abstraction layer for getting service context.
"""An abstraction layer for getting service context.
There could be multiple cloud backends for dcmanager to use. This
abstraction layer provides an indirection for dcmanager to get the
credentials of 'dcmanager' user on the specific cloud. By default,
this credential refers to the credentials built for dcmanager middleware
in an OpenStack cloud.
'''
"""
pass

View File

@ -19,11 +19,11 @@
# of this software may be licensed only pursuant to the terms
# of an applicable Wind River license agreement.
#
'''
"""
Interface for database access.
SQLAlchemy is currently the only supported backend.
'''
"""
from oslo_config import cfg
from oslo_db import api

View File

@ -10,9 +10,9 @@
# License for the specific language governing permissions and limitations
# under the License.
'''
"""
Base class for all drivers.
'''
"""
import abc
import six
@ -25,7 +25,7 @@ LOG = logging.getLogger(__name__)
class DriverBase(object):
six.add_metaclass(abc.ABCMeta)
'''Base class for all drivers.'''
"""Base class for all drivers."""
def __init__(self, context):
self.context = context

View File

@ -30,7 +30,7 @@ wallclock = time.time
class ThreadGroupManager(object):
'''Thread group manager.'''
"""Thread group manager."""
def __init__(self):
super(ThreadGroupManager, self).__init__()
@ -38,15 +38,15 @@ class ThreadGroupManager(object):
self.group = threadgroup.ThreadGroup()
def start(self, func, *args, **kwargs):
'''Run the given method in a sub-thread.'''
"""Run the given method in a sub-thread."""
return self.group.add_thread(func, *args, **kwargs)
def add_timer(self, interval, func, *args, **kwargs):
'''Define a periodic task to be run in the thread group.
"""Define a periodic task to be run in the thread group.
The task will be executed in a separate green thread.
'''
"""
self.group.add_timer(interval, func, *args, **kwargs)
@ -54,7 +54,7 @@ class ThreadGroupManager(object):
self.group.stop_timers()
def stop(self, graceful=False):
'''Stop any active threads belong to this threadgroup.'''
"""Stop any active threads belong to this threadgroup."""
# Try to stop all threads gracefully
self.group.stop(graceful)
self.group.wait()
@ -74,10 +74,10 @@ class ThreadGroupManager(object):
def reschedule(action, sleep_time=1):
'''Eventlet Sleep for the specified number of seconds.
"""Eventlet Sleep for the specified number of seconds.
:param sleep_time: seconds to sleep; if None, no sleep;
'''
"""
if sleep_time is not None:
LOG.debug('Action %s sleep for %s seconds' % (
@ -86,6 +86,6 @@ def reschedule(action, sleep_time=1):
def sleep(sleep_time):
'''Interface for sleeping.'''
"""Interface for sleeping."""
eventlet.sleep(sleep_time)

View File

@ -17,9 +17,9 @@
# of an applicable Wind River license agreement.
#
'''
"""
Client side of the DC Manager RPC API.
'''
"""
from oslo_log import log as logging

View File

@ -28,15 +28,15 @@ CONF = cfg.CONF
def do_db_version():
'''Print database's current migration level.'''
"""Print database's current migration level."""
print(api.db_version(api.get_engine()))
def do_db_sync():
'''Place a database under migration control and upgrade.
"""Place a database under migration control and upgrade.
DB is created first if necessary.
'''
"""
api.db_sync(api.get_engine(), CONF.command.version)

View File

@ -23,11 +23,11 @@ ALLOWED_WITHOUT_AUTH = '/'
class RequestContext(base_context.RequestContext):
'''Stores information about the security context.
"""Stores information about the security context.
The context encapsulates information related to the user accessing the
the system, as well as additional request information.
'''
"""
def __init__(self, auth_token=None, user=None, project=None,
domain=None, user_domain=None, project_domain=None,
@ -38,7 +38,7 @@ class RequestContext(base_context.RequestContext):
auth_token_info=None, region_name=None, roles=None,
password=None, **kwargs):
'''Initializer of request context.'''
"""Initializer of request context."""
# We still have 'tenant' param because oslo_context still use it.
super(RequestContext, self).__init__(
auth_token=auth_token, user=user, tenant=project,
@ -118,14 +118,14 @@ def get_admin_context(show_deleted=False):
def get_service_context(**args):
'''An abstraction layer for getting service context.
"""An abstraction layer for getting service context.
There could be multiple cloud backends for dcorch-engine to use. This
abstraction layer provides an indirection for dcorch-engine to get the
credentials of 'dcorch' user on the specific cloud. By default,
this credential refers to the credentials built for keystone middleware
in an OpenStack cloud.
'''
"""
pass

View File

@ -10,9 +10,9 @@
# License for the specific language governing permissions and limitations
# under the License.
'''
"""
Base class for all drivers.
'''
"""
import abc
import six
@ -25,31 +25,31 @@ LOG = logging.getLogger(__name__)
class DriverBase(object):
six.add_metaclass(abc.ABCMeta)
'''Base class for all drivers.'''
"""Base class for all drivers."""
def __init__(self, context):
self.context = context
@abc.abstractmethod
def get_resource_usages(self, project_id):
'''Collects resource usages for a given project
"""Collects resource usages for a given project
:params: project_id
:return: dictionary of corresponding resources with its usage
'''
"""
@abc.abstractmethod
def update_quota_limits(self, project_id, new_quota):
'''Updates quota limits for a given project
"""Updates quota limits for a given project
:params: project_id, dictionary with the quota limits to update
:return: Nothing
'''
"""
@abc.abstractmethod
def delete_quota_limits(self, project_id):
'''Delete quota limits for a given project
"""Delete quota limits for a given project
:params: project_id
:return: Nothing
'''
"""

View File

@ -23,7 +23,7 @@ API_VERSION = '2'
class CinderClient(base.DriverBase):
'''Cinder V2 driver.'''
"""Cinder V2 driver."""
def __init__(self, region, disabled_quotas, session, endpoint_type):
try:

View File

@ -26,7 +26,7 @@ importutils.import_module('keystonemiddleware.auth_token')
class KeystoneClient(base.DriverBase):
'''Keystone V3 driver.'''
"""Keystone V3 driver."""
def __init__(self, region_name=None, auth_url=None):
try:

View File

@ -24,7 +24,7 @@ API_VERSION = '2.0'
class NeutronClient(base.DriverBase):
'''Neutron V2 driver.'''
"""Neutron V2 driver."""
def __init__(self, region, disabled_quotas, session, endpoint_type):
try:
self.neutron = client.Client(
@ -42,11 +42,11 @@ class NeutronClient(base.DriverBase):
raise
def get_resource_usages(self, project_id):
'''Calcualte resources usage and return the dict
"""Calcualte resources usage and return the dict
:param: project_id
:return: resource usage dict
'''
"""
if not self.no_network:
try:
usages = defaultdict(dict)
@ -95,10 +95,10 @@ class NeutronClient(base.DriverBase):
raise
def get_quota_limits(self, project_id):
'''Get the limits
"""Get the limits
TODO: support the rest of the limits
'''
"""
try:
resource_limit = {}
if not self.no_network:
@ -109,7 +109,7 @@ class NeutronClient(base.DriverBase):
raise
def update_quota_limits(self, project_id, new_quota):
'''Update the limits'''
"""Update the limits"""
try:
if not self.no_network:
return self.neutron.update_quota(project_id,
@ -118,7 +118,7 @@ class NeutronClient(base.DriverBase):
raise
def delete_quota_limits(self, project_id):
'''Delete/Reset the limits'''
"""Delete/Reset the limits"""
try:
if not self.no_network:
return self.neutron.delete_quota(project_id)

View File

@ -12,9 +12,9 @@
# License for the specific language governing permissions and limitations
# under the License.
'''
"""
OpenStack Driver
'''
"""
import collections
from oslo_concurrency import lockutils

View File

@ -12,9 +12,9 @@
# License for the specific language governing permissions and limitations
# under the License.
'''
"""
OpenStack Driver
'''
"""
import collections
from oslo_concurrency import lockutils

View File

@ -24,7 +24,7 @@ wallclock = time.time
class ThreadGroupManager(object):
'''Thread group manager.'''
"""Thread group manager."""
def __init__(self):
super(ThreadGroupManager, self).__init__()
@ -37,7 +37,7 @@ class ThreadGroupManager(object):
self._service_task)
def _service_task(self):
'''Dummy task which gets queued on the service.Service threadgroup.
"""Dummy task which gets queued on the service.Service threadgroup.
Without this service.Service sees nothing running i.e has nothing to
wait() on, so the process exits..
@ -45,21 +45,21 @@ class ThreadGroupManager(object):
housekeeping tasks
(Yanyan)Not sure this is still necessary, just keep it temporarily.
'''
"""
# TODO(Yanyan): have this task call dbapi purge events
pass
def start(self, func, *args, **kwargs):
'''Run the given method in a sub-thread.'''
"""Run the given method in a sub-thread."""
return self.group.add_thread(func, *args, **kwargs)
def add_timer(self, interval, func, *args, **kwargs):
'''Define a periodic task to be run in the thread group.
"""Define a periodic task to be run in the thread group.
The task will be executed in a separate green thread.
Interval is from cfg.CONF.periodic_interval
'''
"""
self.group.add_timer(interval, func, *args, **kwargs)
@ -67,7 +67,7 @@ class ThreadGroupManager(object):
self.group.stop_timers()
def stop(self, graceful=False):
'''Stop any active threads belong to this threadgroup.'''
"""Stop any active threads belong to this threadgroup."""
# Try to stop all threads gracefully
self.group.stop(graceful)
self.group.wait()
@ -87,10 +87,10 @@ class ThreadGroupManager(object):
def reschedule(action, sleep_time=1):
'''Eventlet Sleep for the specified number of seconds.
"""Eventlet Sleep for the specified number of seconds.
:param sleep_time: seconds to sleep; if None, no sleep;
'''
"""
if sleep_time is not None:
LOG.debug('Action %s sleep for %s seconds' % (
@ -99,6 +99,6 @@ def reschedule(action, sleep_time=1):
def sleep(sleep_time):
'''Interface for sleeping.'''
"""Interface for sleeping."""
eventlet.sleep(sleep_time)

View File

@ -10,9 +10,9 @@
# License for the specific language governing permissions and limitations
# under the License.
'''
"""
Client side of the DC Orchestrator RPC API.
'''
"""
from oslo_log import log as logging