You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@libcloud.apache.org by qu...@apache.org on 2018/03/16 15:26:03 UTC

[1/7] libcloud git commit: Remove duplicated keys in object literals

Repository: libcloud
Updated Branches:
  refs/heads/trunk 68ba179d8 -> 6a8933fca


Remove duplicated keys in object literals

Signed-off-by: Quentin Pradet <qu...@apache.org>


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

Branch: refs/heads/trunk
Commit: 52ff93275c3ceef5186815fee5bd08edcb4a4798
Parents: 2c2cbd9
Author: Rémy Léone <rl...@online.net>
Authored: Fri Mar 16 10:53:50 2018 +0100
Committer: Quentin Pradet <qu...@apache.org>
Committed: Fri Mar 16 19:21:55 2018 +0400

----------------------------------------------------------------------
 libcloud/test/compute/fixtures/gce/aggregated_disks.json      | 7 -------
 .../test/compute/fixtures/gce/zones_us-central1-a_disks.json  | 1 -
 .../test/compute/fixtures/profitbricks/ex_update_node.json    | 1 -
 3 files changed, 9 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/libcloud/blob/52ff9327/libcloud/test/compute/fixtures/gce/aggregated_disks.json
----------------------------------------------------------------------
diff --git a/libcloud/test/compute/fixtures/gce/aggregated_disks.json b/libcloud/test/compute/fixtures/gce/aggregated_disks.json
index 4103785..3feef5d 100644
--- a/libcloud/test/compute/fixtures/gce/aggregated_disks.json
+++ b/libcloud/test/compute/fixtures/gce/aggregated_disks.json
@@ -74,7 +74,6 @@
         "id": "0265567475385851075",
         "kind": "compute#disk",
         "name": "node-name",
-        "description": "I'm a happy little disk",
         "type": "https://www.googleapis.com/compute/v1/projects/project_name/zones/us-central1-a/diskTypes/pd-standard",
         "selfLink": "https://www.googleapis.com/compute/v1/projects/project_name/zones/us-central1-a/disks/node-name",
         "sizeGb": "10",
@@ -89,7 +88,6 @@
         "id": "08045379695757218000",
         "kind": "compute#disk",
         "name": "lcdisk",
-        "description": "I'm a happy little disk",
         "type": "https://www.googleapis.com/compute/v1/projects/project_name/zones/us-central1-a/diskTypes/pd-ssd",
         "selfLink": "https://www.googleapis.com/compute/v1/projects/project_name/zones/us-central1-a/disks/lcdisk",
         "sizeGb": "10",
@@ -104,7 +102,6 @@
         "id": "08045379695757218002",
         "kind": "compute#disk",
         "name": "lcnode-000",
-        "description": "I'm a happy little persistent disk",
         "type": "https://www.googleapis.com/compute/v1/projects/project_name/zones/us-central1-a/diskTypes/pd-standard",
         "selfLink": "https://www.googleapis.com/compute/v1/projects/project_name/zones/us-central1-a/disks/lcnode-000",
         "sizeGb": "25",
@@ -119,7 +116,6 @@
         "id": "08045379695757218000",
         "kind": "compute#disk",
         "name": "lcnode-001",
-        "description": "I'm a happy little persistent disk",
         "type": "https://www.googleapis.com/compute/v1/projects/project_name/zones/us-central1-a/diskTypes/pd-standard",
         "selfLink": "https://www.googleapis.com/compute/v1/projects/project_name/zones/us-central1-a/disks/lcnode-001",
         "sizeGb": "25",
@@ -149,7 +145,6 @@
         "id": "08045379695757218001",
         "kind": "compute#disk",
         "name": "libcloud-lb-demo-www-000",
-        "description": "I'm a happy little persistent disk",
         "type": "https://www.googleapis.com/compute/v1/projects/project_name/zones/us-central1-b/diskTypes/pd-standard",
         "selfLink": "https://www.googleapis.com/compute/v1/projects/project_name/zones/us-central1-b/disks/libcloud-lb-demo-www-000",
         "sizeGb": "10",
@@ -164,7 +159,6 @@
         "id": "08045379695757218001",
         "kind": "compute#disk",
         "name": "libcloud-lb-demo-www-001",
-        "description": "I'm a happy little persistent disk",
         "type": "https://www.googleapis.com/compute/v1/projects/project_name/zones/us-central1-b/diskTypes/pd-standard",
         "selfLink": "https://www.googleapis.com/compute/v1/projects/project_name/zones/us-central1-b/disks/libcloud-lb-demo-www-001",
         "sizeGb": "10",
@@ -245,7 +239,6 @@
         "id": "08045379695757218000",
         "kind": "compute#disk",
         "name": "lcdisk",
-        "description": "I'm a happy little disk",
         "type": "https://www.googleapis.com/compute/v1/projects/project_name/zones/us-central2-a/diskTypes/pd-ssd",
         "selfLink": "https://www.googleapis.com/compute/v1/projects/project_name/zones/us-central2-a/disks/lcdisk",
         "sizeGb": "10",

http://git-wip-us.apache.org/repos/asf/libcloud/blob/52ff9327/libcloud/test/compute/fixtures/gce/zones_us-central1-a_disks.json
----------------------------------------------------------------------
diff --git a/libcloud/test/compute/fixtures/gce/zones_us-central1-a_disks.json b/libcloud/test/compute/fixtures/gce/zones_us-central1-a_disks.json
index fc39c99..6d609be 100644
--- a/libcloud/test/compute/fixtures/gce/zones_us-central1-a_disks.json
+++ b/libcloud/test/compute/fixtures/gce/zones_us-central1-a_disks.json
@@ -19,7 +19,6 @@
       "id": "0265567475385851075",
       "kind": "compute#disk",
       "name": "node-name",
-      "description": "I'm a happy little disk",
       "type": "https://www.googleapis.com/compute/v1/projects/project_name/zones/us-central1-a/diskTypes/pd-standard",
       "selfLink": "https://www.googleapis.com/compute/v1/projects/project_name/zones/us-central1-a/disks/node-name",
       "sizeGb": "10",

http://git-wip-us.apache.org/repos/asf/libcloud/blob/52ff9327/libcloud/test/compute/fixtures/profitbricks/ex_update_node.json
----------------------------------------------------------------------
diff --git a/libcloud/test/compute/fixtures/profitbricks/ex_update_node.json b/libcloud/test/compute/fixtures/profitbricks/ex_update_node.json
index 76c189a..1bc932f 100644
--- a/libcloud/test/compute/fixtures/profitbricks/ex_update_node.json
+++ b/libcloud/test/compute/fixtures/profitbricks/ex_update_node.json
@@ -17,7 +17,6 @@
         "bootCdrom" : null,
         "availabilityZone": "ZONE_1",
         "vmState": "RUNNING",
-        "bootCdrom": null,
         "bootVolume": {
             "id": "bvol-1",
             "type": "volume",


[7/7] libcloud git commit: Add changes for various cleanups

Posted by qu...@apache.org.
Add changes for various cleanups

Closes #1182, closes #1183, closes #1185, closes #1186, closes #1187 and
closes #1188.


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

Branch: refs/heads/trunk
Commit: 6a8933fcad6a819eeaa4a7800750fc40d5df2602
Parents: b17d6c8
Author: Quentin Pradet <qu...@apache.org>
Authored: Fri Mar 16 19:24:20 2018 +0400
Committer: Quentin Pradet <qu...@apache.org>
Committed: Fri Mar 16 19:24:20 2018 +0400

----------------------------------------------------------------------
 CHANGES.rst | 4 ++++
 1 file changed, 4 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/libcloud/blob/6a8933fc/CHANGES.rst
----------------------------------------------------------------------
diff --git a/CHANGES.rst b/CHANGES.rst
index 945780e..c7e351a 100644
--- a/CHANGES.rst
+++ b/CHANGES.rst
@@ -4,6 +4,10 @@
 Changes in Apache Libcloud in development
 -----------------------------------------
 
+- Cleanup various Python files
+  (GITHUB-1182, GITHUB-1183, GITHUB-1185, GITHUB-1186, GITHUB-1187, GITHUB-1188)
+  [Rémy Léone]
+
 Compute
 ~~~~~~~
 


[3/7] libcloud git commit: Remove duplicated dict entry

Posted by qu...@apache.org.
Remove duplicated dict entry

Signed-off-by: Quentin Pradet <qu...@apache.org>


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

Branch: refs/heads/trunk
Commit: 24d8709d2d34b8c4779214a22b985e0825cb60f8
Parents: 68ba179
Author: Rémy Léone <rl...@online.net>
Authored: Fri Mar 16 10:01:01 2018 +0100
Committer: Quentin Pradet <qu...@apache.org>
Committed: Fri Mar 16 19:21:55 2018 +0400

----------------------------------------------------------------------
 libcloud/compute/drivers/profitbricks.py | 1 -
 libcloud/compute/types.py                | 1 -
 2 files changed, 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/libcloud/blob/24d8709d/libcloud/compute/drivers/profitbricks.py
----------------------------------------------------------------------
diff --git a/libcloud/compute/drivers/profitbricks.py b/libcloud/compute/drivers/profitbricks.py
index 1b12452..d117c9a 100644
--- a/libcloud/compute/drivers/profitbricks.py
+++ b/libcloud/compute/drivers/profitbricks.py
@@ -3777,7 +3777,6 @@ class ProfitBricksNodeDriver(NodeDriver):
                 'size': 'size',
                 'cpuHotPlug': 'cpu_hot_plug',
                 'cpuHotUnplug': 'cpu_hot_unplug',
-                'deviceNumber': 'device_number',
                 'discScsiHotPlug': 'disc_scsi_hot_plug',
                 'discScsiHotUnplug': 'disc_scsi_hot_unplug',
                 'discVirtioHotPlug': 'disc_virtio_hot_plug',

http://git-wip-us.apache.org/repos/asf/libcloud/blob/24d8709d/libcloud/compute/types.py
----------------------------------------------------------------------
diff --git a/libcloud/compute/types.py b/libcloud/compute/types.py
index 89d7d06..44e8687 100644
--- a/libcloud/compute/types.py
+++ b/libcloud/compute/types.py
@@ -241,7 +241,6 @@ OLD_CONSTANT_TO_NEW_MAPPING = {
     Provider.EC2_AP_NORTHEAST2: Provider.EC2,
     Provider.EC2_US_WEST_OREGON: Provider.EC2,
     Provider.EC2_SA_EAST: Provider.EC2,
-    Provider.EC2_AP_SOUTHEAST: Provider.EC2,
     Provider.EC2_CA_CENTRAL1: Provider.EC2,
 
     # ElasticHosts


[6/7] libcloud git commit: Replace function calls to set litteral

Posted by qu...@apache.org.
Replace function calls to set litteral

Signed-off-by: Quentin Pradet <qu...@apache.org>


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

Branch: refs/heads/trunk
Commit: b17d6c82b3200f095381298fa6af9cbe27129521
Parents: 52ff932
Author: Rémy Léone <rl...@online.net>
Authored: Fri Mar 16 10:57:50 2018 +0100
Committer: Quentin Pradet <qu...@apache.org>
Committed: Fri Mar 16 19:23:44 2018 +0400

----------------------------------------------------------------------
 libcloud/test/compute/test_azure_arm.py      | 9 +++------
 libcloud/test/loadbalancer/test_gogrid.py    | 3 +--
 libcloud/test/loadbalancer/test_rackspace.py | 2 +-
 3 files changed, 5 insertions(+), 9 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/libcloud/blob/b17d6c82/libcloud/test/compute/test_azure_arm.py
----------------------------------------------------------------------
diff --git a/libcloud/test/compute/test_azure_arm.py b/libcloud/test/compute/test_azure_arm.py
index bd8cfa0..29ba98e 100644
--- a/libcloud/test/compute/test_azure_arm.py
+++ b/libcloud/test/compute/test_azure_arm.py
@@ -89,11 +89,8 @@ class AzureNodeDriverTests(LibcloudTestCase):
     def test_ex_get_ratecard(self):
         ratecard = self.driver.ex_get_ratecard('0026P')
         self.assertEqual(set(ratecard.keys()),
-                         set(['Currency',
-                              'Locale',
-                              'IsTaxIncluded',
-                              'OfferTerms',
-                              'Meters']))
+                         {'Currency', 'Locale', 'IsTaxIncluded',
+                          'OfferTerms', 'Meters'})
 
     def test_create_node(self):
         location = NodeLocation('any_location', '', '', self.driver)
@@ -391,7 +388,7 @@ class AzureNodeDriverTests(LibcloudTestCase):
         data_disks = node.extra['properties']['storageProfile']['dataDisks']
         luns = [disk['lun'] for disk in data_disks]
         self.assertTrue(len(data_disks), len(volumes))
-        self.assertTrue(set(luns), set([0, 1, 15]))
+        self.assertTrue(set(luns), {0, 1, 15})
 
     def test_detach_volume(self):
         volumes = self.driver.list_volumes()

http://git-wip-us.apache.org/repos/asf/libcloud/blob/b17d6c82/libcloud/test/loadbalancer/test_gogrid.py
----------------------------------------------------------------------
diff --git a/libcloud/test/loadbalancer/test_gogrid.py b/libcloud/test/loadbalancer/test_gogrid.py
index f01a28a..1e1702d 100644
--- a/libcloud/test/loadbalancer/test_gogrid.py
+++ b/libcloud/test/loadbalancer/test_gogrid.py
@@ -111,8 +111,7 @@ class GoGridTests(unittest.TestCase):
         members1 = self.driver.balancer_list_members(balancer=balancer)
         members2 = balancer.list_members()
 
-        expected_members = set(['10.0.0.78:80', '10.0.0.77:80',
-                                '10.0.0.76:80'])
+        expected_members = {'10.0.0.78:80', '10.0.0.77:80', '10.0.0.76:80'}
 
         self.assertEqual(len(members1), 3)
         self.assertEqual(len(members2), 3)

http://git-wip-us.apache.org/repos/asf/libcloud/blob/b17d6c82/libcloud/test/loadbalancer/test_rackspace.py
----------------------------------------------------------------------
diff --git a/libcloud/test/loadbalancer/test_rackspace.py b/libcloud/test/loadbalancer/test_rackspace.py
index 02c3735..0212254 100644
--- a/libcloud/test/loadbalancer/test_rackspace.py
+++ b/libcloud/test/loadbalancer/test_rackspace.py
@@ -675,7 +675,7 @@ class RackspaceLBTests(unittest.TestCase):
         self.assertEqual(default_error_page, error_page_content)
 
     def test_balancer_list_members(self):
-        expected = set(['10.1.0.10:80', '10.1.0.11:80', '10.1.0.9:8080'])
+        expected = {'10.1.0.10:80', '10.1.0.11:80', '10.1.0.9:8080'}
         balancer = self.driver.get_balancer(balancer_id='8290')
         members = balancer.list_members()
 


[4/7] libcloud git commit: Use standard triple double-quoted docstring

Posted by qu...@apache.org.
Use standard triple double-quoted docstring

Signed-off-by: Quentin Pradet <qu...@apache.org>


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

Branch: refs/heads/trunk
Commit: 2c2cbd9c0be15388bcab27ef08f19a17a7ec517f
Parents: 56ce2bf
Author: Rémy Léone <rl...@online.net>
Authored: Fri Mar 16 10:49:31 2018 +0100
Committer: Quentin Pradet <qu...@apache.org>
Committed: Fri Mar 16 19:21:55 2018 +0400

----------------------------------------------------------------------
 libcloud/compute/drivers/cloudscale.py     | 32 ++++++++++++-------------
 libcloud/compute/drivers/ktucloud.py       |  2 +-
 libcloud/compute/drivers/profitbricks.py   |  8 +++----
 libcloud/compute/drivers/vcloud.py         |  4 ++--
 libcloud/loadbalancer/drivers/ninefold.py  |  2 +-
 libcloud/test/common/test_upcloud.py       |  4 ++--
 libcloud/test/compute/test_profitbricks.py | 12 +++++-----
 7 files changed, 32 insertions(+), 32 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/libcloud/blob/2c2cbd9c/libcloud/compute/drivers/cloudscale.py
----------------------------------------------------------------------
diff --git a/libcloud/compute/drivers/cloudscale.py b/libcloud/compute/drivers/cloudscale.py
index 1023b22..43155ff 100644
--- a/libcloud/compute/drivers/cloudscale.py
+++ b/libcloud/compute/drivers/cloudscale.py
@@ -86,25 +86,25 @@ class CloudscaleNodeDriver(NodeDriver):
         super(CloudscaleNodeDriver, self).__init__(key, **kwargs)
 
     def list_nodes(self):
-        '''
+        """
         List all your existing compute nodes.
-        '''
+        """
         return self._list_resources('/v1/servers', self._to_node)
 
     def list_sizes(self):
-        '''
+        """
         Lists all available sizes. On cloudscale these are known as flavors.
-        '''
+        """
         return self._list_resources('/v1/flavors', self._to_size)
 
     def list_images(self):
-        '''
+        """
         List all images.
 
         Images are identified by slugs on cloudscale.ch. This means that minor
         version upgrades (e.g. Ubuntu 16.04.1 to Ubuntu 16.04.2) will be
         possible within the same id ``ubuntu-16.04``.
-        '''
+        """
         return self._list_resources('/v1/images', self._to_image)
 
     def create_node(self, name, size, image, location=None, ex_create_attr={}):
@@ -145,42 +145,42 @@ class CloudscaleNodeDriver(NodeDriver):
         return self._to_node(result.object)
 
     def reboot_node(self, node):
-        '''
+        """
         Reboot a node. It's also possible to use ``node.reboot()``.
-        '''
+        """
         return self._action(node, 'reboot')
 
     def ex_start_node(self, node):
-        '''
+        """
         Start a node. This is only possible if the node is stopped.
-        '''
+        """
         return self._action(node, 'start')
 
     def ex_stop_node(self, node):
-        '''
+        """
         Stop a specific node. Similar to ``shutdown -h now``. This is only
         possible if the node is running.
-        '''
+        """
         return self._action(node, 'stop')
 
     def ex_node_by_uuid(self, uuid):
-        '''
+        """
         :param str ex_user_data: A valid uuid that references your exisiting
             cloudscale.ch server.
         :type       ex_user_data:  ``str``
 
         :return: The server node you asked for.
         :rtype: :class:`Node`
-        '''
+        """
         res = self.connection.request(self._get_server_url(uuid))
         return self._to_node(res.object)
 
     def destroy_node(self, node):
-        '''
+        """
         Delete a node. It's also possible to use ``node.destroy()``.
         This will irreversibly delete the cloudscale.ch server and all its
         volumes. So please be cautious.
-        '''
+        """
         res = self.connection.request(
             self._get_server_url(node.id),
             method='DELETE'

http://git-wip-us.apache.org/repos/asf/libcloud/blob/2c2cbd9c/libcloud/compute/drivers/ktucloud.py
----------------------------------------------------------------------
diff --git a/libcloud/compute/drivers/ktucloud.py b/libcloud/compute/drivers/ktucloud.py
index 1bc8544..75a5eef 100644
--- a/libcloud/compute/drivers/ktucloud.py
+++ b/libcloud/compute/drivers/ktucloud.py
@@ -19,7 +19,7 @@ from libcloud.compute.drivers.cloudstack import CloudStackNodeDriver
 
 
 class KTUCloudNodeDriver(CloudStackNodeDriver):
-    "Driver for KTUCloud Compute platform."
+    """Driver for KTUCloud Compute platform."""
 
     EMPTY_DISKOFFERINGID = '0'
     type = Provider.KTUCLOUD

http://git-wip-us.apache.org/repos/asf/libcloud/blob/2c2cbd9c/libcloud/compute/drivers/profitbricks.py
----------------------------------------------------------------------
diff --git a/libcloud/compute/drivers/profitbricks.py b/libcloud/compute/drivers/profitbricks.py
index d117c9a..cd22354 100644
--- a/libcloud/compute/drivers/profitbricks.py
+++ b/libcloud/compute/drivers/profitbricks.py
@@ -104,11 +104,11 @@ class ProfitBricksConnection(ConnectionUserAndKey):
         return headers
 
     def encode_data(self, data):
-        '''
+        """
         If a string is passed in, just return it
         or else if a dict is passed in, encode it
         as a json string.
-        '''
+        """
         if type(data) is str:
             return data
 
@@ -121,13 +121,13 @@ class ProfitBricksConnection(ConnectionUserAndKey):
     def request(self, action, params=None, data=None, headers=None,
                 method='GET', raw=False, with_full_url=False):
 
-        '''
+        """
         Some requests will use the href attribute directly.
         If this is not the case, then we should formulate the
         url based on the action specified.
         If we are using a full url, we need to remove the
         host and protocol components.
-        '''
+        """
         if not with_full_url or with_full_url is False:
             action = self.api_prefix + action.lstrip('/')
         else:

http://git-wip-us.apache.org/repos/asf/libcloud/blob/2c2cbd9c/libcloud/compute/drivers/vcloud.py
----------------------------------------------------------------------
diff --git a/libcloud/compute/drivers/vcloud.py b/libcloud/compute/drivers/vcloud.py
index d2b833d..7c0af31 100644
--- a/libcloud/compute/drivers/vcloud.py
+++ b/libcloud/compute/drivers/vcloud.py
@@ -2226,9 +2226,9 @@ class VCloud_5_1_NodeDriver(VCloud_1_5_NodeDriver):
 
 
 class VCloud_5_5_NodeDriver(VCloud_5_1_NodeDriver):
-    '''Use 5.5 Connection class to explicitly set 5.5 for the version in
+    """Use 5.5 Connection class to explicitly set 5.5 for the version in
     Accept headers
-    '''
+    """
     connectionCls = VCloud_5_5_Connection
 
     def ex_create_snapshot(self, node):

http://git-wip-us.apache.org/repos/asf/libcloud/blob/2c2cbd9c/libcloud/loadbalancer/drivers/ninefold.py
----------------------------------------------------------------------
diff --git a/libcloud/loadbalancer/drivers/ninefold.py b/libcloud/loadbalancer/drivers/ninefold.py
index cb28f6c..1365cdf 100644
--- a/libcloud/loadbalancer/drivers/ninefold.py
+++ b/libcloud/loadbalancer/drivers/ninefold.py
@@ -19,7 +19,7 @@ from libcloud.loadbalancer.drivers.cloudstack import CloudStackLBDriver
 
 
 class NinefoldLBDriver(CloudStackLBDriver):
-    "Driver for load balancers on Ninefold's Compute platform."
+    """Driver for load balancers on Ninefold's Compute platform."""
 
     host = 'api.ninefold.com'
     path = '/compute/v1.0/'

http://git-wip-us.apache.org/repos/asf/libcloud/blob/2c2cbd9c/libcloud/test/common/test_upcloud.py
----------------------------------------------------------------------
diff --git a/libcloud/test/common/test_upcloud.py b/libcloud/test/common/test_upcloud.py
index 4a2acb1..60a9ea9 100644
--- a/libcloud/test/common/test_upcloud.py
+++ b/libcloud/test/common/test_upcloud.py
@@ -241,7 +241,7 @@ class TestUpcloudNodeDestroyer(unittest.TestCase):
         self.mock_operations.destroy_node.assert_called_once_with(1)
 
     def test_reuse(self):
-        "Verify that internal flag self.destroyer._stop_node is handled properly"
+        """Verify that internal flag self.destroyer._stop_node is handled properly"""
         self.mock_operations.get_node_state.side_effect = ['started', 'stopped', 'started', 'stopped']
         self.assertTrue(self.destroyer.destroy_node(1))
         self.assertTrue(self.destroyer.destroy_node(1))
@@ -255,7 +255,7 @@ class TestUpcloudNodeDestroyer(unittest.TestCase):
         self.assertRaises(UpcloudTimeoutException, self.destroyer.destroy_node, 1)
 
     def test_timeout_reuse(self):
-        "Verify sleep count is handled properly"
+        """Verify sleep count is handled properly"""
         self.mock_operations.get_node_state.side_effect = ['maintenance'] * 50
         self.assertRaises(UpcloudTimeoutException, self.destroyer.destroy_node, 1)
 

http://git-wip-us.apache.org/repos/asf/libcloud/blob/2c2cbd9c/libcloud/test/compute/test_profitbricks.py
----------------------------------------------------------------------
diff --git a/libcloud/test/compute/test_profitbricks.py b/libcloud/test/compute/test_profitbricks.py
index 0ece89d..62629de 100644
--- a/libcloud/test/compute/test_profitbricks.py
+++ b/libcloud/test/compute/test_profitbricks.py
@@ -45,9 +45,9 @@ class ProfitBricksTests(unittest.TestCase):
 
     def test_list_images(self):
 
-        '''
+        """
         Fetch all images and then fetch with filters
-        '''
+        """
         all_images = self.driver.list_images()
         hdd_images = self.driver.list_images('HDD')
         cdd_images = self.driver.list_images('CDROM')
@@ -617,9 +617,9 @@ class ProfitBricksTests(unittest.TestCase):
         self.assertIn('Resource does not exist', cm.exception.message.value)
 
     def _verify_snapshot(self, snapshot):
-        '''
+        """
         Standard properties
-        '''
+        """
         self.assertEqual(
             snapshot.id,
             'sshot'
@@ -3463,9 +3463,9 @@ class ProfitBricksTests(unittest.TestCase):
         self.assertIn('Resource does not exist', cm.exception.message.value)
 
     def _verify_load_balancer(self, load_balancer):
-        '''
+        """
         Standard properties
-        '''
+        """
         self.assertEqual(
             load_balancer.id,
             'bal-1'


[2/7] libcloud git commit: Simplify chained comparisons

Posted by qu...@apache.org.
Simplify chained comparisons

Signed-off-by: Quentin Pradet <qu...@apache.org>


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

Branch: refs/heads/trunk
Commit: ee1f0fa3e3c33205166d79c13e250db9d295570d
Parents: 24d8709
Author: Rémy Léone <rl...@online.net>
Authored: Fri Mar 16 09:45:59 2018 +0100
Committer: Quentin Pradet <qu...@apache.org>
Committed: Fri Mar 16 19:21:55 2018 +0400

----------------------------------------------------------------------
 libcloud/common/aliyun.py                | 2 +-
 libcloud/common/brightbox.py             | 2 +-
 libcloud/common/openstack.py             | 2 +-
 libcloud/compute/drivers/cloudsigma.py   | 2 +-
 libcloud/compute/drivers/elasticstack.py | 2 +-
 libcloud/compute/drivers/opennebula.py   | 2 +-
 libcloud/dns/drivers/powerdns.py         | 2 +-
 libcloud/storage/drivers/cloudfiles.py   | 2 +-
 libcloud/storage/drivers/oss.py          | 2 +-
 libcloud/storage/drivers/s3.py           | 2 +-
 libcloud/utils/py3.py                    | 4 ++--
 11 files changed, 12 insertions(+), 12 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/libcloud/blob/ee1f0fa3/libcloud/common/aliyun.py
----------------------------------------------------------------------
diff --git a/libcloud/common/aliyun.py b/libcloud/common/aliyun.py
index 634ec44..ea2dfbe 100644
--- a/libcloud/common/aliyun.py
+++ b/libcloud/common/aliyun.py
@@ -45,7 +45,7 @@ class AliyunXmlResponse(XmlResponse):
     namespace = None
 
     def success(self):
-        return self.status >= 200 and self.status < 300
+        return 200 <= self.status < 300
 
     def parse_body(self):
         """

http://git-wip-us.apache.org/repos/asf/libcloud/blob/ee1f0fa3/libcloud/common/brightbox.py
----------------------------------------------------------------------
diff --git a/libcloud/common/brightbox.py b/libcloud/common/brightbox.py
index 77270c0..e3e4dd2 100644
--- a/libcloud/common/brightbox.py
+++ b/libcloud/common/brightbox.py
@@ -29,7 +29,7 @@ except ImportError:
 
 class BrightboxResponse(JsonResponse):
     def success(self):
-        return self.status >= httplib.OK and self.status < httplib.BAD_REQUEST
+        return httplib.OK <= self.status < httplib.BAD_REQUEST
 
     def parse_body(self):
         if self.headers['content-type'].split(';')[0] == 'application/json':

http://git-wip-us.apache.org/repos/asf/libcloud/blob/ee1f0fa3/libcloud/common/openstack.py
----------------------------------------------------------------------
diff --git a/libcloud/common/openstack.py b/libcloud/common/openstack.py
index b4367c6..954a15d 100644
--- a/libcloud/common/openstack.py
+++ b/libcloud/common/openstack.py
@@ -345,7 +345,7 @@ class OpenStackResponse(Response):
 
     def success(self):
         i = int(self.status)
-        return i >= 200 and i <= 299
+        return 200 <= i <= 299
 
     def has_content_type(self, content_type):
         content_type_value = self.headers.get('content-type') or ''

http://git-wip-us.apache.org/repos/asf/libcloud/blob/ee1f0fa3/libcloud/compute/drivers/cloudsigma.py
----------------------------------------------------------------------
diff --git a/libcloud/compute/drivers/cloudsigma.py b/libcloud/compute/drivers/cloudsigma.py
index 02818b3..03845d4 100644
--- a/libcloud/compute/drivers/cloudsigma.py
+++ b/libcloud/compute/drivers/cloudsigma.py
@@ -113,7 +113,7 @@ class CloudSigma_1_0_Response(Response):
         if self.status == httplib.UNAUTHORIZED:
             raise InvalidCredsError()
 
-        return self.status >= 200 and self.status <= 299
+        return 200 <= self.status <= 299
 
     def parse_body(self):
         if not self.body:

http://git-wip-us.apache.org/repos/asf/libcloud/blob/ee1f0fa3/libcloud/compute/drivers/elasticstack.py
----------------------------------------------------------------------
diff --git a/libcloud/compute/drivers/elasticstack.py b/libcloud/compute/drivers/elasticstack.py
index 18b581b..5f14663 100644
--- a/libcloud/compute/drivers/elasticstack.py
+++ b/libcloud/compute/drivers/elasticstack.py
@@ -118,7 +118,7 @@ class ElasticStackResponse(JsonResponse):
         if self.status == 401:
             raise InvalidCredsError()
 
-        return self.status >= 200 and self.status <= 299
+        return 200 <= self.status <= 299
 
     def parse_error(self):
         error_header = self.headers.get('x-elastic-error', '')

http://git-wip-us.apache.org/repos/asf/libcloud/blob/ee1f0fa3/libcloud/compute/drivers/opennebula.py
----------------------------------------------------------------------
diff --git a/libcloud/compute/drivers/opennebula.py b/libcloud/compute/drivers/opennebula.py
index 6b94a32..89ee25d 100644
--- a/libcloud/compute/drivers/opennebula.py
+++ b/libcloud/compute/drivers/opennebula.py
@@ -129,7 +129,7 @@ class OpenNebulaResponse(XmlResponse):
         :return: True is success, else False.
         """
         i = int(self.status)
-        return i >= 200 and i <= 299
+        return 200 <= i <= 299
 
     def parse_error(self):
         """

http://git-wip-us.apache.org/repos/asf/libcloud/blob/ee1f0fa3/libcloud/dns/drivers/powerdns.py
----------------------------------------------------------------------
diff --git a/libcloud/dns/drivers/powerdns.py b/libcloud/dns/drivers/powerdns.py
index 37bd37c..813bf7a 100644
--- a/libcloud/dns/drivers/powerdns.py
+++ b/libcloud/dns/drivers/powerdns.py
@@ -34,7 +34,7 @@ class PowerDNSResponse(JsonResponse):
 
     def success(self):
         i = int(self.status)
-        return i >= 200 and i <= 299
+        return 200 <= i <= 299
 
     def parse_error(self):
         if self.status == httplib.UNAUTHORIZED:

http://git-wip-us.apache.org/repos/asf/libcloud/blob/ee1f0fa3/libcloud/storage/drivers/cloudfiles.py
----------------------------------------------------------------------
diff --git a/libcloud/storage/drivers/cloudfiles.py b/libcloud/storage/drivers/cloudfiles.py
index 195570a..42af93c 100644
--- a/libcloud/storage/drivers/cloudfiles.py
+++ b/libcloud/storage/drivers/cloudfiles.py
@@ -63,7 +63,7 @@ class CloudFilesResponse(Response):
 
     def success(self):
         i = int(self.status)
-        return i >= 200 and i <= 299 or i in self.valid_response_codes
+        return 200 <= i <= 299 or i in self.valid_response_codes
 
     def parse_body(self):
         if not self.body:

http://git-wip-us.apache.org/repos/asf/libcloud/blob/ee1f0fa3/libcloud/storage/drivers/oss.py
----------------------------------------------------------------------
diff --git a/libcloud/storage/drivers/oss.py b/libcloud/storage/drivers/oss.py
index 820b8b3..004bd4f 100644
--- a/libcloud/storage/drivers/oss.py
+++ b/libcloud/storage/drivers/oss.py
@@ -76,7 +76,7 @@ class OSSResponse(XmlResponse):
 
     def success(self):
         i = int(self.status)
-        return i >= 200 and i <= 299 or i in self.valid_response_codes
+        return 200 <= i <= 299 or i in self.valid_response_codes
 
     def parse_body(self):
         """

http://git-wip-us.apache.org/repos/asf/libcloud/blob/ee1f0fa3/libcloud/storage/drivers/s3.py
----------------------------------------------------------------------
diff --git a/libcloud/storage/drivers/s3.py b/libcloud/storage/drivers/s3.py
index f9f4b6c..e4d48a4 100644
--- a/libcloud/storage/drivers/s3.py
+++ b/libcloud/storage/drivers/s3.py
@@ -89,7 +89,7 @@ class S3Response(AWSBaseResponse):
 
     def success(self):
         i = int(self.status)
-        return i >= 200 and i <= 299 or i in self.valid_response_codes
+        return 200 <= i <= 299 or i in self.valid_response_codes
 
     def parse_error(self):
         if self.status in [httplib.UNAUTHORIZED, httplib.FORBIDDEN]:

http://git-wip-us.apache.org/repos/asf/libcloud/blob/ee1f0fa3/libcloud/utils/py3.py
----------------------------------------------------------------------
diff --git a/libcloud/utils/py3.py b/libcloud/utils/py3.py
index 955cb6e..9914c18 100644
--- a/libcloud/utils/py3.py
+++ b/libcloud/utils/py3.py
@@ -43,10 +43,10 @@ PY2 = False
 PY27 = False
 PY3 = False
 
-if sys.version_info >= (2, 0) and sys.version_info < (3, 0):
+if (2, 0) <= sys.version_info < (3, 0):
     PY2 = True
 
-if sys.version_info >= (2, 7) and sys.version_info < (2, 8):
+if (2, 7) <= sys.version_info < (2, 8):
     PY27 = True
 
 if sys.version_info >= (3, 0):


[5/7] libcloud git commit: Remove trailing semicolon

Posted by qu...@apache.org.
Remove trailing semicolon

Signed-off-by: Quentin Pradet <qu...@apache.org>


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

Branch: refs/heads/trunk
Commit: 56ce2bfa7c031564f06cad469219dbeb350d7be7
Parents: ee1f0fa
Author: Rémy Léone <rl...@online.net>
Authored: Fri Mar 16 10:45:16 2018 +0100
Committer: Quentin Pradet <qu...@apache.org>
Committed: Fri Mar 16 19:21:55 2018 +0400

----------------------------------------------------------------------
 libcloud/compute/drivers/hostvirtual.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/libcloud/blob/56ce2bfa/libcloud/compute/drivers/hostvirtual.py
----------------------------------------------------------------------
diff --git a/libcloud/compute/drivers/hostvirtual.py b/libcloud/compute/drivers/hostvirtual.py
index b5d8784..277f173 100644
--- a/libcloud/compute/drivers/hostvirtual.py
+++ b/libcloud/compute/drivers/hostvirtual.py
@@ -135,7 +135,7 @@ class HostVirtualNodeDriver(NodeDriver):
         >>> from libcloud.compute.base import NodeAuthSSHKey
         >>> key = open('/home/user/.ssh/id_rsa.pub').read()
         >>> auth = NodeAuthSSHKey(pubkey=key)
-        >>> from libcloud.compute.providers import get_driver;
+        >>> from libcloud.compute.providers import get_driver
         >>> driver = get_driver('hostvirtual')
         >>> conn = driver('API_KEY')
         >>> image = conn.list_images()[1]