jmcarp commented on a change in pull request #4926: [AIRFLOW-4104] Add type
annotations to common classes.
URL: https://github.com/apache/airflow/pull/4926#discussion_r267149990
##########
File path: airflow/models/__init__.py
##########
@@ -3051,8 +3052,8 @@ def __init__(
)
self.schedule_interval = schedule_interval
- if isinstance(schedule_interval, Hashable) and schedule_interval in
cron_presets:
- self._schedule_interval = cron_presets.get(schedule_interval)
+ if isinstance(schedule_interval, six.string_types) and
schedule_interval in cron_presets:
Review comment:
It looks like the `Hashable` check was added because `relativedelta` objects
aren't hashable in `python-dateutil` before version 2.7. It turns out that the
keys of `cron_presets` are always strings, so we can check that
`schedule_interval` is a string instead of checking that it's hashable. We
could also require `python-dateutil>=2.7` and drop both checks.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services