Feature Request: Refactor collections.namedtuple
to typing.NamedTuple
#7014
Avasam
started this conversation in
Enhancement
Replies: 1 comment
-
Transferring to discussions for up votes |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Pyright (by extension, pylance), will raise reportUntypedNamedTuple for function-based namedtuples.
I'm requesting an editor action to easily refactor it into a class-based NamedTuple
This:
Would refactor into that:
(note the use of
__name__
when the class name and variable name don't match)This change being tedious (jaraco/skeleton#165) and not autofixable by linters (astral-sh/ruff#16491) is why I'm requesting this as a feature.
This can probably be exampled to other function-to-class transforms as well (enums come to mind)
Beta Was this translation helpful? Give feedback.
All reactions