Skip to content

Commit

Permalink
[autofix] Format Python
Browse files Browse the repository at this point in the history
  • Loading branch information
kdeldycke committed Nov 3, 2024
1 parent f9f263f commit 76217e1
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 17 deletions.
9 changes: 4 additions & 5 deletions meta_package_manager/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -170,9 +170,9 @@ def update_manager_selection(
# instantiation, we have to reverse the process to get our value.
# Example: --apt-mint => apt_mint => apt-mint
manager_id = param.name.removeprefix("no_").replace("_", "-")
assert (
manager_id == value
), f"unrecognized single manager selector {param.name!r}"
assert manager_id == value, (
f"unrecognized single manager selector {param.name!r}"
)
if param.name.startswith("no_"):
assert isinstance(value, str)
to_remove.add(value)
Expand Down Expand Up @@ -534,8 +534,7 @@ def managers(ctx):
highlight_cli_name(manager.cli_path, manager.cli_names)
if manager.cli_path
else (
f"{', '.join(map(theme.invoked_command, manager.cli_names))} "
"not found"
f"{', '.join(map(theme.invoked_command, manager.cli_names))} not found"
),
)

Expand Down
24 changes: 12 additions & 12 deletions meta_package_manager/managers/winget.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,23 +60,23 @@ def _parse_table(self, output: str) -> Iterator[Generator[str, None, None]]:
"""Parse a table from the output of a winget command and returns a generator of cells."""
# Extract table.
table_start = "Name "
assert (
table_start in output
), f"Cannot find table starting with {table_start!r} in:\n{output}"
assert (
output.count(table_start) == 1
), f"{table_start!r} not unique in:\n{output}"
assert table_start in output, (
f"Cannot find table starting with {table_start!r} in:\n{output}"
)
assert output.count(table_start) == 1, (
f"{table_start!r} not unique in:\n{output}"
)
table = output.split(table_start, 1)[1]

# Check table format.
lines = table.splitlines()
table_width = len(lines[0])
assert (
lines[1] == "-" * table_width
), f"Table headers not followed by expected separator:\n{table}"
assert all(
len(line) <= table_width for line in lines[2:]
), f"Table lines with different width:\n{table}"
assert lines[1] == "-" * table_width, (
f"Table headers not followed by expected separator:\n{table}"
)
assert all(len(line) <= table_width for line in lines[2:]), (
f"Table lines with different width:\n{table}"
)

# Guess column positions.
headers = []
Expand Down

0 comments on commit 76217e1

Please sign in to comment.