Skip to content

Conversation

@jparise
Copy link
Member

@jparise jparise commented Mar 25, 2025

We previously constructed a frozen set of names that should be ignored at setup-time and then passed that set as an argument to each visitor function. A helper function -- _ignored(name, set) -- was used to test whether a given name should be ignored, matched using fnmatchcase().

This change introduces a NameSet type, which inherits from frozenset and implements __contains__ using fnmatchcase(). This allows us to simply use the in operator in visitor functions.

The previous code also (sometimes) treated the ignores argument as optional (defaulting to None). This value always exists so remove the optional notation.

We previously constructed a frozen set of names that should be ignored
at setup-time and then passed that set as an argument to each visitor
function. A helper function -- _ignored(name, set) -- was used to test
whether a given name should be ignored, matched using fnmatchcase().

This change introduces a `NameSet` type, which inherits from frozenset
and implements `__contains__` using fnmatchcase(). This allows us to
simply use the `in` operator in visitor functions.

The previous code also (sometimes) treated the `ignores` argument as
optional (defaulting to None). This value always exists so remove the
optional notation.
@jparise jparise requested a review from sigmavirus24 March 25, 2025 13:39
Copy link
Member

@sigmavirus24 sigmavirus24 left a comment

Choose a reason for hiding this comment

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

No request for changes just a question otherwise LGTM

@jparise jparise merged commit bc1a7e4 into PyCQA:main Mar 26, 2025
6 checks passed
@jparise jparise deleted the ignored-names branch March 26, 2025 14:21
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