What's wrong
If you use upper case in enum classes, then everything is fine, WPS does not swear.
import enum
class CommandsConfigureEnum(enum.Enum):
"""Some docstr."""
VERBOSE = ('-v', '--verbose')
SILENT = ('-s', '--silent')
INSECURE = ('-k', '--insecure')
LOCATION = ('-L', '--location')
INCLUDE = ('-i', '--include')
But if you use inheritance, then problems begin.
import enum
class Commands(enum.Enum):
"""Some docstr."""
def __init__(
self,
short: str,
long: str,
) -> None:
self._short = short
self._long = long
@property
def short(self) -> str:
"""Short form."""
return self._short
@property
def long(self) -> str:
"""Long form."""
return self._long
def get(self, *, shorted: bool) -> str:
"""Returns curl command."""
return self.short if shorted else self.long
class CommandsConfigureEnum(Commands):
"""Some docstr."""
VERBOSE = ('-v', '--verbose')
SILENT = ('-s', '--silent')
INSECURE = ('-k', '--insecure')
LOCATION = ('-L', '--location')
INCLUDE = ('-i', '--include')
class CommandsTransferEnum(Commands):
"""Some docstr."""
SEND_DATA = ('-d', '--data')
HEADER = ('-H', '--header')
REQUEST = ('-X', '--request')
FORM = ('-F', '--form')
at this point, I catch the WPS115 error.
How it should be
Even with enum inheritance WPS115 should not occur
Flake8 version and plugins
{
"platform": {
"python_implementation": "CPython",
"python_version": "3.10.18",
"system": "Darwin"
},
"plugins": [
{
"plugin": "mccabe",
"version": "0.7.0"
},
{
"plugin": "pycodestyle",
"version": "2.14.0"
},
{
"plugin": "pyflakes",
"version": "3.4.0"
},
{
"plugin": "wemake-python-styleguide",
"version": "1.3.0"
}
],
"version": "7.3.0"
}
pip information
OS information
MacBook Pro (14-inch, 2021)
macOS Sonoma 14.6.1 arm64
What's wrong
If you use upper case in enum classes, then everything is fine, WPS does not swear.
But if you use inheritance, then problems begin.
at this point, I catch the WPS115 error.
How it should be
Even with enum inheritance WPS115 should not occur
Flake8 version and plugins
pip information
OS information
MacBook Pro (14-inch, 2021)
macOS Sonoma 14.6.1 arm64