Skip to content

Fix pre-commit failure with noqa: ANN401 #691

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

cclauss
Copy link
Contributor

@cclauss cclauss commented Aug 12, 2025

https://docs.astral.sh/ruff/rules/any-type --> https://results.pre-commit.ci/repo/github/778163871

Also, why not make this change?

  def is_empty(val: Any) -> bool:
-     return val in (None, "", 0, 0.0, {}) or (isinstance(val, dict) and not val)
+     return not val

https://docs.astral.sh/ruff/rules/any-type

Also, why not make this change?
```diff
  def is_empty(val: Any) -> bool:
-     return val in (None, "", 0, 0.0, {}) or (isinstance(val, dict) and not val)
+     return not val
```
@Copilot Copilot AI review requested due to automatic review settings August 12, 2025 11:44
@cclauss cclauss requested a review from amilcarlucas as a code owner August 12, 2025 11:44
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR fixes a pre-commit linting failure by adding a noqa: ANN401 comment to suppress ruff's warning about using Any type annotation. The change addresses a specific linting rule that flags the use of Any type hints as potentially problematic.

Key Changes

  • Added noqa: ANN401 comment to suppress ruff's any-type warning for the is_empty function parameter

@@ -368,7 +368,7 @@ def wipe_component_info(self) -> None:
},
}

def is_empty(val: Any) -> bool:
def is_empty(val: Any) -> bool: # noqa: ANN401
return val in (None, "", 0, 0.0, {}) or (isinstance(val, dict) and not val)
Copy link
Preview

Copilot AI Aug 12, 2025

Choose a reason for hiding this comment

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

Consider replacing the complex logic with return not val as suggested in the PR description. The current implementation val in (None, "", 0, 0.0, {}) or (isinstance(val, dict) and not val) is redundant since Python's truthiness evaluation already handles these cases correctly, and the dict check is unnecessary as empty dicts are falsy.

Suggested change
return val in (None, "", 0, 0.0, {}) or (isinstance(val, dict) and not val)
return not val

Copilot uses AI. Check for mistakes.

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