Skip to content

Conversation

@amoghrajesh
Copy link
Contributor

Croniter released new version:

564c564
< types-croniter==5.0.1.20250322
---
> types-croniter==6.0.0.20250411

Due to this the cron.get_prev can return float as well causing mypy to complain:

airflow-core/src/airflow/timetables/_cron.py:112: error: Incompatible return
value type (got "None", expected "DateTime")  [return-value]
                return convert_to_utc(make_aware(scheduled, self._timezone...
                       ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
airflow-core/src/airflow/timetables/_cron.py:112: error: No overload variant of
"make_aware" matches argument types "float", "Union[Timezone, FixedTimezone]" 
[call-overload]
                return convert_to_utc(make_aware(scheduled, self._timezone...
                                      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
airflow-core/src/airflow/timetables/_cron.py:112: note: Possible overload variants:
airflow-core/src/airflow/timetables/_cron.py:112: note:     def make_aware(value: None, timezone: Optional[tzinfo] = ...) -> None
airflow-core/src/airflow/timetables/_cron.py:112: note:     def make_aware(value: DateTime, timezone: Optional[tzinfo] = ...) -> DateTime
airflow-core/src/airflow/timetables/_cron.py:112: note:     def make_aware(value: datetime, timezone: Optional[tzinfo] = ...) -> datetime
Found 2 errors in 1 file (checked 971 source files)
Error 1 returned
You are running mypy with the folders selected. If you want to reproduce it locally, you need to run the following command:

pre-commit run --hook-stage manual mypy-<folder> --all-files

Added a type checking for it so that its happy 🗡️

Example: https://github.com/apache/airflow/actions/runs/14404400215/job/40397831030


^ Add meaningful description above
Read the Pull Request Guidelines for more information.
In case of fundamental code changes, an Airflow Improvement Proposal (AIP) is needed.
In case of a new dependency, check compliance with the ASF 3rd Party License Policy.
In case of backwards incompatible changes please leave a note in a newsfragment file, named {pr_number}.significant.rst or {issue_number}.significant.rst, in airflow-core/newsfragments.

@amoghrajesh amoghrajesh merged commit 93a5635 into apache:main Apr 11, 2025
50 checks passed
potiuk pushed a commit to potiuk/airflow that referenced this pull request Apr 12, 2025
(cherry picked from commit 93a5635)

Co-authored-by: Amogh Desai <amoghrajesh1999@gmail.com>
potiuk added a commit that referenced this pull request Apr 12, 2025
…49156)

(cherry picked from commit 93a5635)

Co-authored-by: Amogh Desai <amoghrajesh1999@gmail.com>
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.

2 participants