pin black

This commit is contained in:
Will McGugan
2024-01-29 17:13:20 +00:00
parent bf06f7577f
commit 5fa128e08e
15 changed files with 40 additions and 32 deletions

View File

@@ -17,6 +17,6 @@ jobs:
with:
python-version: 3.11
- name: Install black
run: python -m pip install black
run: python -m pip install black==24.1.1
- name: Run black
run: black --check src

View File

@@ -53,7 +53,7 @@ syntax = ["tree-sitter", "tree_sitter_languages"]
[tool.poetry.group.dev.dependencies]
pytest = "^7.1.3"
black = "^23.1.0"
black = "24.1.1"
mypy = "^1.0.0"
pytest-cov = "^2.12.1"
mkdocs = "^1.3.0"

View File

@@ -347,9 +347,11 @@ class StylesCache:
if label_color.a
else None
),
(base_label_background + label_background).rich_color
if label_background.a
else None,
(
(base_label_background + label_background).rich_color
if label_background.a
else None
),
)
render_label = (label, style)
# Try to save time with expensive call to `render_border_label`:

View File

@@ -2,7 +2,6 @@
A decorator used to create [workers](/guide/workers).
"""
from __future__ import annotations
from functools import partial, wraps
@@ -76,9 +75,11 @@ def work(
def work(
method: Callable[FactoryParamSpec, ReturnType]
| Callable[FactoryParamSpec, Coroutine[None, None, ReturnType]]
| None = None,
method: (
Callable[FactoryParamSpec, ReturnType]
| Callable[FactoryParamSpec, Coroutine[None, None, ReturnType]]
| None
) = None,
*,
name: str = "",
group: str = "default",

View File

@@ -4,7 +4,6 @@ A class to manage [workers](/guide/workers) for an app.
You access this object via [App.workers][textual.app.App.workers] or [Widget.workers][textual.dom.DOMNode.workers].
"""
from __future__ import annotations
import asyncio

View File

@@ -5,7 +5,6 @@ A binding maps a key press on to an action.
See [bindings](/guide/input#bindings) in the guide for details.
"""
from __future__ import annotations
from dataclasses import dataclass

View File

@@ -9,7 +9,6 @@ Additional methods apply actions to all nodes in the query.
If this sounds like JQuery, a (once) popular JS library, it is no coincidence.
"""
from __future__ import annotations
from typing import TYPE_CHECKING, Generic, Iterable, Iterator, TypeVar, cast, overload

View File

@@ -3,7 +3,6 @@ A DOMNode is a base class for any object within the Textual Document Object Mode
which includes all Widgets, Screens, and Apps.
"""
from __future__ import annotations
import re

View File

@@ -2,7 +2,6 @@
Tools for lazy loading widgets.
"""
from __future__ import annotations
from .widget import Widget

View File

@@ -6,7 +6,6 @@ If there is an active Textual app, then log messages will go via the app (and lo
If there is *no* active app, then log messages will go to stderr or stdout, depending on configuration.
"""
import sys
from logging import Handler, LogRecord

View File

@@ -7,6 +7,7 @@ A `MessagePump` is a base class for any object which processes messages, which i
Most of the method here are useful in general app development.
"""
from __future__ import annotations
import asyncio

View File

@@ -3,6 +3,7 @@ Implements the scrollbar-related widgets for internal use.
You will not need to use the widgets defined in this module.
"""
from __future__ import annotations
from math import ceil
@@ -146,18 +147,22 @@ class ScrollBarRender:
if bar_character != " ":
segments[start_index] = _Segment(
bar_character * width_thickness,
_Style(bgcolor=back, color=bar, meta=foreground_meta)
if vertical
else _Style(bgcolor=bar, color=back, meta=foreground_meta),
(
_Style(bgcolor=back, color=bar, meta=foreground_meta)
if vertical
else _Style(bgcolor=bar, color=back, meta=foreground_meta)
),
)
if end_index < len(segments):
bar_character = bars[len_bars - 1 - end_bar]
if bar_character != " ":
segments[end_index] = _Segment(
bar_character * width_thickness,
_Style(bgcolor=bar, color=back, meta=foreground_meta)
if vertical
else _Style(bgcolor=back, color=bar, meta=foreground_meta),
(
_Style(bgcolor=bar, color=back, meta=foreground_meta)
if vertical
else _Style(bgcolor=back, color=bar, meta=foreground_meta)
),
)
else:
style = _Style(bgcolor=back)

View File

@@ -3,7 +3,6 @@ A Strip contains the result of rendering a widget.
See [line API](/guide/widgets#line-api) for how to use Strips.
"""
from __future__ import annotations
from itertools import chain

View File

@@ -440,9 +440,11 @@ class SelectionList(Generic[SelectionType], OptionList):
def _make_selection(
self,
selection: Selection
| tuple[TextType, SelectionType]
| tuple[TextType, SelectionType, bool],
selection: (
Selection
| tuple[TextType, SelectionType]
| tuple[TextType, SelectionType, bool]
),
) -> Selection[SelectionType]:
"""Turn incoming selection data into a `Selection` instance.
@@ -676,10 +678,12 @@ class SelectionList(Generic[SelectionType], OptionList):
def add_option(
self,
item: NewOptionListContent
| Selection
| tuple[TextType, SelectionType]
| tuple[TextType, SelectionType, bool] = None,
item: (
NewOptionListContent
| Selection
| tuple[TextType, SelectionType]
| tuple[TextType, SelectionType, bool]
) = None,
) -> Self:
"""Add a new selection option to the end of the list.

View File

@@ -363,9 +363,11 @@ class TabbedContent(Widget):
# Wrap content in a `TabPane` if required.
pane_content = [
self._set_id(
content
if isinstance(content, TabPane)
else TabPane(title or self.render_str(f"Tab {index}"), content),
(
content
if isinstance(content, TabPane)
else TabPane(title or self.render_str(f"Tab {index}"), content)
),
index,
)
for index, (title, content) in enumerate(