diff --git a/stubs/croniter/@tests/stubtest_allowlist.txt b/stubs/croniter/@tests/stubtest_allowlist.txt index 5eb01ecab..2895f0a89 100644 --- a/stubs/croniter/@tests/stubtest_allowlist.txt +++ b/stubs/croniter/@tests/stubtest_allowlist.txt @@ -1,3 +1,10 @@ -croniter.CroniterError -croniter.croniter.__next__ -croniter.croniter.next +# missing from stub +croniter.croniter.EXPANDERS +croniter.croniter.HashExpander +croniter.croniter.VALID_LEN_EXPRESSION +croniter.croniter.hash_expression_re +croniter.croniter.only_int_re +croniter.croniter.special_weekday_re +croniter.croniter.star_or_int_re +croniter.croniter.step_search_re +croniter.croniter.timedelta_to_seconds \ No newline at end of file diff --git a/stubs/croniter/croniter/__init__.pyi b/stubs/croniter/croniter/__init__.pyi new file mode 100644 index 000000000..c88524ce8 --- /dev/null +++ b/stubs/croniter/croniter/__init__.pyi @@ -0,0 +1,10 @@ +from .croniter import ( + CroniterBadCronError as CroniterBadCronError, + CroniterBadDateError as CroniterBadDateError, + CroniterBadTypeRangeError as CroniterBadTypeRangeError, + CroniterNotAlphaError as CroniterNotAlphaError, + CroniterUnsupportedSyntaxError as CroniterUnsupportedSyntaxError, + croniter as croniter, + croniter_range as croniter_range, + datetime_to_timestamp as datetime_to_timestamp, +) diff --git a/stubs/croniter/croniter.pyi b/stubs/croniter/croniter/croniter.pyi similarity index 85% rename from stubs/croniter/croniter.pyi rename to stubs/croniter/croniter/croniter.pyi index ad49df73e..a03ae7ba0 100644 --- a/stubs/croniter/croniter.pyi +++ b/stubs/croniter/croniter/croniter.pyi @@ -7,10 +7,14 @@ from typing_extensions import Literal, TypeAlias _RetType: TypeAlias = type[float | datetime.datetime] class CroniterError(ValueError): ... +class CroniterBadTypeRangeError(TypeError): ... class CroniterBadCronError(CroniterError): ... +class CroniterUnsupportedSyntaxError(CroniterBadCronError): ... class CroniterBadDateError(CroniterError): ... class CroniterNotAlphaError(CroniterError): ... +def datetime_to_timestamp(d: datetime.datetime) -> float: ... + class croniter(Iterator[Any]): MONTHS_IN_YEAR: Literal[12] RANGES: tuple[tuple[int, int], ...] @@ -53,10 +57,12 @@ class croniter(Iterator[Any]): def get_next(self, ret_type: _RetType | None = ..., start_time: float | datetime.datetime | None = ...) -> Any: ... def get_prev(self, ret_type: _RetType | None = ...) -> Any: ... def get_current(self, ret_type: _RetType | None = ...) -> Any: ... - def set_current(self, start_time: float | datetime.datetime, force: bool = ...) -> float: ... + def set_current(self, start_time: float | datetime.datetime | None, force: bool = ...) -> float: ... def __iter__(self: Self) -> Self: ... - def __next__(self, ret_type: _RetType | None = ...) -> Any: ... - def next(self, ret_type: _RetType | None = ...) -> Any: ... + def next( + self, ret_type: _RetType | None = ..., start_time: float | datetime.datetime | None = ..., is_prev: bool | None = ... + ) -> Any: ... + __next__ = next def all_next(self, ret_type: _RetType | None = ...) -> Iterator[Any]: ... def all_prev(self, ret_type: _RetType | None = ...) -> Iterator[Any]: ... def iter(self, ret_type: _RetType | None = ...) -> Iterator[Any]: ...