Skip to content

Add stubs for python-datemath #5765

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 10 commits into from
Jan 11, 2023
3 changes: 3 additions & 0 deletions stubs/python-datemath/METADATA.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
version = "1.5.*"
# Requires a version of arrow with a `py.typed` file
requires = ["arrow>=1.0.1"]
12 changes: 12 additions & 0 deletions stubs/python-datemath/datemath/__init__.pyi
Original file line number Diff line number Diff line change
@@ -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: ...
10 changes: 10 additions & 0 deletions stubs/python-datemath/datemath/helpers.pyi
Original file line number Diff line number Diff line change
@@ -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: ...