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
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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.


def merge_defaults(target: dict, defaults: dict) -> None:
Expand Down
Loading