Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions stubs/python-crontab/cronlog.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -13,19 +13,19 @@ class LogReader:
size: int
read: int
pipe: StreamReaderWriter | None
def __init__(self, filename: StrOrBytesPath, mass: int = ...) -> None: ...
def __init__(self, filename: StrOrBytesPath, mass: int = 4096) -> None: ...
def __enter__(self) -> Self: ...
def __exit__(
self, error_type: type[BaseException] | None, value: BaseException | None, traceback: TracebackType | None
) -> None: ...
def __iter__(self) -> Iterator[str]: ...
def readlines(self, until: int = ...) -> Generator[tuple[int, str]]: ...
def readlines(self, until: int = 0) -> Generator[tuple[int, str]]: ...

def cron_date_to_datetime(cron_str: str) -> datetime: ...

class CronLog(LogReader):
user: str | None
def __init__(self, filename: StrOrBytesPath = ..., user: str | None = ...) -> None: ...
def __init__(self, filename: StrOrBytesPath = "/var/log/syslog", user: str | None = None) -> None: ...
def for_program(self, command: str) -> ProgramLog: ...
def __iter__(self) -> dict[str, str | None]: ... # type: ignore[override]

Expand Down
64 changes: 32 additions & 32 deletions stubs/python-crontab/crontab.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ class CronTab:
intab: str | None
tabfile: str | None
def __init__(
self, user: _User = ..., tab: str | None = ..., tabfile: str | None = ..., log: CronLog | str | None = ...
self, user: _User = None, tab: str | None = None, tabfile: str | None = None, log: CronLog | str | None = None
) -> None: ...
def __enter__(self) -> Self: ...
def __exit__(
Expand All @@ -83,28 +83,28 @@ class CronTab:
def user(self) -> _User: ...
@property
def user_opt(self) -> dict[str, str]: ...
def read(self, filename: str | None = ...) -> None: ...
def read(self, filename: str | None = None) -> None: ...
def append(
self,
item: CronItem,
line: str = ...,
read: bool = ...,
before: str | re.Pattern[str] | list[CronItem] | tuple[CronItem, ...] | Generator[CronItem] | None = ...,
line: str = "",
read: bool = False,
before: str | re.Pattern[str] | list[CronItem] | tuple[CronItem, ...] | Generator[CronItem] | None = None,
) -> None: ...
def write(self, filename: str | None = ..., user: _User = ..., errors: bool = ...) -> None: ...
def write_to_user(self, user: bool | str = ...) -> None: ...
def write(self, filename: str | None = None, user: _User = None, errors: bool = False) -> None: ...
def write_to_user(self, user: bool | str = True) -> None: ...
# Usually `kwargs` are just `now: datetime | None`, but technically this can
# work for `CronItem` subclasses, which might define other kwargs.
def run_pending(self, *, now: datetime | None = ..., **kwargs: Any) -> Iterator[str]: ...
def run_pending(self, *, now: datetime | None = None, **kwargs: Any) -> Iterator[str]: ...
def run_scheduler(self, timeout: int = -1, cadence: int = 60, warp: bool = False) -> Iterator[str]: ...
def render(self, errors: bool = ...) -> str: ...
def render(self, errors: bool = False) -> str: ...
def new(
self,
command: str = ...,
comment: str = ...,
user: str | None = ...,
pre_comment: bool = ...,
before: str | re.Pattern[str] | list[CronItem] | tuple[CronItem, ...] | Generator[CronItem] | None = ...,
command: str = "",
comment: str = "",
user: str | None = None,
pre_comment: bool = False,
before: str | re.Pattern[str] | list[CronItem] | tuple[CronItem, ...] | Generator[CronItem] | None = None,
) -> CronItem: ...
def find_command(self, command: str | re.Pattern[str]) -> Iterator[CronItem]: ...
def find_comment(self, comment: str | re.Pattern[str]) -> Iterator[CronItem]: ...
Expand Down Expand Up @@ -137,25 +137,25 @@ class CronItem:
marker: str | None
stdin: str | None
slices: CronSlices
def __init__(self, command: str = ..., comment: str = ..., user: _User = ..., pre_comment: bool = ...) -> None: ...
def __init__(self, command: str = "", comment: str = "", user: _User = None, pre_comment: bool = False) -> None: ...
def __hash__(self) -> int: ...
def __eq__(self, other: object) -> bool: ...
@classmethod
def from_line(cls, line: str, user: str | None = ..., cron: CronTab | None = ...) -> Self: ...
def from_line(cls, line: str, user: str | None = None, cron: CronTab | None = None) -> Self: ...
def delete(self) -> None: ...
def set_command(self, cmd: str, parse_stdin: bool = ...) -> None: ...
def set_comment(self, cmt: str, pre_comment: bool = ...) -> None: ...
def set_command(self, cmd: str, parse_stdin: bool = False) -> None: ...
def set_comment(self, cmt: str, pre_comment: bool = False) -> None: ...
def parse(self, line: str) -> None: ...
def enable(self, enabled: bool = ...) -> bool: ...
def enable(self, enabled: bool = True) -> bool: ...
def is_enabled(self) -> bool: ...
def is_valid(self) -> bool: ...
def render(self) -> str: ...
def every_reboot(self) -> None: ...
def every(self, unit: int = ...) -> Every: ...
def every(self, unit: int = 1) -> Every: ...
def setall(self, *args: Any) -> None: ...
def clear(self) -> None: ...
def frequency(self, year: int | None = ...) -> int: ...
def frequency_per_year(self, year: int | None = ...) -> int: ...
def frequency(self, year: int | None = None) -> int: ...
def frequency_per_year(self, year: int | None = None) -> int: ...
def frequency_per_day(self) -> int: ...
def frequency_per_hour(self) -> int: ...
def frequency_at_year(self, year: int | None = None) -> int: ...
Expand All @@ -175,9 +175,9 @@ class CronItem:
@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_pending(self, now: datetime | None = None) -> int | str: ...
def run(self) -> str: ...
def schedule(self, date_from: datetime | None = ...) -> croniter: ...
def schedule(self, date_from: datetime | None = None) -> croniter: ...
def description(
self,
*,
Expand Down Expand Up @@ -232,8 +232,8 @@ class CronSlices(list[CronSlice]):
def clean_render(self) -> str: ...
def render(self) -> str: ...
def clear(self) -> None: ...
def frequency(self, year: int | None = ...) -> int: ...
def frequency_per_year(self, year: int | None = ...) -> int: ...
def frequency(self, year: int | None = None) -> int: ...
def frequency_per_year(self, year: int | None = None) -> int: ...
def frequency_per_day(self) -> int: ...
def frequency_per_hour(self) -> int: ...
def frequency_at_year(self, year: int | None = None) -> int: ...
Expand Down Expand Up @@ -274,23 +274,23 @@ class CronSlice:
name: str | None
enum: list[str | None] | None
parts: list[_Part]
def __init__(self, info: int | dict[str, Any], value: str | None = ...) -> None: ...
def __init__(self, info: int | dict[str, Any], value: str | None = None) -> None: ...
def __hash__(self) -> int: ...
def parse(self, value: str | None) -> None: ...
def render(self, resolve: bool = False) -> str: ...
def __eq__(self, arg: object) -> bool: ...
def every(self, n_value: int, also: bool = ...) -> _Part: ...
def every(self, n_value: int, also: bool = False) -> _Part: ...
# The only known kwarg, others are unused,
# `*args`` are passed to `parse_value`, so they are `Any`
def on(self, *n_value: Any, also: bool = ...) -> list[_Part]: ...
def during(self, vfrom: int | str, vto: int | str, also: bool = ...) -> _Part: ...
def on(self, *n_value: Any, also: bool = False) -> list[_Part]: ...
def during(self, vfrom: int | str, vto: int | str, also: bool = False) -> _Part: ...
@property
def also(self) -> Also: ...
def clear(self) -> None: ...
def get_range(self, *vrange: int | str | CronValue) -> list[int | CronRange]: ...
def __iter__(self) -> Iterator[int]: ...
def __len__(self) -> int: ...
def parse_value(self, val: str, sunday: int | None = ...) -> int | CronValue: ...
def parse_value(self, val: str, sunday: int | None = None) -> int | CronValue: ...
def test_value(self, value: str, sunday: int | None = None) -> str: ...

def get_cronvalue(value: int, enums: list[str]) -> int | CronValue: ...
Expand All @@ -313,7 +313,7 @@ class CronRange:
vto: int | CronValue
def parse(self, value: str) -> None: ...
def all(self) -> None: ...
def render(self, resolve: bool = ...) -> str: ...
def render(self, resolve: bool = False) -> str: ...
def range(self) -> _range: ...
def every(self, value: int | str) -> None: ...
def __lt__(self, value: object) -> bool: ...
Expand Down
6 changes: 3 additions & 3 deletions stubs/python-crontab/crontabs.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,16 @@ from typing import Any
from crontab import CronTab

class UserSpool(list[CronTab]):
def __init__(self, loc: str, tabs: CronTabs | None = ...) -> None: ...
def __init__(self, loc: str, tabs: CronTabs | None = None) -> None: ...
def listdir(self, loc: str) -> list[str]: ...
def get_owner(self, path: str) -> str: ...
def generate(self, loc: str, username: str) -> CronTab: ...

class SystemTab(list[CronTab]):
def __init__(self, loc: str, tabs: CronTabs | None = ...) -> None: ...
def __init__(self, loc: str, tabs: CronTabs | None = None) -> None: ...

class AnaCronTab(list[CronTab]):
def __init__(self, loc: str, tabs: CronTabs | None = ...) -> None: ...
def __init__(self, loc: str, tabs: CronTabs | None = None) -> None: ...
def add(self, loc: str, item: str, anajob: CronTab) -> CronTab: ...

KNOWN_LOCATIONS: list[tuple[UserSpool | SystemTab | AnaCronTab, str]]
Expand Down