diff options
author | robot-piglet <[email protected]> | 2025-09-11 19:12:15 +0300 |
---|---|---|
committer | robot-piglet <[email protected]> | 2025-09-11 19:43:09 +0300 |
commit | 91708f49a58e3c0a1a3cf0a60c268c2d5b474a3e (patch) | |
tree | 9dbcd5cd1811b171ca7636600287d72327ef98ec /contrib/python/prompt-toolkit/py3/prompt_toolkit/styles | |
parent | f4413504c29db8e1e7cce3a2103e89ecb4073271 (diff) |
Intermediate changes
commit_hash:87ab6d7772f084decaa30c0cb439a3e0c000406e
Diffstat (limited to 'contrib/python/prompt-toolkit/py3/prompt_toolkit/styles')
-rw-r--r-- | contrib/python/prompt-toolkit/py3/prompt_toolkit/styles/base.py | 8 | ||||
-rw-r--r-- | contrib/python/prompt-toolkit/py3/prompt_toolkit/styles/style.py | 6 |
2 files changed, 12 insertions, 2 deletions
diff --git a/contrib/python/prompt-toolkit/py3/prompt_toolkit/styles/base.py b/contrib/python/prompt-toolkit/py3/prompt_toolkit/styles/base.py index 06572210a9e..1e044679f0f 100644 --- a/contrib/python/prompt-toolkit/py3/prompt_toolkit/styles/base.py +++ b/contrib/python/prompt-toolkit/py3/prompt_toolkit/styles/base.py @@ -4,7 +4,7 @@ The base classes for the styling. from __future__ import annotations -from abc import ABCMeta, abstractmethod, abstractproperty +from abc import ABCMeta, abstractmethod from typing import Callable, Hashable, NamedTuple __all__ = [ @@ -29,6 +29,7 @@ class Attrs(NamedTuple): blink: bool | None reverse: bool | None hidden: bool | None + dim: bool | None """ @@ -41,6 +42,7 @@ class Attrs(NamedTuple): :param blink: Boolean :param reverse: Boolean :param hidden: Boolean +:param dim: Boolean """ #: The default `Attrs`. @@ -54,6 +56,7 @@ DEFAULT_ATTRS = Attrs( blink=False, reverse=False, hidden=False, + dim=False, ) @@ -123,7 +126,8 @@ class BaseStyle(metaclass=ABCMeta): :param default: `Attrs` to be used if no styling was defined. """ - @abstractproperty + @property + @abstractmethod def style_rules(self) -> list[tuple[str, str]]: """ The list of style rules, used to create this style. diff --git a/contrib/python/prompt-toolkit/py3/prompt_toolkit/styles/style.py b/contrib/python/prompt-toolkit/py3/prompt_toolkit/styles/style.py index fc8b31bd0a6..8aab8e1b21a 100644 --- a/contrib/python/prompt-toolkit/py3/prompt_toolkit/styles/style.py +++ b/contrib/python/prompt-toolkit/py3/prompt_toolkit/styles/style.py @@ -88,6 +88,7 @@ _EMPTY_ATTRS = Attrs( blink=None, reverse=None, hidden=None, + dim=None, ) @@ -151,6 +152,10 @@ def _parse_style_str(style_str: str) -> Attrs: attrs = attrs._replace(hidden=True) elif part == "nohidden": attrs = attrs._replace(hidden=False) + elif part == "dim": + attrs = attrs._replace(dim=True) + elif part == "nodim": + attrs = attrs._replace(dim=False) # Pygments properties that we ignore. elif part in ("roman", "sans", "mono"): @@ -345,6 +350,7 @@ def _merge_attrs(list_of_attrs: list[Attrs]) -> Attrs: blink=_or(False, *[a.blink for a in list_of_attrs]), reverse=_or(False, *[a.reverse for a in list_of_attrs]), hidden=_or(False, *[a.hidden for a in list_of_attrs]), + dim=_or(False, *[a.dim for a in list_of_attrs]), ) |