mirror of
https://github.com/davidhalter/typeshed.git
synced 2025-12-24 21:01:52 +08:00
croniter: Add missing arguments and functions, add types (#6215)
This commit is contained in:
@@ -1,6 +1,3 @@
|
||||
croniter.CroniterError
|
||||
croniter.croniter.__next__
|
||||
croniter.croniter.expand
|
||||
croniter.croniter.get_next
|
||||
croniter.croniter.is_valid
|
||||
croniter.croniter.next
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import datetime
|
||||
from typing import Any, Iterator, Text, Tuple, Type, TypeVar, Union
|
||||
from typing_extensions import Literal
|
||||
|
||||
_RetType = Union[Type[float], Type[datetime.datetime]]
|
||||
_SelfT = TypeVar("_SelfT", bound=croniter)
|
||||
@@ -10,11 +11,25 @@ class CroniterBadDateError(CroniterError): ...
|
||||
class CroniterNotAlphaError(CroniterError): ...
|
||||
|
||||
class croniter(Iterator[Any]):
|
||||
MONTHS_IN_YEAR: int
|
||||
MONTHS_IN_YEAR: Literal[12]
|
||||
RANGES: Tuple[tuple[int, int], ...]
|
||||
DAYS: Tuple[int, ...]
|
||||
DAYS: tuple[
|
||||
Literal[31],
|
||||
Literal[28],
|
||||
Literal[31],
|
||||
Literal[30],
|
||||
Literal[31],
|
||||
Literal[30],
|
||||
Literal[31],
|
||||
Literal[31],
|
||||
Literal[30],
|
||||
Literal[31],
|
||||
Literal[30],
|
||||
Literal[31],
|
||||
]
|
||||
ALPHACONV: Tuple[dict[str, Any], ...]
|
||||
LOWMAP: Tuple[dict[int, Any], ...]
|
||||
LEN_MEANS_ALL: Tuple[int, ...]
|
||||
bad_length: str
|
||||
tzinfo: datetime.tzinfo | None
|
||||
cur: float
|
||||
@@ -34,9 +49,10 @@ class croniter(Iterator[Any]):
|
||||
) -> None: ...
|
||||
# Most return value depend on ret_type, which can be passed in both as a method argument and as
|
||||
# a constructor argument.
|
||||
def get_next(self, ret_type: _RetType | None = ...) -> 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) -> float: ...
|
||||
def __iter__(self: _SelfT) -> _SelfT: ...
|
||||
def __next__(self, ret_type: _RetType | None = ...) -> Any: ...
|
||||
def next(self, ret_type: _RetType | None = ...) -> Any: ...
|
||||
@@ -45,6 +61,18 @@ class croniter(Iterator[Any]):
|
||||
def iter(self, ret_type: _RetType | None = ...) -> Iterator[Any]: ...
|
||||
def is_leap(self, year: int) -> bool: ...
|
||||
@classmethod
|
||||
def expand(cls, expr_format: Text) -> tuple[list[list[str]], dict[str, Any]]: ...
|
||||
def expand(cls, expr_format: Text, hash_id: str | bytes | None = ...) -> tuple[list[list[str]], dict[str, Any]]: ...
|
||||
@classmethod
|
||||
def is_valid(cls, expression: Text) -> bool: ...
|
||||
def is_valid(cls, expression: Text, hash_id: str | bytes | None = ...) -> bool: ...
|
||||
@classmethod
|
||||
def match(cls, cron_expression: Text, testdate: float | datetime.datetime | None, day_or: bool = ...) -> bool: ...
|
||||
|
||||
def croniter_range(
|
||||
start: float | datetime.datetime,
|
||||
stop: float | datetime.datetime,
|
||||
expr_format: Text,
|
||||
ret_type: _RetType | None = ...,
|
||||
day_or: bool = ...,
|
||||
exclude_ends: bool = ...,
|
||||
_croniter: Type[croniter] | None = ...,
|
||||
) -> Iterator[Any]: ...
|
||||
|
||||
Reference in New Issue
Block a user