From 1e1c1803675460b99cb4c99090f5c7e9a88ad4d5 Mon Sep 17 00:00:00 2001 From: Michael Dubner Date: Fri, 6 Dec 2024 19:33:16 +0300 Subject: [PATCH 1/2] Add stubs for "click-log" package --- stubs/click-log/METADATA.toml | 3 +++ stubs/click-log/click_log/__init__.pyi | 4 ++++ stubs/click-log/click_log/core.pyi | 15 +++++++++++++++ stubs/click-log/click_log/options.pyi | 10 ++++++++++ 4 files changed, 32 insertions(+) create mode 100644 stubs/click-log/METADATA.toml create mode 100644 stubs/click-log/click_log/__init__.pyi create mode 100644 stubs/click-log/click_log/core.pyi create mode 100644 stubs/click-log/click_log/options.pyi diff --git a/stubs/click-log/METADATA.toml b/stubs/click-log/METADATA.toml new file mode 100644 index 000000000000..c1548cdc2f5b --- /dev/null +++ b/stubs/click-log/METADATA.toml @@ -0,0 +1,3 @@ +version = "0.4.*" +requires = ["click>=8.0.0"] +upstream_repository = "https://github.com/click-contrib/click-log" diff --git a/stubs/click-log/click_log/__init__.pyi b/stubs/click-log/click_log/__init__.pyi new file mode 100644 index 000000000000..b3d38f6720c0 --- /dev/null +++ b/stubs/click-log/click_log/__init__.pyi @@ -0,0 +1,4 @@ +from .core import ClickHandler as ClickHandler, ColorFormatter as ColorFormatter, basic_config as basic_config +from .options import simple_verbosity_option as simple_verbosity_option + +__version__: str diff --git a/stubs/click-log/click_log/core.pyi b/stubs/click-log/click_log/core.pyi new file mode 100644 index 000000000000..8ee5d99e3596 --- /dev/null +++ b/stubs/click-log/click_log/core.pyi @@ -0,0 +1,15 @@ +import logging + +LOGGER_KEY: str +DEFAULT_LEVEL: int +PY2: bool +text_type: type + +class ColorFormatter(logging.Formatter): + colors: dict[str, dict[str, str]] + def format(self, record: logging.LogRecord) -> str: ... + +class ClickHandler(logging.Handler): + def emit(self, record: logging.LogRecord) -> None: ... + +def basic_config(logger: logging.Logger | str | None = None) -> None: ... diff --git a/stubs/click-log/click_log/options.pyi b/stubs/click-log/click_log/options.pyi new file mode 100644 index 000000000000..7ef610c0fcf6 --- /dev/null +++ b/stubs/click-log/click_log/options.pyi @@ -0,0 +1,10 @@ +import logging +import typing as t +from typing_extensions import TypeAlias + +import click + +_AnyCallable: TypeAlias = t.Callable[..., t.Any] +_FC = t.TypeVar("_FC", bound=_AnyCallable | click.Command) + +def simple_verbosity_option(logger: logging.Logger | str | None = None, *names: str, **kwargs: t.Any) -> t.Callable[[_FC], _FC]: ... From 18fc982263445bf3f5625ce4fffcfdd348980098 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Fri, 6 Dec 2024 17:11:04 +0000 Subject: [PATCH 2/2] [pre-commit.ci] auto fixes from pre-commit.com hooks --- stubs/click-log/click_log/options.pyi | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/stubs/click-log/click_log/options.pyi b/stubs/click-log/click_log/options.pyi index 7ef610c0fcf6..e1310ab8ea44 100644 --- a/stubs/click-log/click_log/options.pyi +++ b/stubs/click-log/click_log/options.pyi @@ -7,4 +7,6 @@ import click _AnyCallable: TypeAlias = t.Callable[..., t.Any] _FC = t.TypeVar("_FC", bound=_AnyCallable | click.Command) -def simple_verbosity_option(logger: logging.Logger | str | None = None, *names: str, **kwargs: t.Any) -> t.Callable[[_FC], _FC]: ... +def simple_verbosity_option( + logger: logging.Logger | str | None = None, *names: str, **kwargs: t.Any +) -> t.Callable[[_FC], _FC]: ...