You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@libcloud.apache.org by to...@apache.org on 2015/12/30 09:14:40 UTC

[1/2] libcloud git commit: Fix docstring issues causing sphinx warnings.

Repository: libcloud
Updated Branches:
  refs/heads/sphinx_docstring_fixes [created] 68b6c2d5d


Fix docstring issues causing sphinx warnings.


Project: http://git-wip-us.apache.org/repos/asf/libcloud/repo
Commit: http://git-wip-us.apache.org/repos/asf/libcloud/commit/bed9fb67
Tree: http://git-wip-us.apache.org/repos/asf/libcloud/tree/bed9fb67
Diff: http://git-wip-us.apache.org/repos/asf/libcloud/diff/bed9fb67

Branch: refs/heads/sphinx_docstring_fixes
Commit: bed9fb67875fec60ab829d3d23ad14c5a7069762
Parents: 6e8ad2d
Author: Tomaz Muraus <to...@tomaz.me>
Authored: Wed Dec 30 15:29:03 2015 +0800
Committer: Tomaz Muraus <to...@tomaz.me>
Committed: Wed Dec 30 15:49:02 2015 +0800

----------------------------------------------------------------------
 libcloud/common/google.py              |  9 +++----
 libcloud/common/openstack.py           | 38 +++++++++++++++++------------
 libcloud/compute/deployment.py         |  2 +-
 libcloud/compute/drivers/abiquo.py     |  4 +--
 libcloud/compute/drivers/azure.py      | 32 ++++++++++++------------
 libcloud/compute/drivers/cloudsigma.py |  4 +--
 libcloud/compute/drivers/cloudstack.py |  5 ++--
 7 files changed, 51 insertions(+), 43 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/libcloud/blob/bed9fb67/libcloud/common/google.py
----------------------------------------------------------------------
diff --git a/libcloud/common/google.py b/libcloud/common/google.py
index b881506..07cf553 100644
--- a/libcloud/common/google.py
+++ b/libcloud/common/google.py
@@ -21,8 +21,8 @@ Information about setting up your Google OAUTH2 credentials:
 For libcloud, there are two basic methods for authenticating to Google using
 OAUTH2: Service Accounts and Client IDs for Installed Applications.
 
-Both are initially set up from the Cloud Console_
-_Console: https://cloud.google.com/console
+Both are initially set up from the Cloud Console Console -
+https://cloud.google.com/console
 
 Setting up Service Account authentication (note that you need the PyCrypto
 package installed to use this):
@@ -38,9 +38,7 @@ package installed to use this):
 - Optionally, you may choose to Generate a PKCS12 key from the Console.
   It needs to be converted to the PEM format.  Please note, the PKCS12 format
   is deprecated and may be removed in a future release.
-  - Convert the key using OpenSSL (the default password is 'notasecret'):
-    ``openssl pkcs12 -in YOURPRIVKEY.p12 -nodes -nocerts
-    -passin pass:notasecret | openssl rsa -out PRIV.pem``
+  - Convert the key using OpenSSL (the default password is 'notasecret').
   - Move the .pem file to a safe location.
 - To Authenticate, you will need to pass the Service Account's "Email
   address" in as the user_id and the path to the .pem file as the key.
@@ -66,6 +64,7 @@ Setting up Installed Application authentication:
 
 Please remember to secure your keys and access tokens.
 """
+
 from __future__ import with_statement
 
 try:

http://git-wip-us.apache.org/repos/asf/libcloud/blob/bed9fb67/libcloud/common/openstack.py
----------------------------------------------------------------------
diff --git a/libcloud/common/openstack.py b/libcloud/common/openstack.py
index b6e6d6c..e63ee8a 100644
--- a/libcloud/common/openstack.py
+++ b/libcloud/common/openstack.py
@@ -74,40 +74,46 @@ class OpenStackBaseConnection(ConnectionUserAndKey):
     :type secure: ``bool``
 
     :param ex_force_base_url: Base URL for connection requests.  If
-    not specified, this will be determined by authenticating.
+                              not specified, this will be determined by
+                              authenticating.
     :type ex_force_base_url: ``str``
 
     :param ex_force_auth_url: Base URL for authentication requests.
     :type ex_force_auth_url: ``str``
 
     :param ex_force_auth_version: Authentication version to use.  If
-    not specified, defaults to AUTH_API_VERSION.
+                                  not specified, defaults to AUTH_API_VERSION.
     :type ex_force_auth_version: ``str``
 
-    :param ex_force_auth_token: Authentication token to use for
-    connection requests.  If specified, the connection will not attempt
-    to authenticate, and the value of ex_force_base_url will be used to
-    determine the base request URL.  If ex_force_auth_token is passed in,
-    ex_force_base_url must also be provided.
+    :param ex_force_auth_token: Authentication token to use for connection
+                                requests.  If specified, the connection will
+                                not attempt to authenticate, and the value
+                                of ex_force_base_url will be used to
+                                determine the base request URL.  If
+                                ex_force_auth_token is passed in,
+                                ex_force_base_url must also be provided.
     :type ex_force_auth_token: ``str``
 
-    :param ex_tenant_name: When authenticating, provide this tenant
-    name to the identity service.  A scoped token will be returned.
-    Some cloud providers require the tenant name to be provided at
-    authentication time.  Others will use a default tenant if none
-    is provided.
+    :param ex_tenant_name: When authenticating, provide this tenant name to the
+                           identity service. A scoped token will be returned.
+                           Some cloud providers require the tenant name to be
+                           provided at authentication time. Others will use a
+                           default tenant if none is provided.
     :type ex_tenant_name: ``str``
 
     :param ex_force_service_type: Service type to use when selecting an
-    service.  If not specified, a provider specific default will be used.
+                                  service. If not specified, a provider
+                                  specific default will be used.
     :type ex_force_service_type: ``str``
 
     :param ex_force_service_name: Service name to use when selecting an
-    service.  If not specified, a provider specific default will be used.
+                                  service. If not specified, a provider
+                                  specific default will be used.
     :type ex_force_service_name: ``str``
 
-    :param ex_force_service_region: Region to use when selecting an
-    service.  If not specified, a provider specific default will be used.
+    :param ex_force_service_region: Region to use when selecting an service.
+                                    If not specified, a provider specific
+                                    default will be used.
     :type ex_force_service_region: ``str``
     """
 

http://git-wip-us.apache.org/repos/asf/libcloud/blob/bed9fb67/libcloud/compute/deployment.py
----------------------------------------------------------------------
diff --git a/libcloud/compute/deployment.py b/libcloud/compute/deployment.py
index 018c5f8..d5f7eec 100644
--- a/libcloud/compute/deployment.py
+++ b/libcloud/compute/deployment.py
@@ -246,7 +246,7 @@ class MultiStepDeployment(Deployment):
         :type add: Single :class:`Deployment` or a ``list`` of
                    :class:`Deployment`
         :keyword add: Adds this deployment to the others already in this
-        object.
+                      object.
         """
         if add is not None:
             add = add if isinstance(add, (list, tuple)) else [add]

http://git-wip-us.apache.org/repos/asf/libcloud/blob/bed9fb67/libcloud/compute/drivers/abiquo.py
----------------------------------------------------------------------
diff --git a/libcloud/compute/drivers/abiquo.py b/libcloud/compute/drivers/abiquo.py
index f8afdfd..fdcc59d 100644
--- a/libcloud/compute/drivers/abiquo.py
+++ b/libcloud/compute/drivers/abiquo.py
@@ -328,8 +328,8 @@ class AbiquoNodeDriver(NodeDriver):
         """
         Destroy a group.
 
-        Be careful! Destroying a group means destroying all the :class:`Node`s
-        there and the group itself!
+        Be careful! Destroying a group means destroying all the :class:`Node`
+        instances there and the group itself!
 
         If there is currently any action over any :class:`Node` of the
         :class:`NodeGroup`, then the method will raise an exception.

http://git-wip-us.apache.org/repos/asf/libcloud/blob/bed9fb67/libcloud/compute/drivers/azure.py
----------------------------------------------------------------------
diff --git a/libcloud/compute/drivers/azure.py b/libcloud/compute/drivers/azure.py
index f55fce6..48a0654 100644
--- a/libcloud/compute/drivers/azure.py
+++ b/libcloud/compute/drivers/azure.py
@@ -954,23 +954,25 @@ class AzureNodeDriver(NodeDriver):
 
     def ex_set_instance_endpoints(self, node, endpoints,
                                   ex_deployment_slot="Production"):
+
         """
-        endpoint = ConfigurationSetInputEndpoint(
-            name='SSH',
-            protocol='tcp',
-            port=port,
-            local_port='22',
-            load_balanced_endpoint_set_name=None,
-            enable_direct_server_return=False
-        )
-        {
-            'name': 'SSH',
-            'protocol': 'tcp',
-            'port': port,
-            'local_port': '22'
-        }
-        """
+        For example::
 
+            endpoint = ConfigurationSetInputEndpoint(
+                name='SSH',
+                protocol='tcp',
+                port=port,
+                local_port='22',
+                load_balanced_endpoint_set_name=None,
+                enable_direct_server_return=False
+            )
+            {
+                'name': 'SSH',
+                'protocol': 'tcp',
+                'port': port,
+                'local_port': '22'
+            }
+        """
         ex_cloud_service_name = node.extra['ex_cloud_service_name']
         vm_role_name = node.name
 

http://git-wip-us.apache.org/repos/asf/libcloud/blob/bed9fb67/libcloud/compute/drivers/cloudsigma.py
----------------------------------------------------------------------
diff --git a/libcloud/compute/drivers/cloudsigma.py b/libcloud/compute/drivers/cloudsigma.py
index 0b26665..02818b3 100644
--- a/libcloud/compute/drivers/cloudsigma.py
+++ b/libcloud/compute/drivers/cloudsigma.py
@@ -274,11 +274,11 @@ class CloudSigma_1_0_NodeDriver(CloudSigmaNodeDriver):
         :type       name: ``str``
 
         :keyword    smp: Number of virtual processors or None to calculate
-        based on the cpu speed
+                         based on the cpu speed.
         :type       smp: ``int``
 
         :keyword    nic_model: e1000, rtl8139 or virtio (is not specified,
-        e1000 is used)
+                               e1000 is used)
         :type       nic_model: ``str``
 
         :keyword    vnc_password: If not set, VNC access is disabled.

http://git-wip-us.apache.org/repos/asf/libcloud/blob/bed9fb67/libcloud/compute/drivers/cloudstack.py
----------------------------------------------------------------------
diff --git a/libcloud/compute/drivers/cloudstack.py b/libcloud/compute/drivers/cloudstack.py
index 763e3fd..33edda7 100644
--- a/libcloud/compute/drivers/cloudstack.py
+++ b/libcloud/compute/drivers/cloudstack.py
@@ -818,7 +818,7 @@ class CloudStackNetworkACL(object):
         :type       id ``int``
 
         :param      protocol: the protocol for the ACL rule. Valid values are
-                    TCP/UDP/ICMP/ALL or valid protocol number
+                               TCP/UDP/ICMP/ALL or valid protocol number
         :type       protocol: ``string``
 
         :param      acl_id: Name of the network ACL List
@@ -837,7 +837,8 @@ class CloudStackNetworkACL(object):
         :type       end_port: ``str``
 
         :param      traffic_type: the traffic type for the ACL,can be Ingress
-                    or Egress, defaulted to Ingress if not specified
+                                  or Egress, defaulted to Ingress if not
+                                  specified
         :type       traffic_type: ``str``
 
         :rtype: :class:`CloudStackNetworkACL`


[2/2] libcloud git commit: Try a hack to avoid warnings from docstrings.

Posted by to...@apache.org.
Try a hack to avoid warnings from docstrings.

For now, we just want to treat, non-docstring related warnings as errors.


Project: http://git-wip-us.apache.org/repos/asf/libcloud/repo
Commit: http://git-wip-us.apache.org/repos/asf/libcloud/commit/68b6c2d5
Tree: http://git-wip-us.apache.org/repos/asf/libcloud/tree/68b6c2d5
Diff: http://git-wip-us.apache.org/repos/asf/libcloud/diff/68b6c2d5

Branch: refs/heads/sphinx_docstring_fixes
Commit: 68b6c2d5d8553ead2ad278d0ce16d794c4a3776c
Parents: bed9fb6
Author: Tomaz Muraus <to...@tomaz.me>
Authored: Wed Dec 30 15:49:06 2015 +0800
Committer: Tomaz Muraus <to...@tomaz.me>
Committed: Wed Dec 30 16:13:58 2015 +0800

----------------------------------------------------------------------
 docs/conf.py | 34 +++++++++++++++++++++++++++++++++-
 1 file changed, 33 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/libcloud/blob/68b6c2d5/docs/conf.py
----------------------------------------------------------------------
diff --git a/docs/conf.py b/docs/conf.py
index 6bd17cb..155a30a 100644
--- a/docs/conf.py
+++ b/docs/conf.py
@@ -11,9 +11,15 @@
 # All configuration values have a default; values that are commented out
 # serve to show the default.
 
-import sys, os
+import os
+import sys
 import subprocess
 
+from sphinx.environment import BuildEnvironment
+
+from sphinx.ext.autodoc import AutoDirective
+from sphinx.ext.autodoc import AutodocReporter
+
 # Detect if we are running on read the docs
 on_rtd = os.environ.get('READTHEDOCS', None) == 'True'
 
@@ -263,3 +269,29 @@ texinfo_documents = [
 intersphinx_mapping = {'http://docs.python.org/': None}
 
 autoclass_content = 'both'
+
+
+# Note: For now we ignore sphinx-autodoc warnings since there are too many
+# and we want at least documentation (not docstring) related warnings to be
+# reported, treated as errors and fixed.
+def noop(*args, **kwargs):
+    pass
+
+def mock_warning(self, *args, **kwargs):
+    # We re-write warning as info (level 1)
+    return self.system_message(1, *args, **kwargs)
+
+original_warn_node = BuildEnvironment.warn_node
+
+def ignore_more_than_one_target_found_errors(self, msg, node):
+    if "more than one target found" in msg:
+        return None
+
+    return original_warn_node(self, msg, node)
+
+
+# Monkey patch the original methods
+AutoDirective.warn = noop
+AutodocReporter.warning = mock_warning
+
+BuildEnvironment.warn_node = ignore_more_than_one_target_found_errors