Python code modernization, 8/n (#1179)

* Use to_text instead of to_native.

* Remove no longer needed pylint ignores.

* Remove another pylint ignore.

* Remove no longer needed ignore.

* Address redefined-outer-name.

* Address consider-using-with.
This commit is contained in:
Felix Fontein
2025-10-25 02:36:04 +02:00
committed by GitHub
parent 6ad4bfcd40
commit be000755fc
30 changed files with 156 additions and 150 deletions
@@ -790,17 +790,17 @@ def _preprocess_mounts(
) -> dict[str, t.Any]:
last: dict[str, str] = {}
def check_collision(t: str, name: str) -> None:
if t in last:
if name == last[t]:
def check_collision(target: str, name: str) -> None:
if target in last:
if name == last[target]:
module.fail_json(
msg=f'The mount point "{t}" appears twice in the {name} option'
msg=f'The mount point "{target}" appears twice in the {name} option'
)
else:
module.fail_json(
msg=f'The mount point "{t}" appears both in the {name} and {last[t]} option'
msg=f'The mount point "{target}" appears both in the {name} and {last[target]} option'
)
last[t] = name
last[target] = name
if "mounts" in values:
mounts = []