From af97aa91ab693c868c49cdf22614ef306991de47229e80fc4ec5bcc4a6e2be00 Mon Sep 17 00:00:00 2001 From: Steve Kowalik Date: Fri, 1 Aug 2025 03:57:19 +0000 Subject: [PATCH] - Add patch support-new-mypy.patch: * Support newer mypy than upstream. OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-loguru?expand=0&rev=33 --- python-loguru.changes | 6 ++++ python-loguru.spec | 5 ++-- support-new-mypy.patch | 68 ++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 77 insertions(+), 2 deletions(-) create mode 100644 support-new-mypy.patch diff --git a/python-loguru.changes b/python-loguru.changes index 07e1b00..7e80221 100644 --- a/python-loguru.changes +++ b/python-loguru.changes @@ -1,3 +1,9 @@ +------------------------------------------------------------------- +Fri Aug 1 03:56:41 UTC 2025 - Steve Kowalik + +- Add patch support-new-mypy.patch: + * Support newer mypy than upstream. + ------------------------------------------------------------------- Wed May 7 05:28:06 UTC 2025 - Guang Yee diff --git a/python-loguru.spec b/python-loguru.spec index 83b350a..2ab7c4c 100644 --- a/python-loguru.spec +++ b/python-loguru.spec @@ -22,9 +22,10 @@ Version: 0.7.3 Release: 0 Summary: Python logging component with a simple interface License: MIT -Group: Development/Languages/Python URL: https://github.com/Delgan/loguru Source: https://github.com/Delgan/loguru/archive/refs/tags/%{version}.tar.gz#/loguru-%{version}.tar.gz +# PATCH-FIX-OPENSUSE Support newer mypy than upstream +Patch0: support-new-mypy.patch BuildRequires: %{python_module colorama} BuildRequires: %{python_module flit-core} BuildRequires: %{python_module freezegun} @@ -68,6 +69,6 @@ fi %license LICENSE %doc README.md %{python_sitelib}/loguru -%{python_sitelib}/loguru-%{version}*-info +%{python_sitelib}/loguru-%{version}.dist-info %changelog diff --git a/support-new-mypy.patch b/support-new-mypy.patch new file mode 100644 index 0000000..5fb12d5 --- /dev/null +++ b/support-new-mypy.patch @@ -0,0 +1,68 @@ +Index: loguru-0.7.3/tests/conftest.py +=================================================================== +--- loguru-0.7.3.orig/tests/conftest.py ++++ loguru-0.7.3/tests/conftest.py +@@ -62,7 +62,6 @@ if sys.version_info >= (3, 6): + item.additional_mypy_config += "\n".join( + [ + "show_error_codes = false", +- "force_uppercase_builtins = true", + "force_union_syntax = true", + ] + ) +Index: loguru-0.7.3/tests/typesafety/test_logger.yml +=================================================================== +--- loguru-0.7.3.orig/tests/typesafety/test_logger.yml ++++ loguru-0.7.3/tests/typesafety/test_logger.yml +@@ -205,7 +205,7 @@ + level = logger.level("INFO") + reveal_type(level) + out: | +- main:4: note: Revealed type is "Tuple[builtins.str, builtins.int, builtins.str, builtins.str, fallback=loguru.Level]" ++ main:4: note: Revealed type is "tuple[builtins.str, builtins.int, builtins.str, builtins.str, fallback=loguru.Level]" + + - case: level_set + main: | +@@ -214,7 +214,7 @@ + level = logger.level("FOO", no=11, icon="!", color="") + reveal_type(level) + out: | +- main:4: note: Revealed type is "Tuple[builtins.str, builtins.int, builtins.str, builtins.str, fallback=loguru.Level]" ++ main:4: note: Revealed type is "tuple[builtins.str, builtins.int, builtins.str, builtins.str, fallback=loguru.Level]" + + - case: level_update + main: | +@@ -223,7 +223,7 @@ + level = logger.level("INFO", color="") + reveal_type(level) + out: | +- main:4: note: Revealed type is "Tuple[builtins.str, builtins.int, builtins.str, builtins.str, fallback=loguru.Level]" ++ main:4: note: Revealed type is "tuple[builtins.str, builtins.int, builtins.str, builtins.str, fallback=loguru.Level]" + + - case: enable_and_disable_logger + main: | +@@ -285,9 +285,9 @@ + out: | + main:2: error: No overload variant of "add" of "Logger" matches argument types "Callable[[Any], None]", "int" + main:2: note: Possible overload variants: +- main:2: note: def add(self, sink: Union[TextIO, Writable, Callable[[Message], None], Handler], *, level: Union[str, int] = ..., format: Union[str, Callable[[Record], str]] = ..., filter: Union[str, Callable[[Record], bool], Dict[Optional[str], Union[str, int, bool]], None] = ..., colorize: Optional[bool] = ..., serialize: bool = ..., backtrace: bool = ..., diagnose: bool = ..., enqueue: bool = ..., context: Union[str, BaseContext, None] = ..., catch: bool = ...) -> int +- main:2: note: def add(self, sink: Callable[[Message], Awaitable[None]], *, level: Union[str, int] = ..., format: Union[str, Callable[[Record], str]] = ..., filter: Union[str, Callable[[Record], bool], Dict[Optional[str], Union[str, int, bool]], None] = ..., colorize: Optional[bool] = ..., serialize: bool = ..., backtrace: bool = ..., diagnose: bool = ..., enqueue: bool = ..., catch: bool = ..., context: Union[str, BaseContext, None] = ..., loop: Optional[AbstractEventLoop] = ...) -> int +- main:2: note: def add(self, sink: Union[str, PathLike[str]], *, level: Union[str, int] = ..., format: Union[str, Callable[[Record], str]] = ..., filter: Union[str, Callable[[Record], bool], Dict[Optional[str], Union[str, int, bool]], None] = ..., colorize: Optional[bool] = ..., serialize: bool = ..., backtrace: bool = ..., diagnose: bool = ..., enqueue: bool = ..., context: Union[str, BaseContext, None] = ..., catch: bool = ..., rotation: Union[str, int, time, timedelta, Callable[[Message, TextIO], bool], None] = ..., retention: Union[str, int, timedelta, Callable[[List[str]], None], None] = ..., compression: Union[str, Callable[[str], None], None] = ..., delay: bool = ..., watch: bool = ..., mode: str = ..., buffering: int = ..., encoding: str = ..., errors: Optional[str] = ..., newline: Optional[str] = ..., closefd: bool = ..., opener: Optional[Callable[[str, int], int]] = ...) -> int ++ main:2: note: def add(self, sink: Union[TextIO, Writable, Callable[[Message], None], Handler], *, level: Union[str, int] = ..., format: Union[str, Callable[[Record], str]] = ..., filter: Union[str, Callable[[Record], bool], dict[Optional[str], Union[str, int, bool]], None] = ..., colorize: Optional[bool] = ..., serialize: bool = ..., backtrace: bool = ..., diagnose: bool = ..., enqueue: bool = ..., context: Union[str, BaseContext, None] = ..., catch: bool = ...) -> int ++ main:2: note: def add(self, sink: Callable[[Message], Awaitable[None]], *, level: Union[str, int] = ..., format: Union[str, Callable[[Record], str]] = ..., filter: Union[str, Callable[[Record], bool], dict[Optional[str], Union[str, int, bool]], None] = ..., colorize: Optional[bool] = ..., serialize: bool = ..., backtrace: bool = ..., diagnose: bool = ..., enqueue: bool = ..., catch: bool = ..., context: Union[str, BaseContext, None] = ..., loop: Optional[AbstractEventLoop] = ...) -> int ++ main:2: note: def add(self, sink: Union[str, PathLike[str]], *, level: Union[str, int] = ..., format: Union[str, Callable[[Record], str]] = ..., filter: Union[str, Callable[[Record], bool], dict[Optional[str], Union[str, int, bool]], None] = ..., colorize: Optional[bool] = ..., serialize: bool = ..., backtrace: bool = ..., diagnose: bool = ..., enqueue: bool = ..., context: Union[str, BaseContext, None] = ..., catch: bool = ..., rotation: Union[str, int, time, timedelta, Callable[[Message, TextIO], bool], None] = ..., retention: Union[str, int, timedelta, Callable[[list[str]], None], None] = ..., compression: Union[str, Callable[[str], None], None] = ..., delay: bool = ..., watch: bool = ..., mode: str = ..., buffering: int = ..., encoding: str = ..., errors: Optional[str] = ..., newline: Optional[str] = ..., closefd: bool = ..., opener: Optional[Callable[[str, int], int]] = ...) -> int + + - case: invalid_logged_object_formatting + main: | +@@ -310,8 +310,8 @@ + extra=[1], + ) + out: | +- main:3: error: List item 0 has incompatible type "Dict[str, str]"; expected "Union[BasicHandlerConfig, FileHandlerConfig, AsyncHandlerConfig]" ++ main:3: error: List item 0 has incompatible type "dict[str, str]"; expected "Union[BasicHandlerConfig, FileHandlerConfig, AsyncHandlerConfig]" + main:4: error: Extra key "baz" for TypedDict "LevelConfig" + main:5: error: Argument "patcher" to "configure" of "Logger" has incompatible type "int"; expected "Optional[Callable[[Record], None]]" +- main:6: error: List item 0 has incompatible type "Dict[str, str]"; expected "Tuple[Optional[str], bool]" +- main:7: error: Argument "extra" to "configure" of "Logger" has incompatible type "List[int]"; expected "Optional[Dict[Any, Any]]" ++ main:6: error: List item 0 has incompatible type "dict[str, str]"; expected "tuple[Optional[str], bool]" ++ main:7: error: Argument "extra" to "configure" of "Logger" has incompatible type "list[int]"; expected "Optional[dict[Any, Any]]"