This is an automated email from the ASF dual-hosted git repository. tomaz pushed a commit to branch trunk in repository https://gitbox.apache.org/repos/asf/libcloud.git
commit bae8e9607caff51605bad40be2dbaa8ac3b550fe Author: Tomaz Muraus <to...@tomaz.me> AuthorDate: Mon Jul 31 12:27:01 2023 +0200 Reformat code with the latest version of black library. --- contrib/generate_contributor_list.py | 1 - contrib/scrape-azure-prices.py | 1 - contrib/scrape-ec2-prices.py | 2 +- docs/examples/container/lxd/example_lxd.py | 1 - libcloud/backup/drivers/dimensiondata.py | 1 - libcloud/common/aliyun.py | 1 - libcloud/common/azure.py | 1 - libcloud/common/azure_arm.py | 1 - libcloud/common/durabledns.py | 1 - libcloud/common/google.py | 1 - libcloud/common/gridscale.py | 1 - libcloud/common/kubernetes.py | 2 -- libcloud/common/nttcis.py | 1 - libcloud/common/vultr.py | 3 --- libcloud/common/xmlrpc.py | 1 - libcloud/compute/drivers/azure.py | 9 ------- libcloud/compute/drivers/cloudstack.py | 7 ------ libcloud/compute/drivers/dimensiondata.py | 3 --- libcloud/compute/drivers/ec2.py | 8 ------ libcloud/compute/drivers/gce.py | 1 - libcloud/compute/drivers/gridscale.py | 1 - libcloud/compute/drivers/internetsolutions.py | 1 - libcloud/compute/drivers/kubevirt.py | 6 ----- libcloud/compute/drivers/linode.py | 1 - libcloud/compute/drivers/ntta.py | 1 - libcloud/compute/drivers/nttcis.py | 3 --- libcloud/compute/drivers/vsphere.py | 4 --- libcloud/container/drivers/docker.py | 5 ---- libcloud/container/drivers/lxd.py | 29 ---------------------- libcloud/container/drivers/rancher.py | 1 - libcloud/dns/drivers/cloudflare.py | 1 - libcloud/dns/drivers/linode.py | 1 - libcloud/dns/drivers/vultr.py | 1 - libcloud/loadbalancer/drivers/alb.py | 4 --- libcloud/loadbalancer/drivers/dimensiondata.py | 1 - libcloud/loadbalancer/drivers/gce.py | 1 - libcloud/loadbalancer/drivers/nttcis.py | 1 - libcloud/pricing.py | 2 +- libcloud/storage/drivers/azure_blobs.py | 1 - libcloud/storage/drivers/backblaze_b2.py | 1 - libcloud/storage/drivers/digitalocean_spaces.py | 3 --- libcloud/storage/drivers/minio.py | 1 - libcloud/storage/drivers/oss.py | 3 +-- libcloud/storage/drivers/rgw.py | 3 --- libcloud/storage/drivers/s3.py | 2 +- libcloud/test/backup/test_dimensiondata_v2_3.py | 1 - libcloud/test/backup/test_dimensiondata_v2_4.py | 1 - libcloud/test/common/test_cloudstack.py | 1 - libcloud/test/common/test_google.py | 1 - libcloud/test/common/test_openstack_identity.py | 8 +++--- libcloud/test/compute/test_abiquo.py | 1 - libcloud/test/compute/test_azure.py | 11 -------- libcloud/test/compute/test_azure_arm.py | 2 -- libcloud/test/compute/test_cloudsigma_v1_0.py | 7 ------ libcloud/test/compute/test_cloudstack.py | 4 --- libcloud/test/compute/test_dimensiondata_v2_3.py | 3 --- libcloud/test/compute/test_dimensiondata_v2_4.py | 3 --- libcloud/test/compute/test_gandi.py | 2 -- libcloud/test/compute/test_kamatera.py | 1 - libcloud/test/compute/test_kubevirt.py | 3 --- libcloud/test/compute/test_nttcis.py | 3 --- libcloud/test/compute/test_openstack.py | 2 -- libcloud/test/compute/test_rackspace.py | 6 ----- libcloud/test/compute/test_rimuhosting.py | 1 - libcloud/test/compute/test_vcloud.py | 10 +++++--- libcloud/test/compute/test_vsphere.py | 2 -- libcloud/test/container/test_lxd.py | 8 ------ libcloud/test/dns/test_liquidweb.py | 1 - libcloud/test/dns/test_luadns.py | 1 - .../test/loadbalancer/test_dimensiondata_v2_3.py | 1 - .../test/loadbalancer/test_dimensiondata_v2_4.py | 1 - libcloud/test/loadbalancer/test_nttcis.py | 2 -- libcloud/test/loadbalancer/test_rackspace.py | 1 - libcloud/test/storage/test_azure_blobs.py | 1 - libcloud/test/storage/test_base.py | 1 - libcloud/test/storage/test_cloudfiles.py | 9 ------- libcloud/test/storage/test_oss.py | 1 - libcloud/test/storage/test_s3.py | 1 - libcloud/test/test_utils.py | 1 - libcloud/utils/decorators.py | 1 - 80 files changed, 15 insertions(+), 213 deletions(-) diff --git a/contrib/generate_contributor_list.py b/contrib/generate_contributor_list.py index 520fe30a3..201c2263d 100755 --- a/contrib/generate_contributor_list.py +++ b/contrib/generate_contributor_list.py @@ -106,7 +106,6 @@ def parse_changes_file(file_path, versions=None): def convert_to_markdown(contributors_map, include_tickets=False): - # Contributors are sorted in ascending lexiographical order based on their # last name def compare(item1, item2): diff --git a/contrib/scrape-azure-prices.py b/contrib/scrape-azure-prices.py index 53ee06b2a..7c33ef55b 100755 --- a/contrib/scrape-azure-prices.py +++ b/contrib/scrape-azure-prices.py @@ -40,7 +40,6 @@ def get_azure_prices(): result = {"windows": {}, "linux": {}} parsed_sizes = {"lowpriority", "basic", "standard"} for offer, value in prices_raw["offers"].items(): - size_raw = offer.split("-") # Servers that go by the core with global price are not yet added if len(size_raw) != 3 or size_raw[2] not in parsed_sizes: diff --git a/contrib/scrape-ec2-prices.py b/contrib/scrape-ec2-prices.py index 6a029ea87..a4b6f5a37 100755 --- a/contrib/scrape-ec2-prices.py +++ b/contrib/scrape-ec2-prices.py @@ -305,7 +305,7 @@ def sort_key_by_numeric_other(key_value): """ result = [] - for (numeric, alpha, other) in RE_NUMERIC_OTHER.findall(key_value[0]): + for numeric, alpha, other in RE_NUMERIC_OTHER.findall(key_value[0]): numeric = int(numeric) if numeric else -1 alpha = INSTANCE_SIZES.index(alpha) if alpha in INSTANCE_SIZES else alpha alpha = str(alpha) diff --git a/docs/examples/container/lxd/example_lxd.py b/docs/examples/container/lxd/example_lxd.py index 7b8d1bf80..55932af6d 100644 --- a/docs/examples/container/lxd/example_lxd.py +++ b/docs/examples/container/lxd/example_lxd.py @@ -123,7 +123,6 @@ def work_with_containers(): def work_with_images(): - print("Working with images...") # LXD host change accordingly diff --git a/libcloud/backup/drivers/dimensiondata.py b/libcloud/backup/drivers/dimensiondata.py index f7d0f1ecd..4ea775067 100644 --- a/libcloud/backup/drivers/dimensiondata.py +++ b/libcloud/backup/drivers/dimensiondata.py @@ -63,7 +63,6 @@ class DimensionDataBackupDriver(BackupDriver): region=DEFAULT_REGION, **kwargs, ): - if region not in API_ENDPOINTS and host is None: raise ValueError("Invalid region: %s, no host specified" % (region)) if region is not None: diff --git a/libcloud/common/aliyun.py b/libcloud/common/aliyun.py index 84ff64813..2414432df 100644 --- a/libcloud/common/aliyun.py +++ b/libcloud/common/aliyun.py @@ -167,7 +167,6 @@ class AliyunConnection(ConnectionUserAndKey): class SignedAliyunConnection(AliyunConnection): - api_version = None def __init__( diff --git a/libcloud/common/azure.py b/libcloud/common/azure.py index 99cff6627..cce42df90 100644 --- a/libcloud/common/azure.py +++ b/libcloud/common/azure.py @@ -191,7 +191,6 @@ class AzureActiveDirectoryConnection(ConnectionUserAndKey): retry_failed=None, *kwargs, ): - # Log in again if the token has expired or is going to expire soon # (next 5 minutes). if (time.time() + 300) >= int(self.expires_on): diff --git a/libcloud/common/azure_arm.py b/libcloud/common/azure_arm.py index 8f849c15b..b8caf3a2b 100644 --- a/libcloud/common/azure_arm.py +++ b/libcloud/common/azure_arm.py @@ -209,7 +209,6 @@ class AzureResourceManagementConnection(ConnectionUserAndKey): return super().connect(**kwargs) def request(self, action, params=None, data=None, headers=None, method="GET", raw=False): - # Log in again if the token has expired or is going to expire soon # (next 5 minutes). if (time.time() + 300) >= int(self.expires_on): diff --git a/libcloud/common/durabledns.py b/libcloud/common/durabledns.py index ff6b74ac6..151640998 100644 --- a/libcloud/common/durabledns.py +++ b/libcloud/common/durabledns.py @@ -160,7 +160,6 @@ class DurableDNSException(Exception): class DurableResponse(XmlResponse): - errors = [] # type: List[Dict] objects = [] # type: List[Dict] diff --git a/libcloud/common/google.py b/libcloud/common/google.py index aa79859db..1869e2e1d 100644 --- a/libcloud/common/google.py +++ b/libcloud/common/google.py @@ -499,7 +499,6 @@ class GoogleInstalledAppAuthConnection(GoogleBaseAuthConnection): access_code = None class AccessCodeReceiver(BaseHTTPRequestHandler): - # noinspection PyMethodParameters,PyPep8Naming def do_GET(self_): # pylint: disable=no-self-argument query = urlparse.urlparse(self_.path).query diff --git a/libcloud/common/gridscale.py b/libcloud/common/gridscale.py index 558222124..1c808f5cf 100644 --- a/libcloud/common/gridscale.py +++ b/libcloud/common/gridscale.py @@ -96,7 +96,6 @@ class GridscaleConnection(ConnectionUserAndKey, PollingConnection): return r def get_poll_request_kwargs(self, response, context, request_kwargs): - endpoint_url = "requests/{}".format(response.object["request_uuid"]) kwargs = {"action": endpoint_url} return kwargs diff --git a/libcloud/common/kubernetes.py b/libcloud/common/kubernetes.py index 465af7df2..f4fadf68a 100644 --- a/libcloud/common/kubernetes.py +++ b/libcloud/common/kubernetes.py @@ -62,7 +62,6 @@ class KubernetesException(Exception): class KubernetesResponse(JsonResponse): - valid_response_codes = [ httplib.OK, httplib.ACCEPTED, @@ -93,7 +92,6 @@ class KubernetesTLSAuthConnection(KeyCertificateConnection): cert_file=None, **kwargs, ): - super().__init__( key_file=key_file, cert_file=cert_file, diff --git a/libcloud/common/nttcis.py b/libcloud/common/nttcis.py index 9519b8c25..5d36dfad6 100644 --- a/libcloud/common/nttcis.py +++ b/libcloud/common/nttcis.py @@ -2293,7 +2293,6 @@ class XmlDictConfig(dict): # It is possible to have duplicate element tags. # If so, convert to a dict of lists if element.tag.split("}")[1] in self: - if isinstance(self[element.tag.split("}")[1]], list): self[element.tag.split("}")[1]].append(dict(element.items())) else: diff --git a/libcloud/common/vultr.py b/libcloud/common/vultr.py index 10f86dc7d..041571521 100644 --- a/libcloud/common/vultr.py +++ b/libcloud/common/vultr.py @@ -38,7 +38,6 @@ DEFAULT_API_VERSION = "2" class VultrResponse(JsonResponse): - objects = None error_dict = {} # type: Dict[str, str] errors = None @@ -55,7 +54,6 @@ class VultrResponse(JsonResponse): } def __init__(self, response, connection): - self.errors = [] super().__init__(response=response, connection=connection) self.objects, self.errors = self.parse_body_and_errors() @@ -90,7 +88,6 @@ class VultrResponse(JsonResponse): return VultrException(error["ERRORCODE"], error["ERRORMESSAGE"]) def success(self): - return len(self.errors) == 0 diff --git a/libcloud/common/xmlrpc.py b/libcloud/common/xmlrpc.py index 278fc404d..e22d91372 100644 --- a/libcloud/common/xmlrpc.py +++ b/libcloud/common/xmlrpc.py @@ -53,7 +53,6 @@ class ErrorCodeMixin: class XMLRPCResponse(ErrorCodeMixin, Response): - defaultExceptionCls = Exception # type: Type[Exception] def success(self): diff --git a/libcloud/compute/drivers/azure.py b/libcloud/compute/drivers/azure.py index 364e0c7d9..b5c29a18f 100644 --- a/libcloud/compute/drivers/azure.py +++ b/libcloud/compute/drivers/azure.py @@ -664,7 +664,6 @@ class AzureNodeDriver(NodeDriver): ) if self._is_storage_service_unique(service_name=ex_storage_service_name): - self._create_storage_account( service_name=ex_storage_service_name, location=_storage_location.service_location, @@ -888,7 +887,6 @@ class AzureNodeDriver(NodeDriver): return result def ex_set_instance_endpoints(self, node, endpoints, ex_deployment_slot="Production"): - """ For example:: @@ -1895,7 +1893,6 @@ class AzureXmlSerializer: affinity_group, extended_properties=None, ): - return AzureXmlSerializer.doc_from_data( "CreateStorageServiceInput", [ @@ -2249,7 +2246,6 @@ class AzureXmlSerializer: or endpoint.load_balancer_probe.port or endpoint.load_balancer_probe.protocol ): - load_balancer_probe = ET.Element("LoadBalancerProbe") input_endpoint.append(load_balancer_probe) AzureXmlSerializer.data_to_xml( @@ -2295,7 +2291,6 @@ class AzureXmlSerializer: system_configuration_set, xml, ): - AzureXmlSerializer.data_to_xml([("RoleName", role_name)], xml) AzureXmlSerializer.data_to_xml([("RoleType", role_type)], xml) @@ -2396,7 +2391,6 @@ class AzureXmlSerializer: vm_image_name, role_size, ): - doc = AzureXmlSerializer.doc_from_xml("PersistentVMRole") AzureXmlSerializer.role_to_xml( availability_set_name, @@ -2459,7 +2453,6 @@ class AzureXmlSerializer: virtual_network_name, vm_image_name, ): - doc = AzureXmlSerializer.doc_from_xml("Deployment") AzureXmlSerializer.data_to_xml([("Name", deployment_name)], doc) AzureXmlSerializer.data_to_xml([("DeploymentSlot", deployment_slot)], doc) @@ -2560,7 +2553,6 @@ class AzureXmlSerializer: @staticmethod def extended_properties_dict_to_xml_fragment(extended_properties): - if extended_properties is not None and len(extended_properties) > 0: xml = ET.Element("ExtendedProperties") for key, val in extended_properties.items(): @@ -2595,7 +2587,6 @@ class WindowsAzureData: class WindowsAzureDataTypedList(WindowsAzureData): - list_type = None xml_element_name = None diff --git a/libcloud/compute/drivers/cloudstack.py b/libcloud/compute/drivers/cloudstack.py index e6c6b345f..b92895df7 100644 --- a/libcloud/compute/drivers/cloudstack.py +++ b/libcloud/compute/drivers/cloudstack.py @@ -44,7 +44,6 @@ def transform_int_or_unlimited(value): try: return int(value) except ValueError as e: - if str(value).lower() == "unlimited": return -1 @@ -467,7 +466,6 @@ class CloudStackFirewallRule: start_port=None, end_port=None, ): - """ A Firewall rule. @@ -530,7 +528,6 @@ class CloudStackEgressFirewallRule: start_port=None, end_port=None, ): - """ A egress firewall rule. @@ -1383,7 +1380,6 @@ class CloudStackNodeDriver(CloudStackDriverMixIn, NodeDriver): imgs = self._sync_request(command="listTemplates", params=args, method="GET") images = [] for img in imgs.get("template", []): - extra = { "hypervisor": img["hypervisor"], "format": img["format"], @@ -2114,7 +2110,6 @@ class CloudStackNodeDriver(CloudStackDriverMixIn, NodeDriver): networks = [] for vpc in vpcs: - networks.append( CloudStackVPC( vpc["name"], @@ -2146,7 +2141,6 @@ class CloudStackNodeDriver(CloudStackDriverMixIn, NodeDriver): routers = [] for router in rts: - routers.append( CloudStackRouter( router["id"], @@ -4206,7 +4200,6 @@ class CloudStackNodeDriver(CloudStackDriverMixIn, NodeDriver): return True def ex_detach_nic_from_node(self, nic, node): - """ Remove Nic from a VM diff --git a/libcloud/compute/drivers/dimensiondata.py b/libcloud/compute/drivers/dimensiondata.py index dca4b18f5..1d0148a89 100644 --- a/libcloud/compute/drivers/dimensiondata.py +++ b/libcloud/compute/drivers/dimensiondata.py @@ -120,7 +120,6 @@ class DimensionDataNodeDriver(NodeDriver): region=DEFAULT_REGION, **kwargs, ): - if region not in API_ENDPOINTS and host is None: raise ValueError("Invalid region: %s, no host specified" % (region)) if region is not None: @@ -2723,7 +2722,6 @@ class DimensionDataNodeDriver(NodeDriver): value_required=None, display_on_report=None, ): - """ Modify a specific tag key @@ -3720,7 +3718,6 @@ class DimensionDataNodeDriver(NodeDriver): ex_tagid_value_pairs=None, ex_tagname_value_pairs=None, ): - """ This MCP 2.0 only function deploys a new Cloud Server from a CloudControl compatible Server Image, which does not utilize diff --git a/libcloud/compute/drivers/ec2.py b/libcloud/compute/drivers/ec2.py index 9a3e2eaba..506e6f6cb 100644 --- a/libcloud/compute/drivers/ec2.py +++ b/libcloud/compute/drivers/ec2.py @@ -3048,7 +3048,6 @@ class BaseEC2NodeDriver(NodeDriver): try: results.append(self.connection.request(self.path, params=params.copy()).object) except Exception as e: - if e.args[0].find("InvalidPermission.Duplicate") == -1: raise e return results @@ -3346,7 +3345,6 @@ class BaseEC2NodeDriver(NodeDriver): for node_id in node_instance_ids: nodes_elastic_ip_mappings.setdefault(node_id, []) for addr in self._to_addresses(result, only_associated): - instance_id = addr.instance_id if node_id == instance_id: @@ -4397,7 +4395,6 @@ class BaseEC2NodeDriver(NodeDriver): ] def _to_image(self, element): - id = findtext(element=element, xpath="imageId", namespace=NAMESPACE) name = findtext(element=element, xpath="name", namespace=NAMESPACE) @@ -4410,7 +4407,6 @@ class BaseEC2NodeDriver(NodeDriver): xpath="billingProducts/item/billingProduct", namespace=NAMESPACE, ): - billing_products.append(p.text) # Get our tags @@ -4764,7 +4760,6 @@ class BaseEC2NodeDriver(NodeDriver): for item in findall( element=element, xpath="privateIpAddressesSet/item", namespace=NAMESPACE ): - priv_ips.append( { "private_ip": findtext( @@ -5968,7 +5963,6 @@ class OutscaleNodeDriver(BaseEC2NodeDriver): return is_truncated, quota def _to_product_type(self, elem): - productTypeId = findtext(element=elem, xpath="productTypeId", namespace=OUTSCALE_NAMESPACE) description = findtext(element=elem, xpath="description", namespace=OUTSCALE_NAMESPACE) @@ -6001,7 +5995,6 @@ class OutscaleNodeDriver(BaseEC2NodeDriver): return product_type def _to_product_types(self, elem): - product_types = [] for product_types_item in findall( element=elem, xpath="productTypeSet/item", namespace=OUTSCALE_NAMESPACE @@ -6044,7 +6037,6 @@ class OutscaleNodeDriver(BaseEC2NodeDriver): return product_types def _to_instance_types(self, elem): - instance_types = [] for instance_types_item in findall( element=elem, xpath="instanceTypeSet/item", namespace=OUTSCALE_NAMESPACE diff --git a/libcloud/compute/drivers/gce.py b/libcloud/compute/drivers/gce.py index c8a140af5..49b50c207 100644 --- a/libcloud/compute/drivers/gce.py +++ b/libcloud/compute/drivers/gce.py @@ -496,7 +496,6 @@ class GCEBackend(UuidMixin): capacity_scaler=1, description=None, ): - if isinstance(instance_group, GCEInstanceGroup): self.instance_group = instance_group elif isinstance(instance_group, GCEInstanceGroupManager): diff --git a/libcloud/compute/drivers/gridscale.py b/libcloud/compute/drivers/gridscale.py index 479ea0b44..c68c482f6 100644 --- a/libcloud/compute/drivers/gridscale.py +++ b/libcloud/compute/drivers/gridscale.py @@ -650,7 +650,6 @@ class GridscaleNodeDriver(GridscaleBaseDriver, NodeDriver): return True else: - return False def import_key_pair_from_string(self, name, key_material): diff --git a/libcloud/compute/drivers/internetsolutions.py b/libcloud/compute/drivers/internetsolutions.py index b668f8e3e..32cc42439 100644 --- a/libcloud/compute/drivers/internetsolutions.py +++ b/libcloud/compute/drivers/internetsolutions.py @@ -47,7 +47,6 @@ class InternetSolutionsNodeDriver(DimensionDataNodeDriver): region=DEFAULT_REGION, **kwargs, ): - if region not in API_ENDPOINTS: raise ValueError("Invalid region: %s" % (region)) diff --git a/libcloud/compute/drivers/kubevirt.py b/libcloud/compute/drivers/kubevirt.py index e5f8b4afe..a76293d9d 100644 --- a/libcloud/compute/drivers/kubevirt.py +++ b/libcloud/compute/drivers/kubevirt.py @@ -438,7 +438,6 @@ class KubeVirtNodeDriver(KubernetesDriverMixin, NodeDriver): data = json.dumps(vm) req = KUBEVIRT_URL + "namespaces/" + namespace + "/virtualmachines/" try: - self.connection.request(req, method=method, data=data) except Exception: @@ -486,7 +485,6 @@ class KubeVirtNodeDriver(KubernetesDriverMixin, NodeDriver): return namespaces def list_sizes(self, location=None): - namespace = "" if location: namespace = location.name @@ -678,7 +676,6 @@ class KubeVirtNodeDriver(KubernetesDriverMixin, NodeDriver): raise if result.object["status"]["phase"] != "Bound": for _ in range(3): - req = ROOT_URL + "namespaces/" + namespace + "/persistentvolumeclaims/" + name try: result = self.connection.request(req).object @@ -861,7 +858,6 @@ class KubeVirtNodeDriver(KubernetesDriverMixin, NodeDriver): raise def ex_list_persistent_volume_claims(self, namespace="default"): - pvc_req = ROOT_URL + "namespaces/" + namespace + "/persistentvolumeclaims" try: result = self.connection.request(pvc_req).object @@ -871,7 +867,6 @@ class KubeVirtNodeDriver(KubernetesDriverMixin, NodeDriver): return pvcs def ex_list_storage_classes(self): - # sc = storage class sc_req = "/apis/storage.k8s.io/v1/storageclasses" try: @@ -940,7 +935,6 @@ class KubeVirtNodeDriver(KubernetesDriverMixin, NodeDriver): if "memory" in vm["spec"]["template"]["spec"]["domain"]["resources"]["limits"]: memory = vm["spec"]["template"]["spec"]["domain"]["resources"]["limits"]["memory"] elif vm["spec"]["template"]["spec"]["domain"]["resources"].get("requests", None): - if vm["spec"]["template"]["spec"]["domain"]["resources"]["requests"].get( "memory", None ): diff --git a/libcloud/compute/drivers/linode.py b/libcloud/compute/drivers/linode.py index 2df7000ac..50f2fefdd 100644 --- a/libcloud/compute/drivers/linode.py +++ b/libcloud/compute/drivers/linode.py @@ -799,7 +799,6 @@ class LinodeNodeDriverV3(LinodeNodeDriver): class LinodeNodeDriverV4(LinodeNodeDriver): - connectionCls = LinodeConnectionV4 _linode_disk_filesystems = LINODE_DISK_FILESYSTEMS_V4 diff --git a/libcloud/compute/drivers/ntta.py b/libcloud/compute/drivers/ntta.py index 04de2cc71..f47d2fc11 100644 --- a/libcloud/compute/drivers/ntta.py +++ b/libcloud/compute/drivers/ntta.py @@ -47,7 +47,6 @@ class NTTAmericaNodeDriver(DimensionDataNodeDriver): region=DEFAULT_REGION, **kwargs, ): - if region not in API_ENDPOINTS: raise ValueError("Invalid region: %s" % (region)) diff --git a/libcloud/compute/drivers/nttcis.py b/libcloud/compute/drivers/nttcis.py index 040e46849..a0d82868b 100644 --- a/libcloud/compute/drivers/nttcis.py +++ b/libcloud/compute/drivers/nttcis.py @@ -123,7 +123,6 @@ class NttCisNodeDriver(NodeDriver): region=DEFAULT_REGION, **kwargs, ): - if region not in API_ENDPOINTS and host is None: raise ValueError("Invalid region: %s, no host specified" % (region)) if region is not None: @@ -3256,7 +3255,6 @@ class NttCisNodeDriver(NodeDriver): value_required=None, display_on_report=None, ): - """ Modify a specific tag key @@ -4282,7 +4280,6 @@ class NttCisNodeDriver(NodeDriver): ex_tagid_value_pairs=None, ex_tagname_value_pairs=None, ): - """ This MCP 2.0 only function deploys a new Cloud Server from a CloudControl compatible Server Image, which does not utilize diff --git a/libcloud/compute/drivers/vsphere.py b/libcloud/compute/drivers/vsphere.py index 692248a98..3c4e45738 100644 --- a/libcloud/compute/drivers/vsphere.py +++ b/libcloud/compute/drivers/vsphere.py @@ -1200,7 +1200,6 @@ class VSphere_REST_NodeDriver(NodeDriver): ] def __init__(self, key, secret=None, secure=True, host=None, port=443, ca_cert=None): - if not key or not secret: raise InvalidCredsError("Please provide both username " "(key) and password (secret).") super().__init__(key=key, secure=secure, host=host, port=port) @@ -1550,7 +1549,6 @@ class VSphere_REST_NodeDriver(NodeDriver): ex_filter_datacenters=None, ex_filter_connection_states=None, ): - kwargs = { "filter.folders": ex_filter_folders, "filter.names": ex_filter_names, @@ -1782,7 +1780,6 @@ class VSphere_REST_NodeDriver(NodeDriver): return images def ex_list_networks(self): - request = "/rest/vcenter/network" response = self._request(request).object["value"] networks = [] @@ -1950,7 +1947,6 @@ class VSphere_REST_NodeDriver(NodeDriver): ) elif image.extra["type"] == "vm-template": - tp_request = "/rest/vcenter/vm-template/library-items/" + image.id template = self._request(tp_request).object["value"] spec = {} diff --git a/libcloud/container/drivers/docker.py b/libcloud/container/drivers/docker.py index a202c4eec..4f6417636 100644 --- a/libcloud/container/drivers/docker.py +++ b/libcloud/container/drivers/docker.py @@ -41,7 +41,6 @@ VALID_RESPONSE_CODES = [ class DockerResponse(JsonResponse): - valid_response_codes = [ httplib.OK, httplib.ACCEPTED, @@ -102,7 +101,6 @@ class DockerException(Exception): class DockerConnection(ConnectionUserAndKey): - responseCls = DockerResponse timeout = 60 @@ -120,7 +118,6 @@ class DockerConnection(ConnectionUserAndKey): class DockertlsConnection(KeyCertificateConnection): - responseCls = DockerResponse def __init__( @@ -134,7 +131,6 @@ class DockertlsConnection(KeyCertificateConnection): cert_file="", **kwargs, ): - super().__init__( key_file=key_file, cert_file=cert_file, @@ -167,7 +163,6 @@ class DockertlsConnection(KeyCertificateConnection): self.cert_file = cert_file def add_default_headers(self, headers): - headers["Content-Type"] = "application/json" return headers diff --git a/libcloud/container/drivers/lxd.py b/libcloud/container/drivers/lxd.py index 3841d3155..46e3c3353 100644 --- a/libcloud/container/drivers/lxd.py +++ b/libcloud/container/drivers/lxd.py @@ -158,7 +158,6 @@ class LXDStoragePool: """ def __init__(self, name, driver, used_by, config, managed): - # the name of the storage pool self.name = name @@ -216,7 +215,6 @@ class LXDServerInfo: @classmethod def build_from_response(cls, metadata): - server_info = LXDServerInfo() server_info.api_extensions = metadata.get("api_extensions", None) server_info.api_status = metadata.get("api_status", None) @@ -228,7 +226,6 @@ class LXDServerInfo: return server_info def __init__(self): - # List of API extensions added after # the API was marked stable self.api_extensions = None @@ -278,7 +275,6 @@ class LXDResponse(JsonResponse): ] def parse_body(self): - if len(self.body) == 0 and not self.parse_zero_length_body: return self.body @@ -334,7 +330,6 @@ class LXDConnection(ConnectionUserAndKey): class LXDtlsConnection(KeyCertificateConnection): - responseCls = LXDResponse def __init__( @@ -350,7 +345,6 @@ class LXDtlsConnection(KeyCertificateConnection): certificate_validator=None, **kwargs, ): - if certificate_validator is not None: certificate_validator(key_file=key_file, cert_file=cert_file) else: @@ -419,9 +413,7 @@ class LXDContainerDriver(ContainerDriver): ca_cert=None, certificate_validator=check_certificates, ): - if key_file: - if not cert_file: # LXD tls authentication- # We pass two files, a key_file with the @@ -467,7 +459,6 @@ class LXDContainerDriver(ContainerDriver): self.version = self._get_api_version() def build_operation_websocket_url(self, uuid, w_secret): - uri = "wss://%s:%s/%s/operations/%s/" "websocket?secret=%s" % ( self.connection.host, self.connection.port, @@ -524,7 +515,6 @@ class LXDContainerDriver(ContainerDriver): ex_instance_type=None, ex_timeout=default_time_out, ): - """ Create a new container Authentication: trusted @@ -579,7 +569,6 @@ class LXDContainerDriver(ContainerDriver): parameters = json.loads(parameters) if parameters["source"].get("mode", None) == "pull": - try: # this means the image must be downloaded image = self.install_image(path=None, ex_timeout=ex_timeout, **parameters) @@ -623,7 +612,6 @@ class LXDContainerDriver(ContainerDriver): return container def get_container(self, id, ex_get_ip_addr=True): - """ Get a container by ID @@ -748,7 +736,6 @@ class LXDContainerDriver(ContainerDriver): ) def ex_freeze_container(self, container, ex_timeout=default_time_out): - """ Set the given container into a freeze state @@ -770,7 +757,6 @@ class LXDContainerDriver(ContainerDriver): ) def ex_unfreeze_container(self, container, ex_timeout=default_time_out): - """ Set the given container into unfreeze state @@ -819,14 +805,12 @@ class LXDContainerDriver(ContainerDriver): raise self._get_lxd_api_exception_for_error(err) try: - # wait until the timeout...but util getting here the operation # may have finished already id = response_dict["metadata"]["id"] req = "/{}/operations/{}/wait?timeout={}".format(self.version, id, ex_timeout) response = self.connection.request(req) except BaseHTTPError as err: - lxd_exception = self._get_lxd_api_exception_for_error(err) # if not found assume the operation completed if lxd_exception.message != "not found": @@ -952,7 +936,6 @@ class LXDContainerDriver(ContainerDriver): ) elif input["wait-for-websocket"] is True and input["interactive"] is True: - return LXDContainerExecuteResult( uuid=uuid, secret_0=fds["0"], @@ -964,7 +947,6 @@ class LXDContainerDriver(ContainerDriver): ) elif input["interactive"] is False and input["record-output"] is True: - output = response_dict["metadata"]["metadata"]["output"] result = response_dict["metadata"]["metadata"]["result"] return LXDContainerExecuteResult( @@ -978,7 +960,6 @@ class LXDContainerDriver(ContainerDriver): ) else: - result = response_dict["metadata"]["metadata"]["result"] return LXDContainerExecuteResult( uuid=uuid, @@ -1054,7 +1035,6 @@ class LXDContainerDriver(ContainerDriver): return self._to_image(metadata=response_dict["metadata"]) def install_image(self, path, ex_timeout=default_time_out, **ex_img_data): - """ Install a container image from a remote path. Not that the path currently is not used. Image data should be provided @@ -1101,14 +1081,12 @@ class LXDContainerDriver(ContainerDriver): assert_response(response_dict=response_dict, status_code=100) try: - # wait until the timeout...but until getting here the operation # may have finished already id = response_dict["metadata"]["id"] req = "/{}/operations/{}/wait?timeout={}".format(self.version, id, ex_timeout) response = self.connection.request(req) except BaseHTTPError as err: - lxd_exception = self._get_lxd_api_exception_for_error(err) # if not found assume the operation completed if lxd_exception.message != "not found": @@ -1234,7 +1212,6 @@ class LXDContainerDriver(ContainerDriver): return self._to_storage_pool(data=response_dict["metadata"]) def ex_create_storage_pool(self, definition): - """ Create a storage_pool from definition. @@ -1338,7 +1315,6 @@ class LXDContainerDriver(ContainerDriver): type = volume[-2] if not detailed: - metadata = { "config": {"size": None}, "name": name, @@ -1393,7 +1369,6 @@ class LXDContainerDriver(ContainerDriver): pools = response_dict["metadata"] for pool in pools: - pool_id = pool.split("/")[-1] volumes = self.ex_list_storage_pool_volumes(pool_id=pool_id) @@ -1405,7 +1380,6 @@ class LXDContainerDriver(ContainerDriver): return None def create_volume(self, pool_id, definition, **kwargs): - """ Create a new storage volume on a given storage pool Operation: sync or async (when copying an existing volume) @@ -1460,14 +1434,12 @@ class LXDContainerDriver(ContainerDriver): assert_response(response_dict=response_dict, status_code=100) try: - # wait until the timeout...but util getting here the operation # may have finished already oid = response_dict["metadata"]["id"] req = "/{}/operations/{}/wait?timeout={}".format(self.version, oid, ex_timeout) response = self.connection.request(req) except BaseHTTPError as err: - lxd_exception = self._get_lxd_api_exception_for_error(err) # if not found assume the operation completed if lxd_exception.message != "not found": @@ -1517,7 +1489,6 @@ class LXDContainerDriver(ContainerDriver): """ try: - req = "/{}/storage-pools/{}/volumes/{}/{}".format( self.version, pool_id, diff --git a/libcloud/container/drivers/rancher.py b/libcloud/container/drivers/rancher.py index 8bf423dd1..1e68d5f4e 100644 --- a/libcloud/container/drivers/rancher.py +++ b/libcloud/container/drivers/rancher.py @@ -66,7 +66,6 @@ class RancherException(Exception): class RancherConnection(ConnectionUserAndKey): - responseCls = RancherResponse timeout = 30 diff --git a/libcloud/dns/drivers/cloudflare.py b/libcloud/dns/drivers/cloudflare.py index 12d2db578..7cf02eb06 100644 --- a/libcloud/dns/drivers/cloudflare.py +++ b/libcloud/dns/drivers/cloudflare.py @@ -200,7 +200,6 @@ class CloudFlareDNSDriver(DNSDriver): MEMBERSHIPS_PAGE_SIZE = 50 def __init__(self, key, secret=None, secure=True, host=None, port=None, **kwargs): - if secret is None: self.connectionCls = TokenDNSConnection diff --git a/libcloud/dns/drivers/linode.py b/libcloud/dns/drivers/linode.py index 45d7480c1..b2f609f25 100644 --- a/libcloud/dns/drivers/linode.py +++ b/libcloud/dns/drivers/linode.py @@ -87,7 +87,6 @@ class LinodeDNSDriver(DNSDriver): api_version=DEFAULT_API_VERSION, **kwargs, ): - if cls is LinodeDNSDriver: if api_version == "3.0": cls = LinodeDNSDriverV3 diff --git a/libcloud/dns/drivers/vultr.py b/libcloud/dns/drivers/vultr.py index e147f59c8..bdff9bdfc 100644 --- a/libcloud/dns/drivers/vultr.py +++ b/libcloud/dns/drivers/vultr.py @@ -93,7 +93,6 @@ class VultrDNSDriver(DNSDriver): class VultrDNSDriverV1(VultrDNSDriver): - connectionCls = VultrDNSConnection RECORD_TYPE_MAP = { diff --git a/libcloud/loadbalancer/drivers/alb.py b/libcloud/loadbalancer/drivers/alb.py index 34286f4e4..8ab3ea46e 100644 --- a/libcloud/loadbalancer/drivers/alb.py +++ b/libcloud/loadbalancer/drivers/alb.py @@ -68,7 +68,6 @@ class ALBTargetGroup: balancers=[], members=[], ): - self.id = target_group_id self.name = name self.protocol = protocol @@ -135,7 +134,6 @@ class ALBListener: ssl_certificate="", rules=[], ): - self.id = listener_id self.protocol = protocol self.port = port @@ -186,7 +184,6 @@ class ALBRule: conditions={}, listener=None, ): - self.id = rule_id self.is_default = is_default self.priority = priority @@ -882,7 +879,6 @@ class ApplicationLBDriver(Driver): ] def _to_target_group(self, el): - target_group = ALBTargetGroup( target_group_id=findtext(element=el, xpath="TargetGroupArn", namespace=NS), name=findtext(element=el, xpath="TargetGroupName", namespace=NS), diff --git a/libcloud/loadbalancer/drivers/dimensiondata.py b/libcloud/loadbalancer/drivers/dimensiondata.py index 6ff379f8c..11644d44a 100644 --- a/libcloud/loadbalancer/drivers/dimensiondata.py +++ b/libcloud/loadbalancer/drivers/dimensiondata.py @@ -78,7 +78,6 @@ class DimensionDataLBDriver(Driver): region=DEFAULT_REGION, **kwargs, ): - if region not in API_ENDPOINTS and host is None: raise ValueError("Invalid region: %s, no host specified" % (region)) if region is not None: diff --git a/libcloud/loadbalancer/drivers/gce.py b/libcloud/loadbalancer/drivers/gce.py index 13511197f..9fa5eecc8 100644 --- a/libcloud/loadbalancer/drivers/gce.py +++ b/libcloud/loadbalancer/drivers/gce.py @@ -36,7 +36,6 @@ class GCELBDriver(Driver): _VALUE_TO_ALGORITHM_MAP = {"RANDOM": Algorithm.RANDOM} def __init__(self, *args, **kwargs): - if kwargs.get("gce_driver"): self.gce = kwargs["gce_driver"] else: diff --git a/libcloud/loadbalancer/drivers/nttcis.py b/libcloud/loadbalancer/drivers/nttcis.py index 9f660426d..ecd1499f4 100644 --- a/libcloud/loadbalancer/drivers/nttcis.py +++ b/libcloud/loadbalancer/drivers/nttcis.py @@ -82,7 +82,6 @@ class NttCisLBDriver(Driver): region=DEFAULT_REGION, **kwargs, ): - self.network_domain_id = network_domain_id if region not in API_ENDPOINTS and host is None: diff --git a/libcloud/pricing.py b/libcloud/pricing.py index 836cc5d55..496eccb07 100644 --- a/libcloud/pricing.py +++ b/libcloud/pricing.py @@ -193,7 +193,6 @@ def get_size_price(driver_type, driver_name, size_id, region=None): def get_image_price(driver_name, image_name, size_name=None, cores=1): - # for now only images of GCE have pricing data if driver_name == "gce_images": return _get_gce_image_price(image_name=image_name, size_name=size_name, cores=cores) @@ -221,6 +220,7 @@ def _get_gce_image_price(image_name, size_name, cores=1): :rtype: ``float`` :return: Image price """ + # helper function to get image family for gce images def _get_gce_image_family(image_name): image_family = None diff --git a/libcloud/storage/drivers/azure_blobs.py b/libcloud/storage/drivers/azure_blobs.py index 763cbb8ad..1fafbe9ef 100644 --- a/libcloud/storage/drivers/azure_blobs.py +++ b/libcloud/storage/drivers/azure_blobs.py @@ -1221,7 +1221,6 @@ class AzureBlobsStorageDriver(StorageDriver): file_path, headers, ): - headers = headers or {} lease.update_headers(headers) diff --git a/libcloud/storage/drivers/backblaze_b2.py b/libcloud/storage/drivers/backblaze_b2.py index 25b45f399..3ea831101 100644 --- a/libcloud/storage/drivers/backblaze_b2.py +++ b/libcloud/storage/drivers/backblaze_b2.py @@ -554,7 +554,6 @@ class BackblazeB2StorageDriver(StorageDriver): def _perform_upload( self, data, container, object_name, extra=None, verify_hash=True, headers=None ): - if isinstance(data, str): data = bytearray(data) diff --git a/libcloud/storage/drivers/digitalocean_spaces.py b/libcloud/storage/drivers/digitalocean_spaces.py index f898fe91a..5e0bc7bae 100644 --- a/libcloud/storage/drivers/digitalocean_spaces.py +++ b/libcloud/storage/drivers/digitalocean_spaces.py @@ -49,7 +49,6 @@ class DOSpacesConnectionAWS4(SignedAWSConnection, BaseS3Connection): backoff=None, **kwargs, ): - super().__init__( user_id, key, @@ -82,7 +81,6 @@ class DOSpacesConnectionAWS2(S3Connection): backoff=None, **kwargs, ): - super().__init__( user_id, key, @@ -115,7 +113,6 @@ class DigitalOceanSpacesStorageDriver(BaseS3StorageDriver): region=DO_SPACES_DEFAULT_REGION, **kwargs, ): - if region not in DO_SPACES_HOSTS_BY_REGION: raise LibcloudError("Unknown region (%s)" % (region), driver=self) diff --git a/libcloud/storage/drivers/minio.py b/libcloud/storage/drivers/minio.py index 0d4293103..a1bafdd21 100644 --- a/libcloud/storage/drivers/minio.py +++ b/libcloud/storage/drivers/minio.py @@ -39,7 +39,6 @@ class MinIOConnectionAWS4(SignedAWSConnection, BaseS3Connection): backoff=None, **kwargs, ): - super().__init__( user_id, key, diff --git a/libcloud/storage/drivers/oss.py b/libcloud/storage/drivers/oss.py index a3aa4b45c..b43cdaa67 100644 --- a/libcloud/storage/drivers/oss.py +++ b/libcloud/storage/drivers/oss.py @@ -545,7 +545,6 @@ class OSSStorageDriver(StorageDriver): body = response.parse_body() # pylint: disable=maybe-no-member for node in body.findall(fixxpath(xpath="Upload", namespace=self.namespace)): - key = finder(node, "Key") upload_id = finder(node, "UploadId") initiated = finder(node, "Initiated") @@ -884,7 +883,7 @@ class OSSStorageDriver(StorageDriver): root = Element("CompleteMultipartUpload") - for (count, etag) in chunks: + for count, etag in chunks: part = SubElement(root, "Part") part_no = SubElement(part, "PartNumber") part_no.text = str(count) diff --git a/libcloud/storage/drivers/rgw.py b/libcloud/storage/drivers/rgw.py index 088c98838..ba8caede1 100644 --- a/libcloud/storage/drivers/rgw.py +++ b/libcloud/storage/drivers/rgw.py @@ -56,7 +56,6 @@ class S3RGWConnectionAWS4(SignedAWSConnection, BaseS3Connection): backoff=None, **kwargs, ): - super().__init__( user_id, key, @@ -89,7 +88,6 @@ class S3RGWConnectionAWS2(S3Connection): backoff=None, **kwargs, ): - super().__init__( user_id, key, @@ -120,7 +118,6 @@ class S3RGWStorageDriver(BaseS3StorageDriver): region=S3_RGW_DEFAULT_REGION, **kwargs, ): - if host is None: raise LibcloudError("host required", driver=self) diff --git a/libcloud/storage/drivers/s3.py b/libcloud/storage/drivers/s3.py index c17698a6b..a46a7bd00 100644 --- a/libcloud/storage/drivers/s3.py +++ b/libcloud/storage/drivers/s3.py @@ -725,7 +725,7 @@ class BaseS3StorageDriver(StorageDriver): """ root = Element("CompleteMultipartUpload") - for (count, etag) in chunks: + for count, etag in chunks: part = SubElement(root, "Part") part_no = SubElement(part, "PartNumber") part_no.text = str(count) diff --git a/libcloud/test/backup/test_dimensiondata_v2_3.py b/libcloud/test/backup/test_dimensiondata_v2_3.py index eb666cfb0..46110ed7d 100644 --- a/libcloud/test/backup/test_dimensiondata_v2_3.py +++ b/libcloud/test/backup/test_dimensiondata_v2_3.py @@ -303,7 +303,6 @@ class InvalidRequestError(Exception): class DimensionDataMockHttp(MockHttp): - fixtures = BackupFileFixtures("dimensiondata") def _oec_0_9_myaccount_UNAUTHORIZED(self, method, url, body, headers): diff --git a/libcloud/test/backup/test_dimensiondata_v2_4.py b/libcloud/test/backup/test_dimensiondata_v2_4.py index 939a6b5f4..2156c423a 100644 --- a/libcloud/test/backup/test_dimensiondata_v2_4.py +++ b/libcloud/test/backup/test_dimensiondata_v2_4.py @@ -303,7 +303,6 @@ class InvalidRequestError(Exception): class DimensionDataMockHttp(MockHttp): - fixtures = BackupFileFixtures("dimensiondata") def _oec_0_9_myaccount_UNAUTHORIZED(self, method, url, body, headers): diff --git a/libcloud/test/common/test_cloudstack.py b/libcloud/test/common/test_cloudstack.py index 631680bb7..ad49df907 100644 --- a/libcloud/test/common/test_cloudstack.py +++ b/libcloud/test/common/test_cloudstack.py @@ -117,7 +117,6 @@ class CloudStackCommonTest(unittest.TestCase): class CloudStackMockHttp(MockHttp, unittest.TestCase): - ERROR_TEXT = "ERROR TEXT" def _response(self, status, result, response): diff --git a/libcloud/test/common/test_google.py b/libcloud/test/common/test_google.py index 0b4250c61..4303f44aa 100644 --- a/libcloud/test/common/test_google.py +++ b/libcloud/test/common/test_google.py @@ -357,7 +357,6 @@ class GoogleAuthTypeTest(GoogleTestCase): class GoogleOAuth2CredentialTest(GoogleTestCase): - _ia_get_code_patcher = mock.patch( "libcloud.common.google.GoogleInstalledAppAuthConnection.get_code", return_value=1234, diff --git a/libcloud/test/common/test_openstack_identity.py b/libcloud/test/common/test_openstack_identity.py index f8545a3cf..8f6b55066 100644 --- a/libcloud/test/common/test_openstack_identity.py +++ b/libcloud/test/common/test_openstack_identity.py @@ -98,8 +98,8 @@ class OpenStackIdentityConnectionTestCase(unittest.TestCase): user_id = OPENSTACK_PARAMS[0] key = OPENSTACK_PARAMS[1] - for (auth_version, mock_http_class, kwargs) in tuples: - for (url, url_path) in auth_urls: + for auth_version, mock_http_class, kwargs in tuples: + for url, url_path in auth_urls: connection = self._get_mock_connection( mock_http_class=mock_http_class, auth_url=url ) @@ -167,7 +167,7 @@ class OpenStackIdentityConnectionTestCase(unittest.TestCase): user_id = OPENSTACK_PARAMS[0] key = OPENSTACK_PARAMS[1] - for (auth_version, mock_http_class, kwargs) in tuples: + for auth_version, mock_http_class, kwargs in tuples: connection = self._get_mock_connection(mock_http_class=mock_http_class) auth_url = connection.auth_url @@ -313,7 +313,7 @@ class OpenStackIdentityConnectionTestCase(unittest.TestCase): user_id = OPENSTACK_PARAMS[0] key = OPENSTACK_PARAMS[1] - for (auth_version, mock_http_class, kwargs) in tuples: + for auth_version, mock_http_class, kwargs in tuples: mock_http_class.type = None connection = self._get_mock_connection(mock_http_class=mock_http_class) auth_url = connection.auth_url diff --git a/libcloud/test/compute/test_abiquo.py b/libcloud/test/compute/test_abiquo.py index 373463389..13ae1b890 100644 --- a/libcloud/test/compute/test_abiquo.py +++ b/libcloud/test/compute/test_abiquo.py @@ -415,7 +415,6 @@ class AbiquoMockHttp(MockHttp): def _api_cloud_virtualdatacenters_4_virtualappliances_6_virtualmachines_3_tasks_b44fe278_6b0f_4dfb_be81_7c03006a93cb( self, method, url, body, headers ): - if headers["Authorization"] == "Basic dGVuOnNoaW4=": # User 'ten:shin' failed task response = self.fixtures.load("vdc_4_vapp_6_vm_3_deploy_task_failed.xml") diff --git a/libcloud/test/compute/test_azure.py b/libcloud/test/compute/test_azure.py index 5d50b8d3f..b42507c34 100644 --- a/libcloud/test/compute/test_azure.py +++ b/libcloud/test/compute/test_azure.py @@ -118,7 +118,6 @@ class AzureNodeDriverTests(LibcloudTestCase): self.driver.list_nodes(ex_cloud_service_name="dcoddkinztest04") def test_restart_node_success(self): - node = Node( id="dc03", name="dc03", @@ -137,7 +136,6 @@ class AzureNodeDriverTests(LibcloudTestCase): # simulating attempting to reboot a node that is already rebooting def test_restart_node_fail_no_deployment(self): - node = Node( id="dc03", name="dc03", @@ -155,7 +153,6 @@ class AzureNodeDriverTests(LibcloudTestCase): ) def test_restart_node_fail_no_cloud_service(self): - node = Node( id="dc03", name="dc03", @@ -173,7 +170,6 @@ class AzureNodeDriverTests(LibcloudTestCase): ) def test_restart_node_fail_node_not_found(self): - node = Node( id="dc13", name="dc13", @@ -191,7 +187,6 @@ class AzureNodeDriverTests(LibcloudTestCase): self.assertFalse(result) def test_destroy_node_success_single_node_in_cloud_service(self): - node = Node( id="oddkinz1", name="oddkinz1", @@ -207,7 +202,6 @@ class AzureNodeDriverTests(LibcloudTestCase): self.assertTrue(result) def test_destroy_node_success_multiple_nodes_in_cloud_service(self): - node = Node( id="oddkinz1", name="oddkinz1", @@ -223,7 +217,6 @@ class AzureNodeDriverTests(LibcloudTestCase): self.assertTrue(result) def test_destroy_node_fail_node_does_not_exist(self): - node = Node( id="oddkinz2", name="oddkinz2", @@ -241,7 +234,6 @@ class AzureNodeDriverTests(LibcloudTestCase): ) def test_destroy_node_success_cloud_service_not_found(self): - node = Node( id="cloudredis", name="cloudredis", @@ -354,7 +346,6 @@ class AzureNodeDriverTests(LibcloudTestCase): class AzureMockHttp(MockHttp): - fixtures = ComputeFileFixtures("azure") def _3761b98b_673d_526c_8d55_fee918758e6e_services_hostedservices_oddkinz1_deploymentslots_Production( @@ -584,7 +575,6 @@ class AzureMockHttp(MockHttp): def _3761b98b_673d_526c_8d55_fee918758e6e_services_hostedservices_testdcabc2_deploymentslots_Production( self, method, url, body, headers ): - if method == "GET": body = self.fixtures.load( "_3761b98b_673d_526c_8d55_fee918758e6e_services_hostedservices_testdcabc2_deploymentslots_Production.xml" @@ -601,7 +591,6 @@ class AzureMockHttp(MockHttp): def _3761b98b_673d_526c_8d55_fee918758e6e_operations_acc33f6756cda6fd96826394fce4c9f3( self, method, url, body, headers ): - if method == "GET": body = self.fixtures.load( "_3761b98b_673d_526c_8d55_fee918758e6e_operations_acc33f6756cda6fd96826394fce4c9f3.xml" diff --git a/libcloud/test/compute/test_azure_arm.py b/libcloud/test/compute/test_azure_arm.py index 85b320d6b..13fcba9bd 100644 --- a/libcloud/test/compute/test_azure_arm.py +++ b/libcloud/test/compute/test_azure_arm.py @@ -36,7 +36,6 @@ from libcloud.compute.drivers.azure_arm import ( class AzureNodeDriverTests(LibcloudTestCase): - TENANT_ID = "77777777-7777-7777-7777-777777777777" SUBSCRIPTION_ID = "99999999" APPLICATION_ID = "55555555-5555-5555-5555-555555555555" @@ -677,7 +676,6 @@ class AzureNodeDriverTests(LibcloudTestCase): self.assertTrue(isinstance(snaps[3].created, datetime)) def test_list_snapshots_in_resource_group(self): - snaps = self.driver.list_snapshots(ex_resource_group="111111") self.assertEqual(len(snaps), 2) diff --git a/libcloud/test/compute/test_cloudsigma_v1_0.py b/libcloud/test/compute/test_cloudsigma_v1_0.py index d0c3b4d3a..a0deb3a66 100644 --- a/libcloud/test/compute/test_cloudsigma_v1_0.py +++ b/libcloud/test/compute/test_cloudsigma_v1_0.py @@ -152,24 +152,19 @@ class CloudSigmaHttp(MockHttp): return (httplib.OK, body, {}, httplib.responses[httplib.OK]) def _servers_62fe7cde_4fb9_4c63_bd8c_e757930066a0_start(self, method, url, body, headers): - return (httplib.OK, body, {}, httplib.responses[httplib.OK]) def _servers_62fe7cde_4fb9_4c63_bd8c_e757930066a0_stop(self, method, url, body, headers): - return (httplib.NO_CONTENT, body, {}, httplib.responses[httplib.OK]) def _servers_62fe7cde_4fb9_4c63_bd8c_e757930066a0_destroy(self, method, url, body, headers): - return (httplib.NO_CONTENT, body, {}, httplib.responses[httplib.NO_CONTENT]) def _drives_d18119ce_7afa_474a_9242_e0384b160220_clone(self, method, url, body, headers): - body = self.fixtures.load("drives_clone.txt") return (httplib.OK, body, {}, httplib.responses[httplib.OK]) def _drives_a814def5_1789_49a0_bf88_7abe7bb1682a_info(self, method, url, body, headers): - body = self.fixtures.load("drives_single_info.txt") return (httplib.OK, body, {}, httplib.responses[httplib.OK]) @@ -197,11 +192,9 @@ class CloudSigmaHttp(MockHttp): return (httplib.NO_CONTENT, body, {}, httplib.responses[httplib.OK]) def _drives_d18119ce_7afa_474a_9242_e0384b160220_destroy(self, method, url, body, headers): - return (httplib.NO_CONTENT, body, {}, httplib.responses[httplib.OK]) def _servers_62fe7cde_4fb9_4c63_bd8c_e757930066a0_set(self, method, url, body, headers): - body = self.fixtures.load("servers_set.txt") return (httplib.OK, body, {}, httplib.responses[httplib.OK]) diff --git a/libcloud/test/compute/test_cloudstack.py b/libcloud/test/compute/test_cloudstack.py index 469e9691f..6f9907d6e 100644 --- a/libcloud/test/compute/test_cloudstack.py +++ b/libcloud/test/compute/test_cloudstack.py @@ -341,7 +341,6 @@ class CloudStackCommonTestCase(TestCaseMixin): self.assertEqual(network.extra["project_id"], fixture_network["projectid"]) def test_ex_delete_network(self): - network = self.driver.ex_list_networks()[0] result = self.driver.ex_delete_network(network=network) @@ -364,7 +363,6 @@ class CloudStackCommonTestCase(TestCaseMixin): self.assertEqual(nic.mac_address, fixture_nic[i]["macaddress"]) def test_ex_add_nic_to_node(self): - vm = self.driver.list_nodes()[0] network = self.driver.ex_list_networks()[0] ip = "10.1.4.123" @@ -373,7 +371,6 @@ class CloudStackCommonTestCase(TestCaseMixin): self.assertTrue(result) def test_ex_remove_nic_from_node(self): - vm = self.driver.list_nodes()[0] nic = self.driver.ex_list_nics(node=vm)[0] @@ -436,7 +433,6 @@ class CloudStackCommonTestCase(TestCaseMixin): self.assertEqual(vpc.id, fixture_vpc["id"]) def test_ex_delete_vpc(self): - vpc = self.driver.ex_list_vpcs()[0] result = self.driver.ex_delete_vpc(vpc=vpc) diff --git a/libcloud/test/compute/test_dimensiondata_v2_3.py b/libcloud/test/compute/test_dimensiondata_v2_3.py index c0befbeb1..0113de55c 100644 --- a/libcloud/test/compute/test_dimensiondata_v2_3.py +++ b/libcloud/test/compute/test_dimensiondata_v2_3.py @@ -2198,7 +2198,6 @@ class InvalidRequestError(Exception): class DimensionDataMockHttp(MockHttp): - fixtures = ComputeFileFixtures("dimensiondata") def _oec_0_9_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_report_usage( @@ -3472,7 +3471,6 @@ class DimensionDataMockHttp(MockHttp): def _caas_2_3_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_network_createPortList( self, method, url, body, headers ): - request = ET.fromstring(body) if request.tag != "{urn:didata.com:api:cloud:types}" "createPortList": raise InvalidRequestError(request.tag) @@ -3499,7 +3497,6 @@ class DimensionDataMockHttp(MockHttp): def _caas_2_3_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_network_editPortList( self, method, url, body, headers ): - request = ET.fromstring(body) if request.tag != "{urn:didata.com:api:cloud:types}" "editPortList": raise InvalidRequestError(request.tag) diff --git a/libcloud/test/compute/test_dimensiondata_v2_4.py b/libcloud/test/compute/test_dimensiondata_v2_4.py index f26cea53e..ec4c2b3f8 100644 --- a/libcloud/test/compute/test_dimensiondata_v2_4.py +++ b/libcloud/test/compute/test_dimensiondata_v2_4.py @@ -2294,7 +2294,6 @@ class InvalidRequestError(Exception): class DimensionDataMockHttp(MockHttp): - fixtures = ComputeFileFixtures("dimensiondata") def _oec_0_9_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_report_usage( @@ -3572,7 +3571,6 @@ class DimensionDataMockHttp(MockHttp): def _caas_2_4_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_network_createPortList( self, method, url, body, headers ): - request = ET.fromstring(body) if request.tag != "{urn:didata.com:api:cloud:types}" "createPortList": raise InvalidRequestError(request.tag) @@ -3599,7 +3597,6 @@ class DimensionDataMockHttp(MockHttp): def _caas_2_4_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_network_editPortList( self, method, url, body, headers ): - request = ET.fromstring(body) if request.tag != "{urn:didata.com:api:cloud:types}" "editPortList": raise InvalidRequestError(request.tag) diff --git a/libcloud/test/compute/test_gandi.py b/libcloud/test/compute/test_gandi.py index f21eab824..19b9832bb 100644 --- a/libcloud/test/compute/test_gandi.py +++ b/libcloud/test/compute/test_gandi.py @@ -28,7 +28,6 @@ from libcloud.test.common.test_gandi import BaseGandiMockHttp class GandiTests(unittest.TestCase): - node_name = "test2" def setUp(self): @@ -212,7 +211,6 @@ class GandiRatingTests(unittest.TestCase): class GandiMockHttp(BaseGandiMockHttp): - fixtures = ComputeFileFixtures("gandi") def _xmlrpc__hosting_datacenter_list(self, method, url, body, headers): diff --git a/libcloud/test/compute/test_kamatera.py b/libcloud/test/compute/test_kamatera.py index a42e8e1e8..ee16fb3cf 100644 --- a/libcloud/test/compute/test_kamatera.py +++ b/libcloud/test/compute/test_kamatera.py @@ -209,7 +209,6 @@ class KamateraTestDriver(KamateraNodeDriver): class KamateraMockHttp(MockHttp): - fixtures = ComputeFileFixtures("kamatera") def _service_server(self, method, url, body, headers): diff --git a/libcloud/test/compute/test_kubevirt.py b/libcloud/test/compute/test_kubevirt.py index e5afafa32..0d89fac59 100644 --- a/libcloud/test/compute/test_kubevirt.py +++ b/libcloud/test/compute/test_kubevirt.py @@ -24,7 +24,6 @@ from libcloud.test.common.test_kubernetes import KubernetesAuthTestCaseMixin class KubeVirtTestCase(unittest.TestCase, KubernetesAuthTestCaseMixin): - driver_cls = KubeVirtNodeDriver fixtures = ComputeFileFixtures("kubevirt") @@ -84,7 +83,6 @@ class KubeVirtTestCase(unittest.TestCase, KubernetesAuthTestCaseMixin): class KubeVirtMockHttp(MockHttp): - fixtures = ComputeFileFixtures("kubevirt") def _api_v1_namespaces(self, method, url, body, headers): @@ -199,7 +197,6 @@ class KubeVirtMockHttp(MockHttp): return (httplib.OK, body, {}, httplib.responses[httplib.OK]) def _api_v1_namespaces_default_pods(self, method, url, body, headers): - if method == "GET": body = self.fixtures.load("get_pods.json") else: diff --git a/libcloud/test/compute/test_nttcis.py b/libcloud/test/compute/test_nttcis.py index ff45d0863..2a46477ee 100644 --- a/libcloud/test/compute/test_nttcis.py +++ b/libcloud/test/compute/test_nttcis.py @@ -2107,7 +2107,6 @@ class InvalidRequestError(Exception): class NttCisMockHttp(MockHttp): - fixtures = ComputeFileFixtures("nttcis") def _oec_0_9_myaccount_UNAUTHORIZED(self, method, url, body, headers): @@ -3263,7 +3262,6 @@ class NttCisMockHttp(MockHttp): def _caas_2_7_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_network_createPortList( self, method, url, body, headers ): - request = ET.fromstring(body) if request.tag != "{urn:didata.com:api:cloud:types}" "createPortList": raise InvalidRequestError(request.tag) @@ -3290,7 +3288,6 @@ class NttCisMockHttp(MockHttp): def _caas_2_7_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_network_editPortList( self, method, url, body, headers ): - request = ET.fromstring(body) if request.tag != "{urn:didata.com:api:cloud:types}" "editPortList": raise InvalidRequestError(request.tag) diff --git a/libcloud/test/compute/test_openstack.py b/libcloud/test/compute/test_openstack.py index b683249f0..e8bf33222 100644 --- a/libcloud/test/compute/test_openstack.py +++ b/libcloud/test/compute/test_openstack.py @@ -722,7 +722,6 @@ class OpenStackMockHttp(MockHttp, unittest.TestCase): return (httplib.NO_CONTENT, "", {}, httplib.responses[httplib.NO_CONTENT]) def _v1_0_slug_shared_ip_groups(self, method, url, body, headers): - fixture = ( "v1_slug_shared_ip_group.xml" if method == "POST" else "v1_slug_shared_ip_groups.xml" ) @@ -1102,7 +1101,6 @@ class OpenStack_1_1_Tests(unittest.TestCase, TestCaseMixin): self.assertEqual(sizes[0].vcpus, 8) def test_list_sizes_with_specified_pricing(self): - pricing = {str(i): i * 5.0 for i in range(1, 9)} set_pricing(driver_type="compute", driver_name=self.driver.api_name, pricing=pricing) diff --git a/libcloud/test/compute/test_rackspace.py b/libcloud/test/compute/test_rackspace.py index 24b0a67c4..1a05b5ae9 100644 --- a/libcloud/test/compute/test_rackspace.py +++ b/libcloud/test/compute/test_rackspace.py @@ -164,7 +164,6 @@ class BaseRackspaceNovaTestCase: class RackspaceNovaDfwTests(BaseRackspaceNovaTestCase, OpenStack_1_1_Tests): - driver_klass = RackspaceNodeDriver driver_type = RackspaceNodeDriver driver_args = RACKSPACE_NOVA_PARAMS @@ -174,7 +173,6 @@ class RackspaceNovaDfwTests(BaseRackspaceNovaTestCase, OpenStack_1_1_Tests): class RackspaceNovaOrdTests(BaseRackspaceNovaTestCase, OpenStack_1_1_Tests): - driver_klass = RackspaceNodeDriver driver_type = RackspaceNodeDriver driver_args = RACKSPACE_NOVA_PARAMS @@ -184,7 +182,6 @@ class RackspaceNovaOrdTests(BaseRackspaceNovaTestCase, OpenStack_1_1_Tests): class RackspaceNovaIadTests(BaseRackspaceNovaTestCase, OpenStack_1_1_Tests): - driver_klass = RackspaceNodeDriver driver_type = RackspaceNodeDriver driver_args = RACKSPACE_NOVA_PARAMS @@ -194,7 +191,6 @@ class RackspaceNovaIadTests(BaseRackspaceNovaTestCase, OpenStack_1_1_Tests): class RackspaceNovaLonTests(BaseRackspaceNovaTestCase, OpenStack_1_1_Tests): - driver_klass = RackspaceNodeDriver driver_type = RackspaceNodeDriver driver_args = RACKSPACE_NOVA_PARAMS @@ -207,7 +203,6 @@ class RackspaceNovaLonTests(BaseRackspaceNovaTestCase, OpenStack_1_1_Tests): class RackspaceNovaSydTests(BaseRackspaceNovaTestCase, OpenStack_1_1_Tests): - driver_klass = RackspaceNodeDriver driver_type = RackspaceNodeDriver driver_args = RACKSPACE_NOVA_PARAMS @@ -217,7 +212,6 @@ class RackspaceNovaSydTests(BaseRackspaceNovaTestCase, OpenStack_1_1_Tests): class RackspaceNovaHkgTests(BaseRackspaceNovaTestCase, OpenStack_1_1_Tests): - driver_klass = RackspaceNodeDriver driver_type = RackspaceNodeDriver driver_args = RACKSPACE_NOVA_PARAMS diff --git a/libcloud/test/compute/test_rimuhosting.py b/libcloud/test/compute/test_rimuhosting.py index 82f1237b8..3af9fddae 100644 --- a/libcloud/test/compute/test_rimuhosting.py +++ b/libcloud/test/compute/test_rimuhosting.py @@ -72,7 +72,6 @@ class RimuHostingTest(unittest.TestCase, TestCaseMixin): class RimuHostingMockHttp(MockHttp): - fixtures = ComputeFileFixtures("rimuhosting") def _r_orders(self, method, url, body, headers): diff --git a/libcloud/test/compute/test_vcloud.py b/libcloud/test/compute/test_vcloud.py index 3df531e97..981f788bf 100644 --- a/libcloud/test/compute/test_vcloud.py +++ b/libcloud/test/compute/test_vcloud.py @@ -636,7 +636,13 @@ class VCloud_1_5_Tests(unittest.TestCase, TestCaseMixin): def test_change_vm_script_text_and_file_logic(self, _): assertion_error = False - for (vm_script_file, vm_script_text, open_succeeds, open_call_count, returned_early,) in ( + for ( + vm_script_file, + vm_script_text, + open_succeeds, + open_call_count, + returned_early, + ) in ( (None, None, True, 0, True), (None, None, False, 0, True), (None, "script text", True, 0, False), @@ -994,7 +1000,6 @@ class VCloud_5_5_Tests(unittest.TestCase, TestCaseMixin): class TerremarkMockHttp(MockHttp): - fixtures = ComputeFileFixtures("terremark") def _api_v0_8_login(self, method, url, body, headers): @@ -1072,7 +1077,6 @@ class AnotherError(Exception): class VCloud_1_5_MockHttp(MockHttp, unittest.TestCase): - fixtures = ComputeFileFixtures("vcloud_1_5") def request(self, method, url, body=None, headers=None, raw=False, stream=False): diff --git a/libcloud/test/compute/test_vsphere.py b/libcloud/test/compute/test_vsphere.py index c2593d3d7..c328a98d5 100644 --- a/libcloud/test/compute/test_vsphere.py +++ b/libcloud/test/compute/test_vsphere.py @@ -22,7 +22,6 @@ from libcloud.compute.drivers.vsphere import VSphere_REST_NodeDriver class KubeVirtTestCase(unittest.TestCase): - driver_cls = VSphere_REST_NodeDriver fixtures = ComputeFileFixtures("vsphere") @@ -68,7 +67,6 @@ class KubeVirtTestCase(unittest.TestCase): class VSphereMockHttp(MockHttp): - fixtures = ComputeFileFixtures("vsphere") def _rest_com_vmware_cis_session(self, method, url, body, headers): diff --git a/libcloud/test/container/test_lxd.py b/libcloud/test/container/test_lxd.py index 5b5300b71..a9a437c5b 100644 --- a/libcloud/test/container/test_lxd.py +++ b/libcloud/test/container/test_lxd.py @@ -201,7 +201,6 @@ class LXDMockHttp(MockHttp): ) def _linux_124_containers(self, method, url, body, headers): - if method == "GET": return ( httplib.OK, @@ -228,7 +227,6 @@ class LXDMockHttp(MockHttp): ) def _linux_124_containers_second_lxd_container(self, method, url, body, headers): - if method == "PUT" or method == "DELETE": json = self.fixtures.load("linux_124/background_op.json") return (httplib.OK, json, {}, httplib.responses[httplib.OK]) @@ -241,7 +239,6 @@ class LXDMockHttp(MockHttp): ) def _linux_124_containers_first_lxd_container_state(self, method, url, body, headers): - if method == "PUT" or method == "DELETE": json = self.fixtures.load("linux_124/background_op.json") return (httplib.OK, json, {}, httplib.responses[httplib.OK]) @@ -250,7 +247,6 @@ class LXDMockHttp(MockHttp): return (httplib.OK, json, {}, httplib.responses[httplib.OK]) def _linux_124_containers_second_lxd_container_state(self, method, url, body, headers): - if method == "PUT" or method == "DELETE": json = self.fixtures.load("linux_124/background_op.json") return (httplib.OK, json, {}, httplib.responses[httplib.OK]) @@ -267,13 +263,11 @@ class LXDMockHttp(MockHttp): ) def _linux_124_storage_pools(self, method, url, body, header): - if method == "GET": json = self.fixtures.load("linux_124/storage_pools.json") return (httplib.OK, json, {}, httplib.responses[httplib.OK]) def _linux_124_storage_pools_pool1(self, method, url, body, header): - if method == "GET": json = self.fixtures.load("linux_124/storage_pool_1.json") return (httplib.OK, json, {}, httplib.responses[httplib.OK]) @@ -286,7 +280,6 @@ class LXDMockHttp(MockHttp): ) def _linux_124_storage_pools_pool2(self, method, url, body, header): - if method == "GET": json = self.fixtures.load("linux_124/storage_pool_2.json") return (httplib.OK, json, {}, httplib.responses[httplib.OK]) @@ -299,7 +292,6 @@ class LXDMockHttp(MockHttp): ) def _linux_124_storage_pools_pool3(self, method, url, body, header): - if method == "GET": json = self.fixtures.load("linux_124/no_meta_pool.json") return (httplib.OK, json, {}, httplib.responses[httplib.OK]) diff --git a/libcloud/test/dns/test_liquidweb.py b/libcloud/test/dns/test_liquidweb.py index 1e7e3e40e..a0135f127 100644 --- a/libcloud/test/dns/test_liquidweb.py +++ b/libcloud/test/dns/test_liquidweb.py @@ -330,7 +330,6 @@ class LiquidWebMockHttp(MockHttp): return (httplib.OK, body, {}, httplib.responses[httplib.OK]) def _v1_Network_DNS_Record_update(self, method, url, body, headers): - body = self.fixtures.load("update_record.json") return (httplib.OK, body, {}, httplib.responses[httplib.OK]) diff --git a/libcloud/test/dns/test_luadns.py b/libcloud/test/dns/test_luadns.py index 97406d278..cc6cb9455 100644 --- a/libcloud/test/dns/test_luadns.py +++ b/libcloud/test/dns/test_luadns.py @@ -278,7 +278,6 @@ class LuadnsMockHttp(MockHttp): return httplib.OK, body, {}, httplib.responses[httplib.OK] def _v1_zones_31_GET_RECORD_RECORD_DOES_NOT_EXIST(self, method, url, body, headers): - body = self.fixtures.load("get_zone.json") return httplib.OK, body, {}, httplib.responses[httplib.OK] diff --git a/libcloud/test/loadbalancer/test_dimensiondata_v2_3.py b/libcloud/test/loadbalancer/test_dimensiondata_v2_3.py index 7a2b43651..5cdc2b2e1 100644 --- a/libcloud/test/loadbalancer/test_dimensiondata_v2_3.py +++ b/libcloud/test/loadbalancer/test_dimensiondata_v2_3.py @@ -490,7 +490,6 @@ class DimensionData_v2_3_Tests(unittest.TestCase): class DimensionDataMockHttp(MockHttp): - fixtures = LoadBalancerFileFixtures("dimensiondata") def _oec_0_9_myaccount_UNAUTHORIZED(self, method, url, body, headers): diff --git a/libcloud/test/loadbalancer/test_dimensiondata_v2_4.py b/libcloud/test/loadbalancer/test_dimensiondata_v2_4.py index ab3347a4b..e8f02cc2f 100644 --- a/libcloud/test/loadbalancer/test_dimensiondata_v2_4.py +++ b/libcloud/test/loadbalancer/test_dimensiondata_v2_4.py @@ -490,7 +490,6 @@ class DimensionData_v2_4_Tests(unittest.TestCase): class DimensionDataMockHttp(MockHttp): - fixtures = LoadBalancerFileFixtures("dimensiondata") def _oec_0_9_myaccount_UNAUTHORIZED(self, method, url, body, headers): diff --git a/libcloud/test/loadbalancer/test_nttcis.py b/libcloud/test/loadbalancer/test_nttcis.py index 78b1f01c5..bdcfc5b9f 100644 --- a/libcloud/test/loadbalancer/test_nttcis.py +++ b/libcloud/test/loadbalancer/test_nttcis.py @@ -628,7 +628,6 @@ def test_delete_ssl_domain_certificate(driver): class NttCisMockHttp(MockHttp): - fixtures = LoadBalancerFileFixtures("nttcis") def _oec_0_9_myaccount_UNAUTHORIZED(self, method, url, body, headers): @@ -737,7 +736,6 @@ class NttCisMockHttp(MockHttp): def _caas_2_7_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_networkDomainVip_node( self, method, url, body, headers ): - body = self.fixtures.load("networkDomainVip_node.xml") return (httplib.OK, body, {}, httplib.responses[httplib.OK]) diff --git a/libcloud/test/loadbalancer/test_rackspace.py b/libcloud/test/loadbalancer/test_rackspace.py index 4bc86fa27..cf4923dab 100644 --- a/libcloud/test/loadbalancer/test_rackspace.py +++ b/libcloud/test/loadbalancer/test_rackspace.py @@ -1344,7 +1344,6 @@ class RackspaceLBMockHttp(MockHttp, unittest.TestCase): return (httplib.ACCEPTED, "", {}, httplib.responses[httplib.ACCEPTED]) elif method == "POST": - json_body = json.loads(body) access_list = json_body["accessList"] self.assertEqual("ALLOW", access_list[0]["type"]) diff --git a/libcloud/test/storage/test_azure_blobs.py b/libcloud/test/storage/test_azure_blobs.py index 1e6d70e3d..a67e7dd79 100644 --- a/libcloud/test/storage/test_azure_blobs.py +++ b/libcloud/test/storage/test_azure_blobs.py @@ -44,7 +44,6 @@ from libcloud.storage.drivers.azure_blobs import ( class AzureBlobsMockHttp(BaseRangeDownloadMockHttp, unittest.TestCase): - fixtures = StorageFileFixtures("azure_blobs") base_headers = {} diff --git a/libcloud/test/storage/test_base.py b/libcloud/test/storage/test_base.py index 41db0c41f..e9dc72c84 100644 --- a/libcloud/test/storage/test_base.py +++ b/libcloud/test/storage/test_base.py @@ -52,7 +52,6 @@ class BaseStorageTests(unittest.TestCase): self.driver1.strict_mode = False def test__upload_object_iterator_must_have_next_method(self): - valid_iterators = [BytesIO(b("134")), StringIO("bar")] invalid_iterators = ["foobar", "", False, True, 1, object()] diff --git a/libcloud/test/storage/test_cloudfiles.py b/libcloud/test/storage/test_cloudfiles.py index 213406288..4187d9003 100644 --- a/libcloud/test/storage/test_cloudfiles.py +++ b/libcloud/test/storage/test_cloudfiles.py @@ -801,7 +801,6 @@ class CloudFilesTests(unittest.TestCase): expected_headers.update(cors_headers) def intercept_request(request_path, method=None, data=None, headers=None, raw=True): - # What we're actually testing self.assertDictEqual(expected_headers, headers) @@ -841,7 +840,6 @@ class CloudFilesTests(unittest.TestCase): @unittest.skip("Skipping as chunking is disabled in 2.0rc1") def test_upload_object_via_stream_chunked_encoding(self): - # Create enough bytes it should get split into two chunks bytes_blob = "".join(["\0" for _ in range(CHUNK_SIZE + 1)]) hex_chunk_size = ("%X" % CHUNK_SIZE).encode("utf8") @@ -1055,7 +1053,6 @@ class CloudFilesDeprecatedUKTests(CloudFilesTests): class CloudFilesMockHttp(BaseRangeDownloadMockHttp, unittest.TestCase): - fixtures = StorageFileFixtures("cloudfiles") base_headers = {"content-type": "application/json; charset=UTF-8"} @@ -1255,7 +1252,6 @@ class CloudFilesMockHttp(BaseRangeDownloadMockHttp, unittest.TestCase): return (status_code, body, headers, httplib.responses[httplib.OK]) def _v1_MossoCloudFS_foo_bar_container_object_PURGE_SUCCESS(self, method, url, body, headers): - if method == "DELETE": # test_ex_purge_from_cdn headers = self.base_headers @@ -1265,7 +1261,6 @@ class CloudFilesMockHttp(BaseRangeDownloadMockHttp, unittest.TestCase): def _v1_MossoCloudFS_foo_bar_container_object_PURGE_SUCCESS_EMAIL( self, method, url, body, headers ): - if method == "DELETE": # test_ex_purge_from_cdn_with_email self.assertEqual(headers["X-Purge-Email"], "t...@test.com") @@ -1274,7 +1269,6 @@ class CloudFilesMockHttp(BaseRangeDownloadMockHttp, unittest.TestCase): return (status_code, body, headers, httplib.responses[httplib.OK]) def _v1_MossoCloudFS_foo_bar_container_NOT_FOUND(self, method, url, body, headers): - if method == "DELETE": # test_delete_container_not_found body = self.fixtures.load("list_container_objects_empty.json") @@ -1283,7 +1277,6 @@ class CloudFilesMockHttp(BaseRangeDownloadMockHttp, unittest.TestCase): return (status_code, body, headers, httplib.responses[httplib.OK]) def _v1_MossoCloudFS_foo_bar_container_NOT_EMPTY(self, method, url, body, headers): - if method == "DELETE": # test_delete_container_not_empty body = self.fixtures.load("list_container_objects_empty.json") @@ -1292,7 +1285,6 @@ class CloudFilesMockHttp(BaseRangeDownloadMockHttp, unittest.TestCase): return (status_code, body, headers, httplib.responses[httplib.OK]) def _v1_MossoCloudFS_foo_bar_container_foo_bar_object(self, method, url, body, headers): - if method == "DELETE": # test_delete_object_success body = self.fixtures.load("list_container_objects_empty.json") @@ -1398,7 +1390,6 @@ class CloudFilesMockHttp(BaseRangeDownloadMockHttp, unittest.TestCase): def _v1_MossoCloudFS_foo_bar_container_foo_test_stream_data_seek( self, method, url, body, headers ): - # test_upload_object_via_stream_stream_seek_at_end hasher = hashlib.md5() hasher.update(b"123456789") diff --git a/libcloud/test/storage/test_oss.py b/libcloud/test/storage/test_oss.py index 66394d4ce..3debf9d0d 100644 --- a/libcloud/test/storage/test_oss.py +++ b/libcloud/test/storage/test_oss.py @@ -76,7 +76,6 @@ class ObjectTestCase(unittest.TestCase): class OSSMockHttp(MockHttp, unittest.TestCase): - fixtures = StorageFileFixtures("oss") base_headers = {} diff --git a/libcloud/test/storage/test_s3.py b/libcloud/test/storage/test_s3.py index 6efd845ba..46aa60a2b 100644 --- a/libcloud/test/storage/test_s3.py +++ b/libcloud/test/storage/test_s3.py @@ -51,7 +51,6 @@ from libcloud.test.file_fixtures import StorageFileFixtures # pylint: disable-m class S3MockHttp(BaseRangeDownloadMockHttp, unittest.TestCase): - fixtures = StorageFileFixtures("s3") base_headers = {} diff --git a/libcloud/test/test_utils.py b/libcloud/test/test_utils.py index 69d37059b..49a480587 100644 --- a/libcloud/test/test_utils.py +++ b/libcloud/test/test_utils.py @@ -479,7 +479,6 @@ class NetworkingUtilsTestCase(unittest.TestCase): class TestPublicKeyUtils(unittest.TestCase): - PUBKEY = ( "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDOfbWSXOlqvYjZmRO84/lIoV4gvuX+" "P1lLg50MMg6jZjLZIlYY081XPRmuom0xY0+BO++J2KgLl7gxJ6xMsKK2VQ+TakdfAH20" diff --git a/libcloud/utils/decorators.py b/libcloud/utils/decorators.py index 847933f52..1538e3254 100644 --- a/libcloud/utils/decorators.py +++ b/libcloud/utils/decorators.py @@ -34,7 +34,6 @@ def wrap_non_libcloud_exceptions(func): try: return func(*args, **kwargs) except Exception as e: - if isinstance(e, LibcloudError): raise e