mirror of
https://github.com/davidhalter/typeshed.git
synced 2025-12-16 00:37:10 +08:00
croniter: complete stubs (#9584)
This commit is contained in:
@@ -1,5 +0,0 @@
|
||||
# missing from stub
|
||||
croniter.croniter.EXPANDERS
|
||||
croniter.croniter.HashExpander
|
||||
croniter.croniter.VALID_LEN_EXPRESSION
|
||||
croniter.croniter.timedelta_to_seconds
|
||||
@@ -1,11 +1,22 @@
|
||||
import datetime
|
||||
from _typeshed import Self
|
||||
from _typeshed import ReadableBuffer, Self
|
||||
from collections import OrderedDict
|
||||
from collections.abc import Iterator
|
||||
from typing import Any
|
||||
from re import Match, Pattern
|
||||
from typing import Any, overload
|
||||
from typing_extensions import Literal, TypeAlias
|
||||
|
||||
_RetType: TypeAlias = type[float | datetime.datetime]
|
||||
|
||||
step_search_re: Pattern[str]
|
||||
only_int_re: Pattern[str]
|
||||
star_or_int_re: Pattern[str]
|
||||
special_weekday_re: Pattern[str]
|
||||
hash_expression_re: Pattern[str]
|
||||
VALID_LEN_EXPRESSION: list[int]
|
||||
|
||||
def timedelta_to_seconds(td: datetime.timedelta) -> float: ...
|
||||
|
||||
class CroniterError(ValueError): ...
|
||||
class CroniterBadTypeRangeError(TypeError): ...
|
||||
class CroniterBadCronError(CroniterError): ...
|
||||
@@ -83,3 +94,42 @@ def croniter_range(
|
||||
exclude_ends: bool = ...,
|
||||
_croniter: type[croniter] | None = ...,
|
||||
) -> Iterator[Any]: ...
|
||||
|
||||
class HashExpander:
|
||||
cron: croniter
|
||||
def __init__(self, cronit: croniter) -> None: ...
|
||||
@overload
|
||||
def do(
|
||||
self,
|
||||
idx: int,
|
||||
hash_type: Literal["r"],
|
||||
hash_id: None = None,
|
||||
range_end: int | None = None,
|
||||
range_begin: int | None = None,
|
||||
) -> int: ...
|
||||
@overload
|
||||
def do(
|
||||
self, idx: int, hash_type: str, hash_id: ReadableBuffer, range_end: int | None = None, range_begin: int | None = None
|
||||
) -> int: ...
|
||||
@overload
|
||||
def do(
|
||||
self,
|
||||
idx: int,
|
||||
hash_type: str = "h",
|
||||
*,
|
||||
hash_id: ReadableBuffer,
|
||||
range_end: int | None = None,
|
||||
range_begin: int | None = None,
|
||||
) -> int: ...
|
||||
def match(self, efl: object, idx: object, expr: str, hash_id: object = None, **kw: object) -> Match[str] | None: ...
|
||||
def expand(
|
||||
self,
|
||||
efl: object,
|
||||
idx: int,
|
||||
expr: str,
|
||||
hash_id: ReadableBuffer | None = None,
|
||||
match: Match[str] | None | Literal[""] = "",
|
||||
**kw: object,
|
||||
) -> str: ...
|
||||
|
||||
EXPANDERS: OrderedDict[str, HashExpander]
|
||||
|
||||
Reference in New Issue
Block a user