Skip to content
This repository has been archived by the owner on Dec 1, 2023. It is now read-only.

Commit

Permalink
fix ruff linter
Browse files Browse the repository at this point in the history
  • Loading branch information
jkanche committed Oct 31, 2023
1 parent 714a7d3 commit c299b0f
Showing 1 changed file with 13 additions and 14 deletions.
27 changes: 13 additions & 14 deletions src/biocgenerics/show_as_cell.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
from typing import Sequence, List, Any, Optional
from functools import singledispatch
from typing import Any, List, Optional, Sequence

__author__ = "Aaron Lun"
__copyright__ = "LTLA"
__license__ = "MIT"

@singledispatch
def show_as_cell(x: Any, indices: Sequence[int]) -> List[str]:
Expand Down Expand Up @@ -38,38 +41,34 @@ def format_table(
floating_names: Optional[Sequence[str]] = None,
sep: str = " ",
window: Optional[int] = None,
):
) -> str:
"""Pretty-print a table with wrapping columns.
Args:
columns:
List of list of strings, where each inner list is the same length.
columns: List of list of strings, where each inner list is the same length.
Strings are typically generated by :py:meth:`~show_as_cell`.
floating_names:
List of strings to be added to the left of the table. This is
floating_names: List of strings to be added to the left of the table. This is
printed repeatedly for each set of wrapped columns.
sep:
Separator between columns.
sep: Separator between columns.
window:
Size of the terminal window, in characters. We attempt to determine
this automatically, otherwise it is set to 150
window: Size of the terminal window, in characters. We attempt to determine
this automatically, otherwise it is set to 150.
Returns:
String containing the pretty-printed table.
str: String containing the pretty-printed table.
"""
if window is None:
import os

try:
window = os.get_terminal_size().columns
except:
except Exception as _:
window = 150

if len(columns) == 0:
raise ValueError("at least one column should be supplied in 'columns'")
raise ValueError("At least one column should be supplied in 'columns'.")
n = len(columns[0])

floatwidth = 0
Expand Down

0 comments on commit c299b0f

Please sign in to comment.