Docstrings formatted according to pep257
Bug #1020184 quantum/agent/* quantum/api/* Change-Id: I206206b66b4adf5cda73a6bb709a0935d7efa821
This commit is contained in:
parent
07299e34d0
commit
85ffc01eee
|
@ -201,7 +201,6 @@ class DhcpAgent(manager.Manager):
|
||||||
def refresh_dhcp_helper(self, network_id):
|
def refresh_dhcp_helper(self, network_id):
|
||||||
"""Refresh or disable DHCP for a network depending on the current state
|
"""Refresh or disable DHCP for a network depending on the current state
|
||||||
of the network.
|
of the network.
|
||||||
|
|
||||||
"""
|
"""
|
||||||
old_network = self.cache.get_network_by_id(network_id)
|
old_network = self.cache.get_network_by_id(network_id)
|
||||||
if not old_network:
|
if not old_network:
|
||||||
|
|
|
@ -1,4 +1,3 @@
|
||||||
"""
|
|
||||||
# vim: tabstop=4 shiftwidth=4 softtabstop=4
|
# vim: tabstop=4 shiftwidth=4 softtabstop=4
|
||||||
#
|
#
|
||||||
# Copyright 2012 Nicira Networks, Inc. All rights reserved.
|
# Copyright 2012 Nicira Networks, Inc. All rights reserved.
|
||||||
|
@ -17,7 +16,6 @@
|
||||||
#
|
#
|
||||||
# @author: Dan Wendlandt, Nicira, Inc
|
# @author: Dan Wendlandt, Nicira, Inc
|
||||||
#
|
#
|
||||||
"""
|
|
||||||
|
|
||||||
import eventlet
|
import eventlet
|
||||||
from eventlet import semaphore
|
from eventlet import semaphore
|
||||||
|
|
|
@ -73,8 +73,7 @@ class Pidfile(object):
|
||||||
|
|
||||||
|
|
||||||
class Daemon(object):
|
class Daemon(object):
|
||||||
"""
|
"""A generic daemon class.
|
||||||
A generic daemon class.
|
|
||||||
|
|
||||||
Usage: subclass the Daemon class and override the run() method
|
Usage: subclass the Daemon class and override the run() method
|
||||||
"""
|
"""
|
||||||
|
|
|
@ -72,7 +72,8 @@ class LinuxInterfaceDriver(object):
|
||||||
|
|
||||||
def init_l3(self, device_name, ip_cidrs, namespace=None):
|
def init_l3(self, device_name, ip_cidrs, namespace=None):
|
||||||
"""Set the L3 settings for the interface using data from the port.
|
"""Set the L3 settings for the interface using data from the port.
|
||||||
ip_cidrs: list of 'X.X.X.X/YY' strings
|
|
||||||
|
ip_cidrs: list of 'X.X.X.X/YY' strings
|
||||||
"""
|
"""
|
||||||
device = ip_lib.IPDevice(device_name,
|
device = ip_lib.IPDevice(device_name,
|
||||||
self.root_helper,
|
self.root_helper,
|
||||||
|
|
|
@ -351,8 +351,7 @@ class IpRouteCommand(IpDeviceCommandBase):
|
||||||
return retval
|
return retval
|
||||||
|
|
||||||
def pullup_route(self, interface_name):
|
def pullup_route(self, interface_name):
|
||||||
"""
|
"""Ensures that the route entry for the interface is before all
|
||||||
Ensures that the route entry for the interface is before all
|
|
||||||
others on the same subnet.
|
others on the same subnet.
|
||||||
"""
|
"""
|
||||||
device_list = []
|
device_list = []
|
||||||
|
|
|
@ -58,8 +58,8 @@ class UnixDomainHTTPConnection(httplib.HTTPConnection):
|
||||||
class NetworkMetadataProxyHandler(object):
|
class NetworkMetadataProxyHandler(object):
|
||||||
"""Proxy AF_INET metadata request through Unix Domain socket.
|
"""Proxy AF_INET metadata request through Unix Domain socket.
|
||||||
|
|
||||||
The Unix domain socket allows the proxy access resource that are not
|
The Unix domain socket allows the proxy access resource that are not
|
||||||
accessible within the isolated tenant context.
|
accessible within the isolated tenant context.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
def __init__(self, network_id=None, router_id=None):
|
def __init__(self, network_id=None, router_id=None):
|
||||||
|
|
|
@ -46,8 +46,7 @@ def disable_security_group_extension_if_noop_driver(
|
||||||
|
|
||||||
|
|
||||||
class SecurityGroupServerRpcApiMixin(object):
|
class SecurityGroupServerRpcApiMixin(object):
|
||||||
"""A mix-in that enable SecurityGroup support in plugin rpc
|
"""A mix-in that enable SecurityGroup support in plugin rpc."""
|
||||||
"""
|
|
||||||
def security_group_rules_for_devices(self, context, devices):
|
def security_group_rules_for_devices(self, context, devices):
|
||||||
LOG.debug(_("Get security group rules "
|
LOG.debug(_("Get security group rules "
|
||||||
"for devices via rpc %r"), devices)
|
"for devices via rpc %r"), devices)
|
||||||
|
|
|
@ -29,8 +29,8 @@ LOG = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|
||||||
def get_filters(request, attr_info, skips=[]):
|
def get_filters(request, attr_info, skips=[]):
|
||||||
"""
|
"""Extracts the filters from the request string.
|
||||||
Extracts the filters from the request string
|
|
||||||
Returns a dict of lists for the filters:
|
Returns a dict of lists for the filters:
|
||||||
check=a&check=b&name=Bob&
|
check=a&check=b&name=Bob&
|
||||||
becomes:
|
becomes:
|
||||||
|
@ -124,8 +124,9 @@ def list_args(request, arg):
|
||||||
|
|
||||||
|
|
||||||
def get_sorts(request, attr_info):
|
def get_sorts(request, attr_info):
|
||||||
"""Extract sort_key and sort_dir from request, return as:
|
"""Extract sort_key and sort_dir from request.
|
||||||
[(key1, value1), (key2, value2)]
|
|
||||||
|
Return as: [(key1, value1), (key2, value2)]
|
||||||
"""
|
"""
|
||||||
sort_keys = list_args(request, "sort_key")
|
sort_keys = list_args(request, "sort_key")
|
||||||
sort_dirs = list_args(request, "sort_dir")
|
sort_dirs = list_args(request, "sort_dir")
|
||||||
|
@ -302,9 +303,9 @@ class QuantumController(object):
|
||||||
|
|
||||||
def _prepare_request_body(self, body, params):
|
def _prepare_request_body(self, body, params):
|
||||||
"""Verifies required parameters are in request body.
|
"""Verifies required parameters are in request body.
|
||||||
sets default value for missing optional parameters.
|
|
||||||
|
|
||||||
body argument must be the deserialized body
|
Sets default value for missing optional parameters.
|
||||||
|
Body argument must be the deserialized body.
|
||||||
"""
|
"""
|
||||||
try:
|
try:
|
||||||
if body is None:
|
if body is None:
|
||||||
|
|
|
@ -42,7 +42,8 @@ class PluginInterface(object):
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def __subclasshook__(cls, klass):
|
def __subclasshook__(cls, klass):
|
||||||
"""
|
"""Checking plugin class.
|
||||||
|
|
||||||
The __subclasshook__ method is a class method
|
The __subclasshook__ method is a class method
|
||||||
that will be called everytime a class is tested
|
that will be called everytime a class is tested
|
||||||
using issubclass(klass, PluginInterface).
|
using issubclass(klass, PluginInterface).
|
||||||
|
@ -134,7 +135,7 @@ class ExtensionDescriptor(object):
|
||||||
return request_exts
|
return request_exts
|
||||||
|
|
||||||
def get_extended_resources(self, version):
|
def get_extended_resources(self, version):
|
||||||
"""retrieve extended resources or attributes for core resources.
|
"""Retrieve extended resources or attributes for core resources.
|
||||||
|
|
||||||
Extended attributes are implemented by a core plugin similarly
|
Extended attributes are implemented by a core plugin similarly
|
||||||
to the attributes defined in the core, and can appear in
|
to the attributes defined in the core, and can appear in
|
||||||
|
@ -151,8 +152,8 @@ class ExtensionDescriptor(object):
|
||||||
return {}
|
return {}
|
||||||
|
|
||||||
def get_plugin_interface(self):
|
def get_plugin_interface(self):
|
||||||
"""
|
"""Returns an abstract class which defines contract for the plugin.
|
||||||
Returns an abstract class which defines contract for the plugin.
|
|
||||||
The abstract class should inherit from extesnions.PluginInterface,
|
The abstract class should inherit from extesnions.PluginInterface,
|
||||||
Methods in this abstract class should be decorated as abstractmethod
|
Methods in this abstract class should be decorated as abstractmethod
|
||||||
"""
|
"""
|
||||||
|
@ -160,7 +161,7 @@ class ExtensionDescriptor(object):
|
||||||
|
|
||||||
def update_attributes_map(self, extended_attributes,
|
def update_attributes_map(self, extended_attributes,
|
||||||
extension_attrs_map=None):
|
extension_attrs_map=None):
|
||||||
"""Update attributes map for this extension
|
"""Update attributes map for this extension.
|
||||||
|
|
||||||
This is default method for extending an extension's attributes map.
|
This is default method for extending an extension's attributes map.
|
||||||
An extension can use this method and supplying its own resource
|
An extension can use this method and supplying its own resource
|
||||||
|
|
|
@ -33,6 +33,7 @@ SHARED = 'shared'
|
||||||
|
|
||||||
def _verify_dict_keys(expected_keys, target_dict, strict=True):
|
def _verify_dict_keys(expected_keys, target_dict, strict=True):
|
||||||
"""Allows to verify keys in a dictionary.
|
"""Allows to verify keys in a dictionary.
|
||||||
|
|
||||||
:param expected_keys: A list of keys expected to be present.
|
:param expected_keys: A list of keys expected to be present.
|
||||||
:param target_dict: The dictionary which should be verified.
|
:param target_dict: The dictionary which should be verified.
|
||||||
:param strict: Specifies whether additional keys are allowed to be present.
|
:param strict: Specifies whether additional keys are allowed to be present.
|
||||||
|
@ -114,10 +115,9 @@ def _validate_ip_address(data, valid_values=None):
|
||||||
|
|
||||||
|
|
||||||
def _validate_ip_pools(data, valid_values=None):
|
def _validate_ip_pools(data, valid_values=None):
|
||||||
"""Validate that start and end IP addresses are present
|
"""Validate that start and end IP addresses are present.
|
||||||
|
|
||||||
In addition to this the IP addresses will also be validated
|
In addition to this the IP addresses will also be validated
|
||||||
|
|
||||||
"""
|
"""
|
||||||
if not isinstance(data, list):
|
if not isinstance(data, list):
|
||||||
msg = _("Invalid data format for IP pool: '%s'") % data
|
msg = _("Invalid data format for IP pool: '%s'") % data
|
||||||
|
|
|
@ -492,13 +492,14 @@ class Controller(object):
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def prepare_request_body(context, body, is_create, resource, attr_info,
|
def prepare_request_body(context, body, is_create, resource, attr_info,
|
||||||
allow_bulk=False):
|
allow_bulk=False):
|
||||||
"""Verifies required attributes are in request body, and that
|
"""Verifies required attributes are in request body.
|
||||||
an attribute is only specified if it is allowed for the given
|
|
||||||
operation (create/update).
|
|
||||||
Attribute with default values are considered to be
|
|
||||||
optional.
|
|
||||||
|
|
||||||
body argument must be the deserialized body
|
Also checking that an attribute is only specified if it is allowed
|
||||||
|
for the given operation (create/update).
|
||||||
|
|
||||||
|
Attribute with default values are considered to be optional.
|
||||||
|
|
||||||
|
body argument must be the deserialized body.
|
||||||
"""
|
"""
|
||||||
collection = resource + "s"
|
collection = resource + "s"
|
||||||
if not body:
|
if not body:
|
||||||
|
|
|
@ -26,7 +26,8 @@ def get_view_builder(req):
|
||||||
class ViewBuilder(object):
|
class ViewBuilder(object):
|
||||||
|
|
||||||
def __init__(self, base_url):
|
def __init__(self, base_url):
|
||||||
"""
|
"""Object initialization.
|
||||||
|
|
||||||
:param base_url: url of the root wsgi application
|
:param base_url: url of the root wsgi application
|
||||||
"""
|
"""
|
||||||
self.base_url = base_url
|
self.base_url = base_url
|
||||||
|
|
Loading…
Reference in New Issue