lru_cache variable_names_blacklist_from() logic function #1133
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
I have made things!
Checklist
CHANGELOG.md
Related issues
Closes #1130
To make using
lru_cache
decorator onvariable_names_blacklist_from()
possible -_ValidatedOptions
has to be hashable, which implies its immutability (I've usedattrs
frozen
argument) that btw is really expected in this case, because configuration options shouldn't be changed after they are loaded and validated.This change also required updating
ConfigurationOptions
protocol - all attributes need to be unsettable, because_ValidatedOptions
is now frozen/immutable.If you dislike current solution (personally I don't like new definition of
ConfigurationOptions
protocol, however according to few issues I have found onmypy
repo, it's the only way to define unsettable protocol's attributes) we can change current implementation ofvariable_names_blacklist_from()
a bit, so it will acceptallowed_domain_names
andforbidden_domain_names
immutable arguments instead of_ValidatedOptions
, however then_ValidatedOptions
will be defined as mutable.🙏 Please, if you or your company is finding wemake-python-styleguide valuable, help us sustain the project by sponsoring it transparently on https://opencollective.com/wemake-python-styleguide. As a thank you, your profile/company logo will be added to our main README which receives hundreds of unique visitors per day.