Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixing various issues in utils folder reported by MyPy #20504

Closed

Conversation

khalidmammadov
Copy link
Contributor

@khalidmammadov khalidmammadov commented Dec 26, 2021

Part of #19891

Fixes number of issues reported by MyPy:

  • Provide explicit type for dates variable
  • states_by_task_id is not Optional as functions upstream and downstream are not that passes the same variable
  • render_dag_dependencies function's only parameter is not optional as it does not handle that case nor anywhere in the codebase it is accessed as empty
  • self.filename_template and self.filename_jinja_template are Optional and hence need to be handled accordingly inside _render_filename function
  • Handling case when regex does not match anything
  • Providing possible types for "template_env" variable explicitly
  • Removed Overloading for the functions. I don't see any reason why they are necessary. @ashb Please comment otherwise as they were added in Improve handling edge-cases in airlfow.models by applying mypy #20000
  • Better handling for dynamic field access for localize and convert methods
  • relativedelta does not define type for seconds and accepts float (I tested empirically) as well which MyPy complains that is not allowed. So, ignoring
  • MyPy dont understand that v in pendulum.instance(v can not be None as previous check and hence failing
  • Added one more test case for correct_maybe_zipped to check for an empty input

This is Part 1 for (airflow/utils) and will do Part 2 in a separate PR to keep scope small for review and focus.


^ Add meaningful description above

Read the Pull Request Guidelines for more information.
In case of fundamental code change, 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 UPDATING.md.

@khalidmammadov khalidmammadov changed the title Fixing various issues in utils folder reported by MyPy (part 1) Fixing various issues in utils folder reported by MyPy Dec 27, 2021
@khalidmammadov
Copy link
Contributor Author

Closing in favor of #20482

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