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

Fix mypy error postitional only #3498

Merged
merged 24 commits into from
Jan 11, 2024

Conversation

merelcht
Copy link
Member

@merelcht merelcht commented Jan 9, 2024

Description

Part of #2156 and follow up on #3497 and #3490

Development notes

This PR specifically addresses the following error which was flagged for all CLI commands where we call @click.pass_obj

kedro/framework/cli/pipeline.py:139: error: Argument 1 to "pass_obj" has incompatible type "Callable[[ProjectMetadata, str, str, bool, KwArg(Any)], None]"; expected "Callable[[Any, str, str, bool, KwArg(Any)], None]"  [arg-type]
kedro/framework/cli/pipeline.py:139: note: This is likely because "delete_pipeline" has named arguments: "metadata". Consider marking them positional-only

Developer Certificate of Origin

We need all contributions to comply with the Developer Certificate of Origin (DCO). All commits must be signed off by including a Signed-off-by line in the commit message. See our wiki for guidance.

If your PR is blocked due to unsigned commits, then you must follow the instructions under "Rebase the branch" on the GitHub Checks page for your PR. This will retroactively add the sign-off to all unsigned commits and allow the DCO check to pass.

Checklist

  • Read the contributing guidelines
  • Signed off each commit with a Developer Certificate of Origin (DCO)
  • Opened this PR as a 'Draft Pull Request' if it is work-in-progress
  • Updated the documentation to reflect the code changes
  • Added a description of this change in the RELEASE.md file
  • Added tests to cover my changes
  • Checked if this change will affect Kedro-Viz, and if so, communicated that with the Viz team

Signed-off-by: Merel Theisen <merel.theisen@quantumblack.com>
Signed-off-by: Merel Theisen <merel.theisen@quantumblack.com>
Signed-off-by: Merel Theisen <merel.theisen@quantumblack.com>
Signed-off-by: Merel Theisen <merel.theisen@quantumblack.com>
Signed-off-by: Merel Theisen <merel.theisen@quantumblack.com>
Signed-off-by: Merel Theisen <merel.theisen@quantumblack.com>
Signed-off-by: Merel Theisen <merel.theisen@quantumblack.com>
Signed-off-by: Merel Theisen <merel.theisen@quantumblack.com>
Signed-off-by: Merel Theisen <merel.theisen@quantumblack.com>
Signed-off-by: Merel Theisen <merel.theisen@quantumblack.com>
Signed-off-by: Merel Theisen <merel.theisen@quantumblack.com>
Signed-off-by: Merel Theisen <merel.theisen@quantumblack.com>
Signed-off-by: Merel Theisen <merel.theisen@quantumblack.com>
Signed-off-by: Merel Theisen <merel.theisen@quantumblack.com>
Signed-off-by: Merel Theisen <merel.theisen@quantumblack.com>
Signed-off-by: Merel Theisen <merel.theisen@quantumblack.com>
Signed-off-by: Merel Theisen <merel.theisen@quantumblack.com>
Signed-off-by: Merel Theisen <merel.theisen@quantumblack.com>
Signed-off-by: Merel Theisen <merel.theisen@quantumblack.com>
Signed-off-by: Merel Theisen <merel.theisen@quantumblack.com>
Signed-off-by: Merel Theisen <merel.theisen@quantumblack.com>
Signed-off-by: Merel Theisen <merel.theisen@quantumblack.com>
@merelcht merelcht self-assigned this Jan 9, 2024
@merelcht merelcht mentioned this pull request Jan 9, 2024
7 tasks
@astrojuanlu
Copy link
Member

Argument 1 to "pass_obj" has incompatible type "Callable[[ProjectMetadata, str, str, bool, KwArg(Any)], None]"; expected "Callable[[Any, str, str, bool, KwArg(Any)], None]"  [arg-type]

MyPy error messages always so helpful... isn't ProjectMetadata compatible with Any?


This is likely because "delete_pipeline" has named arguments: "metadata". Consider marking them positional-only

does this solution work to avoid adding the # type: ignore comments?

Signed-off-by: Merel Theisen <merel.theisen@quantumblack.com>
@merelcht
Copy link
Member Author

This is likely because "delete_pipeline" has named arguments: "metadata". Consider marking them positional-only

does this solution work to avoid adding the # type: ignore comments?

Ah it does! I couldn't figure out at first how to do this. The only thing I'm not 100% sure about is whether the argument args: Any in some of the CLI commands should be marked as positional-only as well?

@astrojuanlu
Copy link
Member

The only thing I'm not 100% sure about is whether the argument args: Any in some of the CLI commands should be marked as positional-only as well?

Good question 🤔 Not sure how the current args are being used, I'm used to see *args instead but not sure it makes sense in this case (and *args are positional-only by definition).

Base automatically changed from fix-mypy-strict-issues-2 to fix-issues-flagged-by-mypy-strict January 11, 2024 11:26
…-only-error

Signed-off-by: Merel Theisen <49397448+merelcht@users.noreply.github.com>
Copy link
Contributor

@DimedS DimedS left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, @merelcht , LGTM!

@merelcht merelcht merged commit bf2cbf1 into fix-issues-flagged-by-mypy-strict Jan 11, 2024
3 of 4 checks passed
@merelcht merelcht deleted the fix-postitional-only-error branch January 11, 2024 12:23
@merelcht merelcht mentioned this pull request Jan 12, 2024
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.

5 participants