From b1db7790316852862578e180a1a2ef2132c96bc7 Mon Sep 17 00:00:00 2001 From: Kai Mueller <15907922+kasium@users.noreply.github.com> Date: Mon, 12 Jul 2021 15:01:09 +0000 Subject: [PATCH 1/5] Add stubs for python-datemath --- stubs/python-datemath/METADATA.toml | 2 ++ stubs/python-datemath/datemath/__init__.pyi | 8 ++++++++ stubs/python-datemath/datemath/helpers.pyi | 8 ++++++++ 3 files changed, 18 insertions(+) create mode 100644 stubs/python-datemath/METADATA.toml create mode 100644 stubs/python-datemath/datemath/__init__.pyi create mode 100644 stubs/python-datemath/datemath/helpers.pyi diff --git a/stubs/python-datemath/METADATA.toml b/stubs/python-datemath/METADATA.toml new file mode 100644 index 000000000000..3a520e9fc3d3 --- /dev/null +++ b/stubs/python-datemath/METADATA.toml @@ -0,0 +1,2 @@ +version = "1.5" +requires = ["arrow"] diff --git a/stubs/python-datemath/datemath/__init__.pyi b/stubs/python-datemath/datemath/__init__.pyi new file mode 100644 index 000000000000..6f281fd19952 --- /dev/null +++ b/stubs/python-datemath/datemath/__init__.pyi @@ -0,0 +1,8 @@ +from datetime import datetime + +import arrow + +from .helpers import DateMathException as DateMathException, parse as parse + +def dm(expression: str, now: arrow.Arrow | None, tz: str, type: str | None, roundDown: bool) -> arrow.Arrow: ... +def datemath(expression: str, now: arrow.Arrow | None, tz: str, type: str | None, roundDown: bool) -> datetime: ... diff --git a/stubs/python-datemath/datemath/helpers.pyi b/stubs/python-datemath/datemath/helpers.pyi new file mode 100644 index 000000000000..098ab07bcd20 --- /dev/null +++ b/stubs/python-datemath/datemath/helpers.pyi @@ -0,0 +1,8 @@ +from typing import Any + +import arrow + +class DateMathException: ... + +def parse(expression: str, now: arrow.Arrow | None, tz: str, type: str | None, roundDown: bool) -> arrow.Arrow: ... +def __getattr__(name: str) -> Any: ... # incomplete From 4592d597222400625a40e041922891b2fc486416 Mon Sep 17 00:00:00 2001 From: AlexWaygood Date: Tue, 10 Jan 2023 23:47:44 +0000 Subject: [PATCH 2/5] Fix most stubtest errors --- stubs/python-datemath/datemath/__init__.pyi | 4 ++-- stubs/python-datemath/datemath/helpers.pyi | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/stubs/python-datemath/datemath/__init__.pyi b/stubs/python-datemath/datemath/__init__.pyi index 6f281fd19952..eab58d197963 100644 --- a/stubs/python-datemath/datemath/__init__.pyi +++ b/stubs/python-datemath/datemath/__init__.pyi @@ -4,5 +4,5 @@ import arrow from .helpers import DateMathException as DateMathException, parse as parse -def dm(expression: str, now: arrow.Arrow | None, tz: str, type: str | None, roundDown: bool) -> arrow.Arrow: ... -def datemath(expression: str, now: arrow.Arrow | None, tz: str, type: str | None, roundDown: bool) -> datetime: ... +def dm(expr: str, *, now: arrow.Arrow | None = ..., tz: str = ..., type: str | None = ..., roundDown: bool = ...) -> arrow.Arrow: ... +def datemath(expr: str, *, now: arrow.Arrow | None = ..., tz: str = ..., type: str | None = ..., roundDown: bool = ...) -> datetime: ... diff --git a/stubs/python-datemath/datemath/helpers.pyi b/stubs/python-datemath/datemath/helpers.pyi index 098ab07bcd20..235ade317f22 100644 --- a/stubs/python-datemath/datemath/helpers.pyi +++ b/stubs/python-datemath/datemath/helpers.pyi @@ -1,8 +1,8 @@ -from typing import Any +from _typeshed import Incomplete import arrow -class DateMathException: ... +class DateMathException(Exception): ... -def parse(expression: str, now: arrow.Arrow | None, tz: str, type: str | None, roundDown: bool) -> arrow.Arrow: ... -def __getattr__(name: str) -> Any: ... # incomplete +def parse(expression: str, now: arrow.Arrow | None = ..., tz: str = ..., type: str | None = ..., roundDown: bool = ...) -> arrow.Arrow: ... +def __getattr__(name: str) -> Incomplete: ... From 8b7c7981d9987b7d6668eea3765153c525462259 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Tue, 10 Jan 2023 23:49:02 +0000 Subject: [PATCH 3/5] [pre-commit.ci] auto fixes from pre-commit.com hooks --- stubs/python-datemath/datemath/__init__.pyi | 8 ++++++-- stubs/python-datemath/datemath/helpers.pyi | 4 +++- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/stubs/python-datemath/datemath/__init__.pyi b/stubs/python-datemath/datemath/__init__.pyi index eab58d197963..ecb00250aa45 100644 --- a/stubs/python-datemath/datemath/__init__.pyi +++ b/stubs/python-datemath/datemath/__init__.pyi @@ -4,5 +4,9 @@ import arrow from .helpers import DateMathException as DateMathException, parse as parse -def dm(expr: str, *, now: arrow.Arrow | None = ..., tz: str = ..., type: str | None = ..., roundDown: bool = ...) -> arrow.Arrow: ... -def datemath(expr: str, *, now: arrow.Arrow | None = ..., tz: str = ..., type: str | None = ..., roundDown: bool = ...) -> datetime: ... +def dm( + expr: str, *, now: arrow.Arrow | None = ..., tz: str = ..., type: str | None = ..., roundDown: bool = ... +) -> arrow.Arrow: ... +def datemath( + expr: str, *, now: arrow.Arrow | None = ..., tz: str = ..., type: str | None = ..., roundDown: bool = ... +) -> datetime: ... diff --git a/stubs/python-datemath/datemath/helpers.pyi b/stubs/python-datemath/datemath/helpers.pyi index 235ade317f22..52402ea63f56 100644 --- a/stubs/python-datemath/datemath/helpers.pyi +++ b/stubs/python-datemath/datemath/helpers.pyi @@ -4,5 +4,7 @@ import arrow class DateMathException(Exception): ... -def parse(expression: str, now: arrow.Arrow | None = ..., tz: str = ..., type: str | None = ..., roundDown: bool = ...) -> arrow.Arrow: ... +def parse( + expression: str, now: arrow.Arrow | None = ..., tz: str = ..., type: str | None = ..., roundDown: bool = ... +) -> arrow.Arrow: ... def __getattr__(name: str) -> Incomplete: ... From ae984f7ae888ab4e510d72c4a4a973d9ed9710ec Mon Sep 17 00:00:00 2001 From: Alex Waygood Date: Tue, 10 Jan 2023 23:50:47 +0000 Subject: [PATCH 4/5] Update METADATA.toml --- stubs/python-datemath/METADATA.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/stubs/python-datemath/METADATA.toml b/stubs/python-datemath/METADATA.toml index 3a520e9fc3d3..f9724f408a57 100644 --- a/stubs/python-datemath/METADATA.toml +++ b/stubs/python-datemath/METADATA.toml @@ -1,2 +1,2 @@ -version = "1.5" +version = "1.5.*" requires = ["arrow"] From d6f3e24534d55b75a4d4a53abd94ab8f795e7539 Mon Sep 17 00:00:00 2001 From: Alex Waygood Date: Tue, 10 Jan 2023 23:53:37 +0000 Subject: [PATCH 5/5] Update METADATA.toml --- stubs/python-datemath/METADATA.toml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/stubs/python-datemath/METADATA.toml b/stubs/python-datemath/METADATA.toml index f9724f408a57..7a716094529f 100644 --- a/stubs/python-datemath/METADATA.toml +++ b/stubs/python-datemath/METADATA.toml @@ -1,2 +1,3 @@ version = "1.5.*" -requires = ["arrow"] +# Requires a version of arrow with a `py.typed` file +requires = ["arrow>=1.0.1"]