Remove dataclass from BaseFakeNumpyNamespace#331
Remove dataclass from BaseFakeNumpyNamespace#331alexfikl wants to merge 1 commit intoinducer:mainfrom
Conversation
|
Hm, |
Could you explain? What didn't get picked up? By whom? To what end? And: I'm not sure I understand why it's a problem that some classes in an inheritance graph are data classes and others not. That seems fine, no? |
Oops, sorry, I threw this out a bit quick and forgot to explain. For a simplified example from typing import TYPE_CHECKING
import pyopencl as cl
from arraycontext import PyOpenCLArrayContext
ctx = cl.create_some_context()
queue = cl.CommandQueue(ctx)
actx = PyOpenCLArrayContext(queue)
assert actx.np._array_context.queue is queue
if TYPE_CHECKING:
reveal_type(actx.np._array_context)I first ran into this with > python -m pylint --disable=all --enable=E --disable=E1136 --enable=I0021 actx.py
***** Module actx
actx.py:10:7: E1101: Instance of 'ArrayContext' has no 'queue' member (no-member)but > basedpyright actx.py
.../arraycontext/actx.py
.../arraycontext/actx.py:10:8 - warning: Type of "queue" is unknown (reportUnknownMemberType)
.../arraycontext/actx.py:10:31 - error: Cannot access attribute "queue" for class "ArrayContext"
Attribute "queue" is unknown (reportAttributeAccessIssue)
.../arraycontext/actx.py:13:17 - information: Type of "actx.np._array_context" is "ArrayContext"My guess is that neither one picks up class PyOpenCLFakeNumpyNamespace(LoopyBasedFakeNumpyNamespace):
_array_context: PyOpenCLArrayContextAre you seeing this too or is it just my setup? I thought this was a dataclass issue, but it might also be because of the return types of EDIT: Adding a |
This seems like the way to go IMO. I'm not worried about pylint not "getting" it; I've already dropped it from CI. |
Not quite sure why this was made a dataclass in #322, but none of the subclasses were updated to be dataclasses too? This made some things not get picked up properly (as far as I can tell), like the updated attribute type