From a96ef4acdd848444f0604b6744bcaf894652708c Mon Sep 17 00:00:00 2001 From: dhairya05 <83921853+Dhairya-007@users.noreply.github.com> Date: Sat, 28 Nov 2026 19:35:23 +0530 Subject: [PATCH] Remove four no-op self-assignments Each of these is a statement of the form `x = x` where `x` is already a local (a parameter in three cases, and a name assigned two lines earlier in the fourth), so each one reads the name and writes the same value straight back: - `libcloud/common/nttcis.py:2040` `mapping = mapping` - `libcloud/compute/drivers/gridscale.py:367` `template = template` - `libcloud/compute/drivers/nttcis.py:1356` `plan = plan` - `libcloud/storage/drivers/s3.py:989` `response = response` Removing them is behaviour-preserving. They are the kind of line that costs a reader a moment to rule out as load-bearing, which is the only reason to bother. CI does not flag these because the pylint env runs `pylint -E`, and self-assigning-variable is W0127, a warning. `pylint -E --rcfile=./pyproject.toml` passes both before and after this change. `libcloud/common/cloudstack.py:184` is left alone deliberately: there the `command = command` is the body of an `if` branch that exists precisely to leave `command` untouched, so it is a placeholder rather than dead code and removing it would leave an empty block. Co-Authored-By: Claude Opus 5 --- libcloud/common/nttcis.py | 1 - libcloud/compute/drivers/gridscale.py | 1 - libcloud/compute/drivers/nttcis.py | 1 - libcloud/storage/drivers/s3.py | 1 - 4 files changed, 4 deletions(-) diff --git a/libcloud/common/nttcis.py b/libcloud/common/nttcis.py index b105e2d3f9..370f4cab69 100644 --- a/libcloud/common/nttcis.py +++ b/libcloud/common/nttcis.py @@ -2037,7 +2037,6 @@ def processor(mapping, name=None): :type: ``str`` :return: Nothing """ - mapping = mapping # the map_copy will have keys deleted after the key and value are processed map_copy = deepcopy(mapping) diff --git a/libcloud/compute/drivers/gridscale.py b/libcloud/compute/drivers/gridscale.py index 263a83be82..868ce09941 100644 --- a/libcloud/compute/drivers/gridscale.py +++ b/libcloud/compute/drivers/gridscale.py @@ -364,7 +364,6 @@ def _create_volume_from_template(self, size, name, location=None, template=None) :return: newly created StorageVolume :rtype: :class:`.GridscaleVolumeStorage` """ - template = template self.connection.async_request( "objects/storages/", data={ diff --git a/libcloud/compute/drivers/nttcis.py b/libcloud/compute/drivers/nttcis.py index 552ada1f38..e69071ce43 100644 --- a/libcloud/compute/drivers/nttcis.py +++ b/libcloud/compute/drivers/nttcis.py @@ -1353,7 +1353,6 @@ def ex_enable_snapshots(self, node, window, plan="ADVANCED", initiate="true"): update_node = ET.Element("enableSnapshotService", {"xmlns": TYPES_URN}) window_id = window - plan = plan update_node.set("serverId", node) ET.SubElement(update_node, "servicePlan").text = plan ET.SubElement(update_node, "windowId").text = window_id diff --git a/libcloud/storage/drivers/s3.py b/libcloud/storage/drivers/s3.py index 42934a2c89..930dc1d3d8 100644 --- a/libcloud/storage/drivers/s3.py +++ b/libcloud/storage/drivers/s3.py @@ -986,7 +986,6 @@ def _put_object( response = result_dict["response"] bytes_transferred = result_dict["bytes_transferred"] headers = response.headers - response = response server_hash = headers.get("etag", "").replace('"', "") server_side_encryption = headers.get("x-amz-server-side-encryption", None) aws_kms_encryption = server_side_encryption == "aws:kms"