You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
What to do with type aliases on module and class levels?
This seems like a tricky issue in general. Just from playing around with things for a short tim I've encountered quite a few cases that confuse wemake. For instance, this is flagged (which would be fixed by 1):
fromtypingimportLiteralHeight: Literal[128] =128# Triggers WPS432 avoid magic number
But I assume the following doesn't count as "annotation":
fromtypingimportLiteralSymbolicOne=Literal[1] # Also triggers WPS432.
I'm just guessing here, maybe letting wemake know about Generic Aliases could be helpful? Giving wemake deeper knowledge about types just so that it can ignore them seems like a lot of effort though 😅
Maybe a config flag for code that disables a certain set of warnings for generic code could be an option? Certainly not an optimal solution, but seems a lot easier to implement than knowledge about types.
One way to allow *TVT is to allow it in SomeType[*TVT], but not in [*TVT]
I will comment on Literal later, I am focusing on one task per commit right now :)
What's wrong
The following is not allowed by WPS356:
How it should be
According to https://peps.python.org/pep-0646/#type-variable-tuples-must-always-be-unpacked it is a hard requirement to unpack
Shape
in this case. Since wemake doesn't cover typing, it should ignore this case entirely.Flake8 version and plugins
Python 3.11
Flake8 6.0.0 with all plugins from
wemake-python-styleguide
0.18.0pip information
pip 23.2.1 (python 3.11)
OS information
Gentoo
The text was updated successfully, but these errors were encountered: