[ruff] Added cls.__dict__.get('__annotations__') check (RUF063) by dericcrago · Pull Request #18233 · astral-sh/ruff (original) (raw)
added the rule
Implementing or modifying a lint rule
label
ntBre mentioned this pull request
Python < 3.10 with typing_extensions enabled.
Co-authored-by: Brent Westbrook 36778786+ntBre@users.noreply.github.com
This commit renames the rule from AnnotationsFromClassDict to
AccessAnnotationsFromClassDict to better reflect its expanded scope.
The rule has been extended to detect direct subscript access
(e.g., foo.__dict__["__annotations__"]), in addition to the existing
check for foo.__dict__.get("__annotations__") method calls.
This change provides more comprehensive detection of this discouraged access pattern.
ntBre changed the title
Added [cls.__dict__.get('__annotations__') checkruff] Added cls.__dict__.get('__annotations__') check (RUF063)
dcreager added a commit that referenced this pull request
- main: (21 commits)
[
flake8-logging] Avoid false positive forexc_info=Trueoutsidelogger.exception(LOG014) (#18737) [flake8-pie] Small docs fix toPIE794(#18829) [pylint] Ignore init.py files in (PLC0414) (#18400) Avoid generating diagnostics with per-file ignores (#18801) [flake8-simplify] Fix false negatives for shadowed bindings (SIM910,SIM911) (#18794) [ty] Fix panics when pulling types forClassVarorFinalparameterized with >1 argument (#18824) [pylint] add fix safety section (PLR1714) (#18415) [Perflint] Small docs improvement toPERF401(#18786) [pylint] Avoid flattening nestedmin/maxwhen outer call has single argument (PLW3301) (#16885) [ruff] Addedcls.__dict__.get('__annotations__')check (RUF063) (#18233) [ty] UseHashTableinPlaceTable(#18819) docs: Correct collections-named-tuple example to use PascalCase assignment (#16884) [ty] ecosystem-analyzer workflow (#18719) [ty] Add support for@staticmethods (#18809) unnecessary_dict_kwargs doc - a note on type checking benefits (#18666) [flake8-pytest-style] Mark autofix forPT001andPT023as unsafe if there's comments in the decorator (#18792) [ty] Surface matched overload diagnostic directly (#18452) [ty] Report when a dataclass contains more than oneKW_ONLYfield (#18731) [flake8-pie] Add fix safety section toPIE794(#18802) [pycodestyle] Add fix safety section toW291andW293(#18800) ...
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
[ Show hidden characters]({{ revealButtonHref }})