-
Notifications
You must be signed in to change notification settings - Fork 283
Closed
Labels
Description
I have a base class which defines a ClassVar:
from typing import ClassVar
class Endpoint: ...
class Controller:
endpoint_cls: ClassVar[type[Endpoint]] = EndpointLater I have a subclass of a Controller which is defined like so:
class MyController(Controller):
class endpoint_cls(Endpoint): ...For this code pyrefly raises:
poetry run pyrefly check
INFO Checking project configured at `/home/runner/work/django-modern-rest/django-modern-rest/pyproject.toml`
ERROR Class member `SSEController.endpoint_cls` overrides parent class `Controller` in an inconsistent manner [bad-override]
--> dmr/sse/builder.py:284:15
|
284 | class endpoint_cls(Endpoint): # noqa: N801, WPS431
| ^^^^^^^^^^^^
|
`SSEController.endpoint_cls` is not a ClassVar, but `Controller.endpoint_cls` is
INFO 1 error (68 suppressed)
It looks like a false-positive to be. Because class endpoint_cls definition is made on the class level, not instance level.
CI link: https://github.com/wemake-services/django-modern-rest/actions/runs/22378967600/job/64775321370?pr=562
Original source: https://github.com/wemake-services/django-modern-rest/blob/91b1be5bd57618223aec149963cd3ce2f3460d8c/dmr/sse/builder.py#L284-L285
Reactions are currently unavailable