Skip to content

[python-crontab] Fix return types of CronItem time slice properties - #16492

Open
LuisFigueroaG wants to merge 1 commit into
python:mainfrom
LuisFigueroaG:fix/crontab-slice-properties
Open

LuisFigueroaG wants to merge 1 commit into
python:mainfrom
LuisFigueroaG:fix/crontab-slice-properties

Conversation

@LuisFigueroaG

Copy link
Copy Markdown

CronItem.minute, hour, dow, etc. and CronItem[i] are annotated as returning int | str, but they return the CronSlice objects from self.slices (crontab.py#L904-L956), so the documented job.minute.every(5) style fails to type check.

This changes them to return CronSlice and types the __getitem__ key as SupportsIndex (it indexes a list).

Prepared with Claude Code.

@github-actions

github-actions Bot commented Oct 7, 2026

Copy link
Copy Markdown
Contributor

According to mypy_primer, this change has no effect on the checked open source code. 🤖🎉

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant