mirror of
https://github.com/davidhalter/typeshed.git
synced 2026-05-04 04:25:50 +08:00
[croniter] Update to 6.2.0 (#15511)
This commit is contained in:
@@ -0,0 +1 @@
|
||||
croniter.tests.*
|
||||
@@ -1,2 +1,2 @@
|
||||
version = "6.0.0"
|
||||
version = "6.2.0"
|
||||
upstream_repository = "https://github.com/pallets-eco/croniter"
|
||||
|
||||
@@ -20,3 +20,24 @@ from .croniter import (
|
||||
)
|
||||
|
||||
cron_m = croniter_m
|
||||
|
||||
__all__ = [
|
||||
"DAY_FIELD",
|
||||
"HOUR_FIELD",
|
||||
"MINUTE_FIELD",
|
||||
"MONTH_FIELD",
|
||||
"OVERFLOW32B_MODE",
|
||||
"SECOND_FIELD",
|
||||
"UTC_DT",
|
||||
"YEAR_FIELD",
|
||||
"CroniterBadCronError",
|
||||
"CroniterBadDateError",
|
||||
"CroniterBadTypeRangeError",
|
||||
"CroniterError",
|
||||
"CroniterNotAlphaError",
|
||||
"CroniterUnsupportedSyntaxError",
|
||||
"cron_m",
|
||||
"croniter",
|
||||
"croniter_range",
|
||||
"datetime_to_timestamp",
|
||||
]
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
import datetime
|
||||
from _typeshed import Unused
|
||||
from collections import OrderedDict
|
||||
from collections.abc import Generator
|
||||
from collections.abc import Generator, Iterable
|
||||
from re import Match, Pattern
|
||||
from typing import Any, Final, Generic, Literal, Protocol, TypeVar, overload, type_check_only
|
||||
from typing_extensions import Never, Self, TypeAlias
|
||||
@@ -9,6 +8,7 @@ from typing_extensions import Never, Self, TypeAlias
|
||||
_R_co = TypeVar("_R_co", float, datetime.datetime, default=float, covariant=True)
|
||||
_R2_co = TypeVar("_R2_co", float, datetime.datetime, covariant=True)
|
||||
_Expressions: TypeAlias = list[str] # fixed-length list of 5 or 6 strings
|
||||
ExpandedExpression: TypeAlias = list[int | Literal["*", "l"]]
|
||||
|
||||
@type_check_only
|
||||
class _AllIter(Protocol[_R_co]):
|
||||
@@ -45,10 +45,12 @@ YEAR_FIELDS: Final[tuple[int, int, int, int, int, int, int]]
|
||||
step_search_re: Final[Pattern[str]]
|
||||
only_int_re: Final[Pattern[str]]
|
||||
|
||||
DAYS: Final[tuple[int, int, int, int, int, int, int, int, int, int, int, int]]
|
||||
WEEKDAYS: Final[str]
|
||||
MONTHS: Final[str]
|
||||
star_or_int_re: Final[Pattern[str]]
|
||||
special_dow_re: Final[Pattern[str]]
|
||||
nearest_weekday_re: Final[Pattern[str]]
|
||||
re_star: Final[Pattern[str]]
|
||||
hash_expression_re: Final[Pattern[str]]
|
||||
|
||||
@@ -57,11 +59,8 @@ UNIX_CRON_LEN: Final = 5
|
||||
SECOND_CRON_LEN: Final = 6
|
||||
YEAR_CRON_LEN: Final = 7
|
||||
VALID_LEN_EXPRESSION: Final[set[int]]
|
||||
TIMESTAMP_TO_DT_CACHE: Final[dict[tuple[float, str], datetime.datetime]]
|
||||
EXPRESSIONS: dict[tuple[str, bytes], _Expressions]
|
||||
MARKER: object
|
||||
|
||||
def timedelta_to_seconds(td: datetime.timedelta) -> float: ...
|
||||
def datetime_to_timestamp(d: datetime.datetime) -> float: ...
|
||||
|
||||
class CroniterError(ValueError): ...
|
||||
@@ -78,22 +77,6 @@ class croniter(Generic[_R_co]):
|
||||
tuple[int, int], tuple[int, int], tuple[int, int], tuple[int, int], tuple[int, int], tuple[int, int], tuple[int, int]
|
||||
]
|
||||
]
|
||||
DAYS: Final[
|
||||
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: Final[
|
||||
tuple[
|
||||
dict[Never, Never],
|
||||
@@ -121,15 +104,15 @@ class croniter(Generic[_R_co]):
|
||||
second_at_beginning: bool
|
||||
tzinfo: datetime.tzinfo | None
|
||||
|
||||
# Initialized to None, but immediately set to a float.
|
||||
start_time: float
|
||||
dst_start_time: float
|
||||
cur: float
|
||||
|
||||
expanded: list[list[str]]
|
||||
nth_weekday_of_month: dict[str, set[int]]
|
||||
fields: tuple[int, ...]
|
||||
expressions: _Expressions
|
||||
nearest_weekday: set[int]
|
||||
fields: tuple[int, ...]
|
||||
|
||||
@overload
|
||||
def __new__(
|
||||
@@ -142,7 +125,7 @@ class croniter(Generic[_R_co]):
|
||||
is_prev: bool = False,
|
||||
hash_id: str | bytes | None = None,
|
||||
implement_cron_bug: bool = False,
|
||||
second_at_beginning: bool | None = None,
|
||||
second_at_beginning: bool = False,
|
||||
expand_from_start_time: bool = False,
|
||||
) -> croniter[float]: ...
|
||||
@overload
|
||||
@@ -156,7 +139,7 @@ class croniter(Generic[_R_co]):
|
||||
is_prev: bool = False,
|
||||
hash_id: str | bytes | None = None,
|
||||
implement_cron_bug: bool = False,
|
||||
second_at_beginning: bool | None = None,
|
||||
second_at_beginning: bool = False,
|
||||
expand_from_start_time: bool = False,
|
||||
) -> croniter[datetime.datetime]: ...
|
||||
@overload
|
||||
@@ -170,7 +153,7 @@ class croniter(Generic[_R_co]):
|
||||
is_prev: bool = False,
|
||||
hash_id: str | bytes | None = None,
|
||||
implement_cron_bug: bool = False,
|
||||
second_at_beginning: bool | None = None,
|
||||
second_at_beginning: bool = False,
|
||||
expand_from_start_time: bool = False,
|
||||
) -> croniter[datetime.datetime]: ...
|
||||
def __init__(
|
||||
@@ -183,7 +166,7 @@ class croniter(Generic[_R_co]):
|
||||
is_prev: bool = False,
|
||||
hash_id: str | bytes | None = None,
|
||||
implement_cron_bug: bool = False,
|
||||
second_at_beginning: bool | None = None,
|
||||
second_at_beginning: bool = False,
|
||||
expand_from_start_time: bool = False,
|
||||
) -> None: ...
|
||||
@overload
|
||||
@@ -210,8 +193,6 @@ class croniter(Generic[_R_co]):
|
||||
@staticmethod
|
||||
def datetime_to_timestamp(d: datetime.datetime) -> float: ...
|
||||
def timestamp_to_datetime(self, timestamp: float, tzinfo: datetime.tzinfo | None = ...) -> datetime.datetime: ...
|
||||
@staticmethod
|
||||
def timedelta_to_seconds(td: datetime.timedelta) -> float: ...
|
||||
@overload
|
||||
def all_next(
|
||||
self, ret_type: type[_R2_co], start_time: float | datetime.datetime | None = None, update_current: bool | None = None
|
||||
@@ -247,8 +228,6 @@ class croniter(Generic[_R_co]):
|
||||
update_current: bool | None = None,
|
||||
) -> _R_co: ...
|
||||
__next__ = next
|
||||
@staticmethod
|
||||
def is_leap(year: int) -> bool: ...
|
||||
@classmethod
|
||||
def value_alias(
|
||||
cls,
|
||||
@@ -256,6 +235,7 @@ class croniter(Generic[_R_co]):
|
||||
field_index: Literal[0, 1, 2, 3, 4, 5, 6],
|
||||
len_expressions: int | list[Any] | dict[Any, Any] | tuple[Any, ...] | set[Any] = 5,
|
||||
) -> int: ...
|
||||
DAYS_IN_MONTH: Final[dict[int, int]]
|
||||
@classmethod
|
||||
def expand(
|
||||
cls,
|
||||
@@ -263,10 +243,18 @@ class croniter(Generic[_R_co]):
|
||||
hash_id: bytes | None = None,
|
||||
second_at_beginning: bool = False,
|
||||
from_timestamp: float | None = None,
|
||||
) -> tuple[list[list[str]], dict[str, set[int]]]: ...
|
||||
strict: bool = False,
|
||||
strict_year: int | Iterable[int] | None = None,
|
||||
) -> tuple[list[ExpandedExpression], dict[str, set[int]]]: ...
|
||||
@classmethod
|
||||
def is_valid(
|
||||
cls, expression: str, hash_id: bytes | None = None, encoding: str = "UTF-8", second_at_beginning: bool = False
|
||||
cls,
|
||||
expression: str,
|
||||
hash_id: bytes | None = None,
|
||||
encoding: str = "UTF-8",
|
||||
second_at_beginning: bool = False,
|
||||
strict: bool = False,
|
||||
strict_year: int | Iterable[int] | None = None,
|
||||
) -> bool: ...
|
||||
@classmethod
|
||||
def match(
|
||||
@@ -275,6 +263,7 @@ class croniter(Generic[_R_co]):
|
||||
testdate: float | datetime.datetime | None,
|
||||
day_or: bool = True,
|
||||
second_at_beginning: bool = False,
|
||||
precision_in_seconds: int | None = None,
|
||||
) -> bool: ...
|
||||
@classmethod
|
||||
def match_range(
|
||||
@@ -284,6 +273,7 @@ class croniter(Generic[_R_co]):
|
||||
to_datetime: datetime.datetime,
|
||||
day_or: bool = True,
|
||||
second_at_beginning: bool = False,
|
||||
precision_in_seconds: int | None = None,
|
||||
) -> bool: ...
|
||||
|
||||
@overload
|
||||
@@ -354,4 +344,4 @@ class HashExpander:
|
||||
**kw: object,
|
||||
) -> str: ...
|
||||
|
||||
EXPANDERS: OrderedDict[str, HashExpander]
|
||||
EXPANDERS: dict[str, type[HashExpander]]
|
||||
|
||||
Reference in New Issue
Block a user