diff --git a/stubs/python-datemath/METADATA.toml b/stubs/python-datemath/METADATA.toml new file mode 100644 index 000000000000..7a716094529f --- /dev/null +++ b/stubs/python-datemath/METADATA.toml @@ -0,0 +1,3 @@ +version = "1.5.*" +# Requires a version of arrow with a `py.typed` file +requires = ["arrow>=1.0.1"] diff --git a/stubs/python-datemath/datemath/__init__.pyi b/stubs/python-datemath/datemath/__init__.pyi new file mode 100644 index 000000000000..ecb00250aa45 --- /dev/null +++ b/stubs/python-datemath/datemath/__init__.pyi @@ -0,0 +1,12 @@ +from datetime import datetime + +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: ... diff --git a/stubs/python-datemath/datemath/helpers.pyi b/stubs/python-datemath/datemath/helpers.pyi new file mode 100644 index 000000000000..52402ea63f56 --- /dev/null +++ b/stubs/python-datemath/datemath/helpers.pyi @@ -0,0 +1,10 @@ +from _typeshed import Incomplete + +import arrow + +class DateMathException(Exception): ... + +def parse( + expression: str, now: arrow.Arrow | None = ..., tz: str = ..., type: str | None = ..., roundDown: bool = ... +) -> arrow.Arrow: ... +def __getattr__(name: str) -> Incomplete: ...