croniter: make package, complete public API (#8316)

This commit is contained in:
Shantanu
2022-07-17 17:08:03 -07:00
committed by GitHub
parent 936314b979
commit 64359528fc
3 changed files with 29 additions and 6 deletions

View File

@@ -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

View File

@@ -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,
)

View File

@@ -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]: ...