Skip to content

Commit

Permalink
bring typing stubs up-to-date
Browse files Browse the repository at this point in the history
  • Loading branch information
apparebit committed Aug 31, 2024
1 parent 646f63d commit 5eae8c8
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 7 deletions.
21 changes: 16 additions & 5 deletions prettypretty/color/style/__init__.pyi
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
from typing import Self

from .. import Color
from .format import Format
from .. import Color
from ..trans import Translator


class DefaultColor:
"""The default foreground or background color."""
Expand Down Expand Up @@ -242,6 +244,8 @@ class StyleToken:
HiResBackground = StyleToken_HiResBackground

def fidelity(self) -> Fidelity: ...
def cap(self, fidelity: Fidelity, translator: Translator) -> None | Self: ...
def sgr_parameters(self) -> list[int]: ...
def __hash__(self) -> int: ...
def __eq__(self, other: object) -> bool: ...
def __ne__(self, other: object) -> bool: ...
Expand All @@ -253,14 +257,16 @@ class TokenIterator:
def __next__(self) -> Format: ...


def stylist() -> StyleBuilder: ...
# Create a new, empty style builder for assembling fluent styles.
def stylist() -> Stylist: ...
# Create a new, empty style builder for fluently assembling styles.


class StyleBuilder:
class Stylist:
"""A builder for fluently assembling styles."""
@staticmethod
def with_reset() -> Stylist: ...

def __new__(cls) -> Self: ...
def reset(self) -> Self: ...
def bold(self) -> Self: ...
def thin(self) -> Self: ...
def italic(self) -> Self: ...
Expand Down Expand Up @@ -290,8 +296,13 @@ class StyleBuilder:

class Style:
"""A style."""
@staticmethod
def builder() -> Stylist: ...

def tokens(self) -> TokenIterator: ...
def fidelity(self) -> Fidelity: ...
def cap(self, fidelity: Fidelity, translator: Translator) -> Self: ...
def sgr_parameters(self) -> list[int]: ...
def __hash__(self) -> int: ...
def __eq__(self, other: object) -> bool: ...
def __ne__(self, other: object) -> bool: ...
Expand Down
10 changes: 8 additions & 2 deletions prettypretty/color/style/format.pyi
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
from collections.abc import Iterator
from typing import Self

from . import Fidelity


class Attribute:
"""Text attributes other than color."""
Bold: Attribute = ...
Expand All @@ -22,6 +25,7 @@ class Attribute:
@staticmethod
def all() -> AllAttributes: ...

def sgr_parameter(self) -> int: ...
def __hash__(self) -> int: ...
def __eq__(self, other: object) -> bool: ...
def __ne__(self, other: object) -> bool: ...
Expand All @@ -45,8 +49,10 @@ class Format:
def reversed(self) -> Self: ...
def hidden(self) -> Self: ...
def stricken(self) -> Self: ...
def has(self, format: Format) -> bool: ...
def formats(self) -> Iterator[Format]: ...
def has(self, attr: Attribute) -> bool: ...
def attributes(self) -> Iterator[Attribute]: ...
def cap(self, fidelity: Fidelity) -> None | Self: ...
def sgr_parameters(self) -> list[int]: ...
def __invert__(self) -> Self: ...
def __sub__(self, other: Self) -> Self: ...
def __hash__(self) -> int: ...
Expand Down

0 comments on commit 5eae8c8

Please sign in to comment.