Docstrings formatted according to pep257

Bug #1020184

quantum/agent/*
quantum/api/*

Change-Id: I206206b66b4adf5cda73a6bb709a0935d7efa821
This commit is contained in:
Sergey Skripnick 2013-04-26 11:41:38 +03:00
parent 07299e34d0
commit 85ffc01eee
12 changed files with 31 additions and 32 deletions

View File

@ -201,7 +201,6 @@ class DhcpAgent(manager.Manager):
def refresh_dhcp_helper(self, network_id):
"""Refresh or disable DHCP for a network depending on the current state
of the network.
"""
old_network = self.cache.get_network_by_id(network_id)
if not old_network:

View File

@ -1,4 +1,3 @@
"""
# vim: tabstop=4 shiftwidth=4 softtabstop=4
#
# Copyright 2012 Nicira Networks, Inc. All rights reserved.
@ -17,7 +16,6 @@
#
# @author: Dan Wendlandt, Nicira, Inc
#
"""
import eventlet
from eventlet import semaphore

View File

@ -73,8 +73,7 @@ class Pidfile(object):
class Daemon(object):
"""
A generic daemon class.
"""A generic daemon class.
Usage: subclass the Daemon class and override the run() method
"""

View File

@ -72,7 +72,8 @@ class LinuxInterfaceDriver(object):
def init_l3(self, device_name, ip_cidrs, namespace=None):
"""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,
self.root_helper,

View File

@ -351,8 +351,7 @@ class IpRouteCommand(IpDeviceCommandBase):
return retval
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.
"""
device_list = []

View File

@ -58,8 +58,8 @@ class UnixDomainHTTPConnection(httplib.HTTPConnection):
class NetworkMetadataProxyHandler(object):
"""Proxy AF_INET metadata request through Unix Domain socket.
The Unix domain socket allows the proxy access resource that are not
accessible within the isolated tenant context.
The Unix domain socket allows the proxy access resource that are not
accessible within the isolated tenant context.
"""
def __init__(self, network_id=None, router_id=None):

View File

@ -46,8 +46,7 @@ def disable_security_group_extension_if_noop_driver(
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):
LOG.debug(_("Get security group rules "
"for devices via rpc %r"), devices)

View File

@ -29,8 +29,8 @@ LOG = logging.getLogger(__name__)
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:
check=a&check=b&name=Bob&
becomes:
@ -124,8 +124,9 @@ def list_args(request, arg):
def get_sorts(request, attr_info):
"""Extract sort_key and sort_dir from request, return as:
[(key1, value1), (key2, value2)]
"""Extract sort_key and sort_dir from request.
Return as: [(key1, value1), (key2, value2)]
"""
sort_keys = list_args(request, "sort_key")
sort_dirs = list_args(request, "sort_dir")
@ -302,9 +303,9 @@ class QuantumController(object):
def _prepare_request_body(self, body, params):
"""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:
if body is None:

View File

@ -42,7 +42,8 @@ class PluginInterface(object):
@classmethod
def __subclasshook__(cls, klass):
"""
"""Checking plugin class.
The __subclasshook__ method is a class method
that will be called everytime a class is tested
using issubclass(klass, PluginInterface).
@ -134,7 +135,7 @@ class ExtensionDescriptor(object):
return request_exts
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
to the attributes defined in the core, and can appear in
@ -151,8 +152,8 @@ class ExtensionDescriptor(object):
return {}
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,
Methods in this abstract class should be decorated as abstractmethod
"""
@ -160,7 +161,7 @@ class ExtensionDescriptor(object):
def update_attributes_map(self, extended_attributes,
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.
An extension can use this method and supplying its own resource

View File

@ -33,6 +33,7 @@ SHARED = 'shared'
def _verify_dict_keys(expected_keys, target_dict, strict=True):
"""Allows to verify keys in a dictionary.
:param expected_keys: A list of keys expected to be present.
:param target_dict: The dictionary which should be verified.
: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):
"""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
"""
if not isinstance(data, list):
msg = _("Invalid data format for IP pool: '%s'") % data

View File

@ -492,13 +492,14 @@ class Controller(object):
@staticmethod
def prepare_request_body(context, body, is_create, resource, attr_info,
allow_bulk=False):
"""Verifies required attributes are in request body, and 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.
"""Verifies required attributes are in request body.
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"
if not body:

View File

@ -26,7 +26,8 @@ def get_view_builder(req):
class ViewBuilder(object):
def __init__(self, base_url):
"""
"""Object initialization.
:param base_url: url of the root wsgi application
"""
self.base_url = base_url