mirror of
https://github.com/Textualize/textual.git
synced 2025-10-17 02:38:12 +03:00
black
This commit is contained in:
@@ -14,6 +14,7 @@ T = TypeVar("T", int, float)
|
||||
|
||||
SummaryFunction = Callable[[Sequence[T]], float]
|
||||
|
||||
|
||||
class Sparkline(Generic[T]):
|
||||
"""A sparkline representing a series of data.
|
||||
|
||||
@@ -100,7 +101,13 @@ if __name__ == "__main__":
|
||||
def last(l: Sequence[T]) -> T:
|
||||
return l[-1]
|
||||
|
||||
funcs: Sequence[SummaryFunction[int]] = (min, max, last, statistics.median, statistics.mean)
|
||||
funcs: Sequence[SummaryFunction[int]] = (
|
||||
min,
|
||||
max,
|
||||
last,
|
||||
statistics.median,
|
||||
statistics.mean,
|
||||
)
|
||||
nums = [10, 2, 30, 60, 45, 20, 7, 8, 9, 10, 50, 13, 10, 6, 5, 4, 3, 7, 20]
|
||||
console.print(f"data = {nums}\n")
|
||||
for f in funcs:
|
||||
|
||||
@@ -63,8 +63,7 @@ class TextOpacity:
|
||||
_from_color = Style.from_color
|
||||
if opacity == 0:
|
||||
for text, style, control in cast(
|
||||
Iterable[tuple[str, Style, object]],
|
||||
segments
|
||||
Iterable[tuple[str, Style, object]], segments
|
||||
):
|
||||
assert style is not None
|
||||
invisible_style = _from_color(bgcolor=style.bgcolor)
|
||||
|
||||
@@ -628,7 +628,9 @@ class Tree(Generic[TreeDataType], ScrollView, can_focus=True):
|
||||
|
||||
root = self.root
|
||||
|
||||
def add_node(path: list[TreeNode[TreeDataType]], node: TreeNode[TreeDataType], last: bool) -> None:
|
||||
def add_node(
|
||||
path: list[TreeNode[TreeDataType]], node: TreeNode[TreeDataType], last: bool
|
||||
) -> None:
|
||||
child_path = [*path, node]
|
||||
node._line = len(lines)
|
||||
add_line(TreeLine(child_path, last))
|
||||
|
||||
Reference in New Issue
Block a user