]> review.fuel-infra Code Review - openstack-build/neutron-build.git/commitdiff
Docstrings formatted according to pep257
authorSergey Skripnick <sskripnick@mirantis.com>
Fri, 26 Apr 2013 08:41:38 +0000 (11:41 +0300)
committerSergey Skripnick <sskripnick@mirantis.com>
Mon, 29 Apr 2013 08:20:15 +0000 (11:20 +0300)
Bug #1020184

quantum/agent/*
quantum/api/*

Change-Id: I206206b66b4adf5cda73a6bb709a0935d7efa821

12 files changed:
quantum/agent/dhcp_agent.py
quantum/agent/l3_agent.py
quantum/agent/linux/daemon.py
quantum/agent/linux/interface.py
quantum/agent/linux/ip_lib.py
quantum/agent/metadata/namespace_proxy.py
quantum/agent/securitygroups_rpc.py
quantum/api/api_common.py
quantum/api/extensions.py
quantum/api/v2/attributes.py
quantum/api/v2/base.py
quantum/api/views/versions.py

index 804983a6eb3c10acdb7831e519a4f4ed082d8074..66f03f06232b34ecdaa8922a20ae970466903c92 100644 (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:
index b1dcc442851876dbe2a14fb386a509609ff31521..368cfb5c6eef7a3619f29ada1f05fd13ad06e782 100644 (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
index 7902868dbdc37aa81195c7664a8de52ee2aeafd7..cf45fd6f4c7562667ab98b3541e0ed2b2253b15d 100644 (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
     """
index c0305a26f6a3098ee02abed2827c28180a12e356..e7bd103e2406e9ba76f09f830784fbdc8c3b0b5b 100644 (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,
index ed110556f92660b04a8c6658d91ac5e296118116..0aba9243268db47bb051935540f0eeff2a316819 100644 (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 = []
index 86d608410a73765ff7439cfd928a90b1cfe837cf..0a9a317bed7fc64f33db1bfe50aeba33b9c3d8bc 100644 (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):
index 2ca2c41979d01c28a5d67566df1b630190debfc4..6ff36da36a455b2d4105604adbe495a7b5c3569a 100644 (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)
index d408182b47b4a4b73268b5b7be319cbc4c99c9ed..f7ce45628510fba80765962aeaf18af325c8c355 100644 (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:
index ac2d1c3a85d37e29f6f235651c3605866e8b7a41..e1316c0f1a563ed131161ac0ea81ba652f20abdb 100644 (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
index aea6094ed5c62cbb56dd489de8c806008b127580..1eb6df1aa791b0cb99549d0dc4284d1bb2aecf6b 100644 (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
index 33b16973b458078c88a29404592c7f9232597cb5..4772af6249ec78e54d9cb1308dcae16d040d96c9 100644 (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:
index 441989c6de01536a405a90017a5de9c8e740a88e..79f83ef5d4695774937d36c54406c3fde0f8a437 100644 (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