Update python-crontab to 3.0.* (#10475)

This commit is contained in:
Nikita Sobolev
2023-07-19 14:50:33 +03:00
committed by GitHub
parent 7dbbdb0193
commit 8da4739042
2 changed files with 43 additions and 7 deletions

View File

@@ -1 +1 @@
version = "2.7.*"
version = "3.0.*"

View File

@@ -1,13 +1,13 @@
import re
import subprocess
from _typeshed import Incomplete, Unused
from _typeshed import Incomplete
from builtins import range as _range
from collections import OrderedDict
from collections.abc import Callable, Generator, Iterable, Iterator
from datetime import datetime
from logging import Logger
from types import TracebackType
from typing import Any
from typing import Any, overload
from typing_extensions import Self, SupportsIndex, TypeAlias
from cronlog import CronLog
@@ -32,7 +32,18 @@ CRON_COMMAND: str
SHELL: str
current_user: Callable[[], str | None]
def open_pipe(cmd: str, *args: str, **flags: str) -> subprocess.Popen[Any]: ...
class Process:
env: subprocess._ENV | None
args: tuple[str, ...]
has_run: bool
stdout: str | None
stderr: str | None
returncode: int | None
# `posix` and `env` are known special kwargs:
def __init__(self, cmd: str, *args: str, posix: bool = ..., env: subprocess._ENV | None = None, **flags: object) -> None: ...
def run(self) -> Self: ...
def __int__(self) -> int: ... # technically, it can return `None` before `run` is called
def __eq__(self, other: object) -> bool: ...
class CronTab:
lines: list[str | CronItem] | None
@@ -69,8 +80,7 @@ class CronTab:
# Usually `kwargs` are just `now: datetime | None`, but technically this can
# work for `CronItem` subclasses, which might define other kwargs.
def run_pending(self, **kwargs: Any) -> Iterator[str]: ...
# There are two known kwargs and others are unused:
def run_scheduler(self, timeout: int = ..., *, warp: object = ..., cadence: int = ..., **kwargs: Unused) -> Iterator[str]: ...
def run_scheduler(self, timeout: int = -1, cadence: int = 60, warp: bool = False) -> Iterator[str]: ...
def render(self, errors: bool = ..., specials: bool | None = ...) -> str: ...
def new(
self,
@@ -132,6 +142,19 @@ class CronItem:
def frequency_per_year(self, year: int | None = ...) -> int: ...
def frequency_per_day(self) -> int: ...
def frequency_per_hour(self) -> int: ...
def frequency_at_year(self, year: int | None = None) -> int: ...
@overload
def frequency_at_month(self, year: int, month: int) -> int: ...
@overload
def frequency_at_month(self, year: None = None, month: None = None) -> int: ...
@overload
def frequency_at_day(self, year: int, month: int, day: int) -> int: ...
@overload
def frequency_at_day(self, year: None = None, month: None = None, day: None = None) -> int: ...
@overload
def frequency_at_hour(self, year: int, month: int, day: int, hour: int) -> int: ...
@overload
def frequency_at_hour(self, year: None = None, month: None = None, day: None = None, hour: None = None) -> int: ...
def run_pending(self, now: datetime | None = ...) -> int | str: ...
def run(self) -> str: ...
# TODO: use types from `croniter` module here:
@@ -185,6 +208,19 @@ class CronSlices(list[CronSlice]):
def frequency_per_year(self, year: int | None = ...) -> int: ...
def frequency_per_day(self) -> int: ...
def frequency_per_hour(self) -> int: ...
def frequency_at_year(self, year: int | None = None) -> int: ...
@overload
def frequency_at_month(self, year: int, month: int) -> int: ...
@overload
def frequency_at_month(self, year: None = None, month: None = None) -> int: ...
@overload
def frequency_at_day(self, year: int, month: int, day: int) -> int: ...
@overload
def frequency_at_day(self, year: None = None, month: None = None, day: None = None) -> int: ...
@overload
def frequency_at_hour(self, year: int, month: int, day: int, hour: int) -> int: ...
@overload
def frequency_at_hour(self, year: None = None, month: None = None, day: None = None, hour: None = None) -> int: ...
def __eq__(self, arg: object) -> bool: ...
class SundayError(KeyError): ...
@@ -209,7 +245,7 @@ class CronSlice:
def __init__(self, info: int | dict[str, Any], value: str | None = ...) -> None: ...
def __hash__(self) -> int: ...
def parse(self, value: str | None) -> None: ...
def render(self, resolve: bool = ..., specials: bool = ...) -> str: ...
def render(self, resolve: bool = False) -> str: ...
def __eq__(self, arg: object) -> bool: ...
def every(self, n_value: int, also: bool = ...) -> _Part: ...
# The only known kwarg, others are unused,