1
0
Fork 0

Make pylint happier

This commit is contained in:
Maurizio Porrato 2023-08-12 15:50:57 +01:00
parent 7e0b8937e8
commit 2997b64eba
3 changed files with 9 additions and 7 deletions

View File

@ -19,5 +19,5 @@ def check_upgrade(operator: Operator) -> Iterator[CheckResult]:
yield Fail(
f"Channel {channel} has dangling bundles: {dangling_bundles}."
)
except Exception as e:
yield Fail(str(e))
except Exception as exc:
yield Fail(f"{operator}: {exc}")

View File

@ -54,7 +54,7 @@ def _list(
("Replaces", target.csv.get("spec", {}).get("replaces", "")),
("Skips", target.csv.get("spec", {}).get("skips", [])),
]
max_width = max([len(key) for key, _ in info])
max_width = max(len(key) for key, _ in info)
for key, value in info:
message = f"{key.ljust(max_width+1)}: {value}"
print(indent(depth + 1) + message)

View File

@ -39,10 +39,12 @@ def _load_yaml_strict(path: Path) -> Any:
with path.open("r") as yaml_file:
try:
return yaml.safe_load(yaml_file)
except ComposerError:
raise OperatorRepoException(f"{path} contains multiple yaml documents")
except ParserError:
raise OperatorRepoException(f"{path} is not a valid yaml document")
except ComposerError as exc:
raise OperatorRepoException(
f"{path} contains multiple yaml documents"
) from exc
except ParserError as exc:
raise OperatorRepoException(f"{path} is not a valid yaml document") from exc
def load_yaml(path: Path) -> Any: