From 61917f211f73f5c42960910f261186d4afbd2bdb Mon Sep 17 00:00:00 2001 From: Abhishek Date: Tue, 10 Nov 2026 18:12:53 -0600 Subject: [PATCH 1/2] [python-crontab] Support slicing cron tables --- stubs/python-crontab/crontab.pyi | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/stubs/python-crontab/crontab.pyi b/stubs/python-crontab/crontab.pyi index 5e22b4dea803..4715a56f5fe3 100644 --- a/stubs/python-crontab/crontab.pyi +++ b/stubs/python-crontab/crontab.pyi @@ -121,7 +121,12 @@ class CronTab: ) -> int: ... def remove(self, *items: CronItem | Iterable[CronItem]) -> int: ... def __iter__(self) -> Iterator[CronItem]: ... + + @overload def __getitem__(self, i: SupportsIndex) -> CronItem: ... + @overload + def __getitem__(self, i: slice) -> list[CronItem]: ... + def __len__(self) -> int: ... class CronItem: From 0517f24979ccb2e944ec21282dd0c8fe65355898 Mon Sep 17 00:00:00 2001 From: Abhishek Date: Tue, 10 Nov 2026 18:49:27 -0600 Subject: [PATCH 2/2] [python-crontab] Reflect initialized collections and environment --- stubs/python-crontab/crontab.pyi | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/stubs/python-crontab/crontab.pyi b/stubs/python-crontab/crontab.pyi index 4715a56f5fe3..c08289f3a13b 100644 --- a/stubs/python-crontab/crontab.pyi +++ b/stubs/python-crontab/crontab.pyi @@ -62,11 +62,11 @@ class Process: def __eq__(self, other: object) -> bool: ... class CronTab: - lines: list[str | CronItem] | None - crons: list[CronItem] | None + lines: list[str | CronItem] + crons: list[CronItem] filen: str | None cron_command: str - env: OrderedVariableList[str, str] | None + env: OrderedVariableList[str, str] root: bool intab: str | None tabfile: str | None