From 31fff57deb9e8f7d72ddfd5a9bb297d8cf6d3e01 Mon Sep 17 00:00:00 2001 From: James Falcon Date: Tue, 30 Jan 2024 10:55:58 -0600 Subject: [PATCH] refactor: Change variable name for consistent typing (#4823) `line` gets reused in two different loops in cc_mounts, causing mypy to think the later line has the same type as the early line. Change `line` to `entry` to make mypy happy. --- cloudinit/config/cc_mounts.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/cloudinit/config/cc_mounts.py b/cloudinit/config/cc_mounts.py index 4efa2a296d4..1557476015c 100644 --- a/cloudinit/config/cc_mounts.py +++ b/cloudinit/config/cc_mounts.py @@ -573,14 +573,14 @@ def handle(name: str, cfg: Config, cloud: Cloud, args: list) -> None: needswap = False need_mount_all = False dirs = [] - for line in actlist: + for entry in actlist: # write 'comment' in the fs_mntops, entry, claiming this - line[3] = "%s,%s" % (line[3], MNT_COMMENT) - if line[2] == "swap": + entry[3] = "%s,%s" % (entry[3], MNT_COMMENT) + if entry[2] == "swap": needswap = True - if line[1].startswith("/"): - dirs.append(line[1]) - cc_lines.append("\t".join(line)) + if entry[1].startswith("/"): + dirs.append(entry[1]) + cc_lines.append("\t".join(entry)) mount_points = [ v["mountpoint"] for k, v in util.mounts().items() if "mountpoint" in v