-
Notifications
You must be signed in to change notification settings - Fork 3k
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
{Pylint} Fix unnecessary-dunder-call #30365
base: dev
Are you sure you want to change the base?
Conversation
❌AzureCLI-FullTest
|
️✔️AzureCLI-BreakingChangeTest
|
Pylint |
@@ -229,7 +229,7 @@ def test_load_cert_file(self): | |||
try: | |||
blob, thumbprint = load_cert_file(pfx_file, testpassword) | |||
except CLIInternalError as e: | |||
self.assertTrue(e.error_msg.error_msg.__contains__('Invalid password or PKCS12 data')) | |||
self.assertTrue(e.error_msg.error_msg in 'Invalid password or PKCS12 data') |
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.
You could use assertIn
@@ -63,7 +63,7 @@ def _validate_deployment_name_with_template_specs(namespace): | |||
namespace.template_spec = namespace.template_spec.strip("\"") | |||
if not is_valid_resource_id(namespace.template_spec): | |||
raise CLIError('--template-spec is not a valid resource ID.') | |||
if namespace.template_spec.__contains__("versions") is False: | |||
if (namespace.template_spec in "versions") is False: |
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.
if not ...
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'll check all code later. Some codes are so werid...
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.
These variables are also reversed, it should be "versions" in namespace.template_spec
.
Reported to astral-sh/ruff#14423
Fix this with
ruff check . --select PLC2801 --fix --preview --unsafe-fixes
unnecessary-dunder-call
was disabled in #26685Ref:
https://pylint.readthedocs.io/en/stable/user_guide/messages/convention/unnecessary-dunder-call.html
https://docs.astral.sh/ruff/rules/unnecessary-dunder-call/