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

PyinfraOperation: Put *args first so that mypy correctly handles inner operation args #1105

Merged
merged 1 commit into from
May 25, 2024

Conversation

cdleonard
Copy link
Contributor

This is not a mypy issue - unnamed arguments are passed in order so if PyinfraOperation were a real class instead of a protocol then PyinfraOperation.call("a", "b") would pass "a" and "b" to _sudo and _sudo_user.

This is the minimum fix to avoid errors like these:

pyinfra_deploy.py:6: error: Too few arguments for "__call__" of "PyinfraOperation"  [call-arg]
pyinfra_deploy.py:7: error: Argument 1 to "__call__" of "PyinfraOperation" has incompatible type "str"; expected "bool"  [arg-type]

I saw #1082 and this change is not included

…r operation args

This is not a mypy issue - unnamed arguments are passed in order so if
PyinfraOperation were a real class instead of a protocol then
PyinfraOperation.__call__("a", "b") would pass "a" and "b" to _sudo and
_sudo_user.

This is the minimum fix to avoid errors like these:

pyinfra_deploy.py:6: error: Too few arguments for "__call__" of "PyinfraOperation"  [call-arg]
pyinfra_deploy.py:7: error: Argument 1 to "__call__" of "PyinfraOperation" has incompatible type "str"; expected "bool"  [arg-type]
Copy link
Member

@Fizzadar Fizzadar left a comment

Choose a reason for hiding this comment

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

Aha! Great catch @cdleonard, thank you for the PR!

@Fizzadar Fizzadar merged commit eebdf96 into pyinfra-dev:3.x May 25, 2024
24 checks passed
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