From 6dba7fe33f3f508033d1192ef4dbf98707f24140 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Thu, 25 Apr 2024 04:59:48 +0200 Subject: Merging upstream version 0.1.29. Signed-off-by: Daniel Baumann --- typing-stubs/Levenshtein/__init__.pyi | 1 + typing-stubs/README.md | 4 ++++ typing-stubs/colored/__init__.pyi | 8 ++++++++ typing-stubs/colored/attributes.pyi | 14 ++++++++++++++ typing-stubs/colored/background.pyi | 14 ++++++++++++++ typing-stubs/colored/colored.pyi | 30 ++++++++++++++++++++++++++++++ typing-stubs/colored/controls.pyi | 8 ++++++++ typing-stubs/colored/cprint.pyi | 3 +++ typing-stubs/colored/exceptions.pyi | 17 +++++++++++++++++ typing-stubs/colored/foreground.pyi | 14 ++++++++++++++ typing-stubs/colored/hexadecimal.pyi | 7 +++++++ typing-stubs/colored/library.pyi | 17 +++++++++++++++++ typing-stubs/colored/utilities.pyi | 13 +++++++++++++ 13 files changed, 150 insertions(+) create mode 100644 typing-stubs/Levenshtein/__init__.pyi create mode 100644 typing-stubs/README.md create mode 100644 typing-stubs/colored/__init__.pyi create mode 100644 typing-stubs/colored/attributes.pyi create mode 100644 typing-stubs/colored/background.pyi create mode 100644 typing-stubs/colored/colored.pyi create mode 100644 typing-stubs/colored/controls.pyi create mode 100644 typing-stubs/colored/cprint.pyi create mode 100644 typing-stubs/colored/exceptions.pyi create mode 100644 typing-stubs/colored/foreground.pyi create mode 100644 typing-stubs/colored/hexadecimal.pyi create mode 100644 typing-stubs/colored/library.pyi create mode 100644 typing-stubs/colored/utilities.pyi (limited to 'typing-stubs') diff --git a/typing-stubs/Levenshtein/__init__.pyi b/typing-stubs/Levenshtein/__init__.pyi new file mode 100644 index 0000000..a028706 --- /dev/null +++ b/typing-stubs/Levenshtein/__init__.pyi @@ -0,0 +1 @@ +def distance(a: str, b: str) -> int: ... diff --git a/typing-stubs/README.md b/typing-stubs/README.md new file mode 100644 index 0000000..5e307ae --- /dev/null +++ b/typing-stubs/README.md @@ -0,0 +1,4 @@ +# Typing stubs + +This directory contains typing stubs for modules/libraries imported by `debputy` that +does not provide proper typing. diff --git a/typing-stubs/colored/__init__.pyi b/typing-stubs/colored/__init__.pyi new file mode 100644 index 0000000..340b656 --- /dev/null +++ b/typing-stubs/colored/__init__.pyi @@ -0,0 +1,8 @@ +from .attributes import Style as Style +from .background import Back as Back +from .colored import Colored as Colored, attr as attr, back as back, back_rgb as back_rgb, bg as bg, fg as fg, fore as fore, fore_rgb as fore_rgb, set_tty_aware as set_tty_aware, style as style, stylize as stylize, stylize_interactive as stylize_interactive +from .controls import Controls as Controls +from .cprint import cprint as cprint +from .foreground import Fore as Fore + +__version__: str diff --git a/typing-stubs/colored/attributes.pyi b/typing-stubs/colored/attributes.pyi new file mode 100644 index 0000000..d7fc0ab --- /dev/null +++ b/typing-stubs/colored/attributes.pyi @@ -0,0 +1,14 @@ +from .exceptions import InvalidStyle as InvalidStyle +from .library import Library as Library +from .utilities import Utilities as Utilities + +class MetaStyle(type): + def __getattr__(cls, color: str): ... + +class Style(metaclass=MetaStyle): + @classmethod + def underline_color(cls, color: str | int) -> str: ... + @classmethod + def UNDERLINE_COLOR(cls, color: str | int) -> str: ... + +class style(Style): ... diff --git a/typing-stubs/colored/background.pyi b/typing-stubs/colored/background.pyi new file mode 100644 index 0000000..f98ef99 --- /dev/null +++ b/typing-stubs/colored/background.pyi @@ -0,0 +1,14 @@ +from .exceptions import InvalidColor as InvalidColor +from .library import Library as Library +from .utilities import Utilities as Utilities + +class MetaBack(type): + def __getattr__(cls, color: str): ... + +class Back(metaclass=MetaBack): + @classmethod + def rgb(cls, r: int | str, g: int | str, b: int | str) -> str: ... + @classmethod + def RGB(cls, r: int | str, g: int | str, b: int | str) -> str: ... + +class back(Back): ... diff --git a/typing-stubs/colored/colored.pyi b/typing-stubs/colored/colored.pyi new file mode 100644 index 0000000..8a463ac --- /dev/null +++ b/typing-stubs/colored/colored.pyi @@ -0,0 +1,30 @@ +from .hexadecimal import Hex as Hex +from .library import Library as Library +from .utilities import Utilities as Utilities +from _typeshed import Incomplete +from typing import Any + +TTY_AWARE: bool +IS_TTY: Incomplete + +class Colored: + def __init__(self, name: Any) -> None: ... + def attribute(self, line_color: str = '') -> str: ... + def foreground(self) -> str: ... + def background(self) -> str: ... + @staticmethod + def enable_windows_terminal_mode() -> Any: ... + @staticmethod + def enabled() -> bool: ... + +def style(name: int | str, color: str | int = '') -> str: ... +def fore(name: int | str) -> str: ... +def back(name: int | str) -> str: ... +def fore_rgb(r: int | str, g: int | str, b: int | str) -> str: ... +def back_rgb(r: int | str, g: int | str, b: int | str) -> str: ... +def attr(name: int | str) -> str: ... +def fg(name: int | str) -> str: ... +def bg(name: int | str) -> str: ... +def stylize(text: str, formatting: int | str, reset: bool = True) -> str: ... +def stylize_interactive(text: str, formatting: str, reset: bool = True) -> str: ... +def set_tty_aware(awareness: bool = True) -> None: ... diff --git a/typing-stubs/colored/controls.pyi b/typing-stubs/colored/controls.pyi new file mode 100644 index 0000000..11bf845 --- /dev/null +++ b/typing-stubs/colored/controls.pyi @@ -0,0 +1,8 @@ +from .exceptions import InvalidControl as InvalidControl +from .library import Library as Library +from .utilities import Utilities as Utilities +from _typeshed import Incomplete + +class Controls: + def __init__(self) -> None: ... + def nav(self, name: str, row: int, column: Incomplete | None = None) -> str: ... diff --git a/typing-stubs/colored/cprint.pyi b/typing-stubs/colored/cprint.pyi new file mode 100644 index 0000000..81b942d --- /dev/null +++ b/typing-stubs/colored/cprint.pyi @@ -0,0 +1,3 @@ +from .colored import Colored as Colored + +def cprint(text: str, fore_256: int | str = '', back_256: int | str = '', fore_rgb: tuple = (255, 255, 255), back_rgb: tuple = (0, 0, 0), formatting: int | str = '', line_color: int | str = '', reset: bool = True, **kwargs) -> None: ... diff --git a/typing-stubs/colored/exceptions.pyi b/typing-stubs/colored/exceptions.pyi new file mode 100644 index 0000000..cf3e9b8 --- /dev/null +++ b/typing-stubs/colored/exceptions.pyi @@ -0,0 +1,17 @@ +from _typeshed import Incomplete + +class InvalidColor(Exception): + message: Incomplete + def __init__(self, message: str) -> None: ... + +class InvalidHexColor(Exception): + message: Incomplete + def __init__(self, message: str) -> None: ... + +class InvalidStyle(Exception): + message: Incomplete + def __init__(self, message: str) -> None: ... + +class InvalidControl(Exception): + message: Incomplete + def __init__(self, message: str) -> None: ... diff --git a/typing-stubs/colored/foreground.pyi b/typing-stubs/colored/foreground.pyi new file mode 100644 index 0000000..1bca2ed --- /dev/null +++ b/typing-stubs/colored/foreground.pyi @@ -0,0 +1,14 @@ +from .exceptions import InvalidColor as InvalidColor +from .library import Library as Library +from .utilities import Utilities as Utilities + +class MetaFore(type): + def __getattr__(cls, color: str): ... + +class Fore(metaclass=MetaFore): + @classmethod + def rgb(cls, r: int | str, g: int | str, b: int | str) -> str: ... + @classmethod + def RGB(cls, r: int | str, g: int | str, b: int | str) -> str: ... + +class fore(Fore): ... diff --git a/typing-stubs/colored/hexadecimal.pyi b/typing-stubs/colored/hexadecimal.pyi new file mode 100644 index 0000000..17f376e --- /dev/null +++ b/typing-stubs/colored/hexadecimal.pyi @@ -0,0 +1,7 @@ +from .library import Library as Library + +class Hex: + def find(self, color: str | int) -> str: ... + @staticmethod + def cube(x: int) -> int: ... + def fit(self, hex_val: str, ref: int) -> int: ... diff --git a/typing-stubs/colored/library.pyi b/typing-stubs/colored/library.pyi new file mode 100644 index 0000000..c8ff33a --- /dev/null +++ b/typing-stubs/colored/library.pyi @@ -0,0 +1,17 @@ +from dataclasses import dataclass + +@dataclass +class Library: + ESC: str = ... + END: str = ... + FOREGROUND_256: str = ... + BACKGROUND_256: str = ... + FOREGROUND_RGB: str = ... + BACKGROUND_RGB: str = ... + UNDERLINE_COLOR: str = ... + CONTROLS = ... + STYLES = ... + COLORTERM = ... + COLORS = ... + HEX_COLORS = ... + def __init__(self, ESC, END, FOREGROUND_256, BACKGROUND_256, FOREGROUND_RGB, BACKGROUND_RGB, UNDERLINE_COLOR) -> None: ... diff --git a/typing-stubs/colored/utilities.pyi b/typing-stubs/colored/utilities.pyi new file mode 100644 index 0000000..97a1157 --- /dev/null +++ b/typing-stubs/colored/utilities.pyi @@ -0,0 +1,13 @@ +from .exceptions import InvalidColor as InvalidColor, InvalidControl as InvalidControl, InvalidHexColor as InvalidHexColor, InvalidStyle as InvalidStyle +from .library import Library as Library + +class Utilities: + RGB_MAXIMUM_COLOR: int + colorterm: str + def __init__(self) -> None: ... + def is_color_exist(self, name: str) -> bool: ... + def is_style_exist(self, name: str) -> bool: ... + def is_control_exist(self, name: str) -> bool: ... + def convert_percentages(self, percent: str | int) -> int | str: ... + def set_colorterm(self, colorterm: str = ''): ... + def is_percentage(self, numbers: tuple) -> list: ... -- cgit v1.2.3