From 2e98fb461465839671749e775347b7a8fc1d839e Mon Sep 17 00:00:00 2001 From: Alex Waygood Date: Fri, 19 Apr 2024 14:59:41 +0100 Subject: [PATCH 1/3] Complete type hints for public API --- pysource_minimize/_minimize.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/pysource_minimize/_minimize.py b/pysource_minimize/_minimize.py index fe7d64a..c6ea801 100644 --- a/pysource_minimize/_minimize.py +++ b/pysource_minimize/_minimize.py @@ -1,5 +1,6 @@ import ast import warnings +from collections.abc import Callable from ._minimize_base import equal_ast from ._minimize_structure import MinimizeStructure @@ -52,7 +53,11 @@ def minimize_ast( def minimize( - source: str, checker, *, progress_callback=lambda current, total: None, retries=1 + source: str, + checker: Callable[[str], bool], + *, + progress_callback: Callable[[int, int], object] = lambda current, total: None, + retries: int = 1 ) -> str: """ minimzes the source code From 3398bfdbb8fe08a6c20cf54425620182a664d4e8 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Fri, 19 Apr 2024 14:02:52 +0000 Subject: [PATCH 2/3] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- pysource_minimize/_minimize.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pysource_minimize/_minimize.py b/pysource_minimize/_minimize.py index c6ea801..1e60f4d 100644 --- a/pysource_minimize/_minimize.py +++ b/pysource_minimize/_minimize.py @@ -57,7 +57,7 @@ def minimize( checker: Callable[[str], bool], *, progress_callback: Callable[[int, int], object] = lambda current, total: None, - retries: int = 1 + retries: int = 1, ) -> str: """ minimzes the source code From 0df72c0d55b36cea6d59062e7bd6e2efcb2a3a59 Mon Sep 17 00:00:00 2001 From: Alex Waygood Date: Fri, 19 Apr 2024 15:05:02 +0100 Subject: [PATCH 3/3] use future annotations --- pysource_minimize/_minimize.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/pysource_minimize/_minimize.py b/pysource_minimize/_minimize.py index 1e60f4d..d2dba48 100644 --- a/pysource_minimize/_minimize.py +++ b/pysource_minimize/_minimize.py @@ -1,3 +1,5 @@ +from __future__ import annotations + import ast import warnings from collections.abc import Callable