-
Notifications
You must be signed in to change notification settings - Fork 16.4k
Fixing MyPy issues inside providers/microsoft #20409
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
Conversation
|
The PR is likely OK to be merged with just subset of tests for default Python and Database versions without running the full matrix of tests, because it does not modify the core of Airflow. If the committers decide that the full tests matrix is needed, they will add the label 'full tests needed'. Then you should rebase to the latest main or amend the last commit of the PR, and push it with --force-with-lease. |
|
@khalidmamadov : There is one problem. Context does not exist in Airlfow 2.1 so you will have to change it to Any - until we decide to make providers depends on 2.3+ |
5e34032 to
abec6c1
Compare
I see... let me fix |
|
@potiuk Since some of the example DAGs (in this provider and several others) that have Mypy complaining about |
|
Context is a TypedDict, which naturally downcasts to |
Oh yeah. that would be the best soluition - using |
Should be possible. I think for that we would have to write a little extra logic here: airflow/docs/exts/exampleinclude.py Line 52 in f959104
|
I will try as you suggest |
It will not work as exepected because of Liskov substitution principle. But I think I found a nice "workaround": In imports section of all operators/sensors: |
|
Example on how we can treat Context here: #20422 |
This look good, will try this as well |
733071d to
1e5940b
Compare
| # Mark closed so we don't double write if close is called twice | ||
| self.closed = True | ||
|
|
||
| def _read(self, ti, try_number: str, metadata: Optional[str] = None) -> Tuple[str, Dict[str, bool]]: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
hmmmmmm :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there anything wrong here? didn't get :)
potiuk
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wish we had better solution for the "default_args" but it must do for now :(
|
Some static checks :( |
Yes, pre-commit was disabled... re-enabled now and fixed |
BTW. You know you can disable just selected pre-commits @khalidmammadov ? Also :D |
Ah, didnt know that (looked up for something like that but didn't find..) thank for that! |
You are most welcome. Pre-commit has a number of useful things built in - for example you can easily run pre-commit on the last commit only: Also see here: https://github.com/apache/airflow/blob/main/STATIC_CODE_CHECKS.rst#id1 "using pre-commit" for some other stuff. |
Thanks for these, I will definitely will make use of these! |
Part of #19891
Issue fixed:
_readmethod ofWasbTaskHandler^ 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.