Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mypy fails when isinstance is used with nptyping type #121

Open
nazikus opened this issue Jul 14, 2024 · 0 comments
Open

Mypy fails when isinstance is used with nptyping type #121

nazikus opened this issue Jul 14, 2024 · 0 comments

Comments

@nazikus
Copy link

nazikus commented Jul 14, 2024

Basic example test.py:

import cv2
from nptyping import Float64, NDArray, Shape
Image = NDArray[Shape["H, W, 3"], Float64]
image = cv2.imread("image.png")
assert isinstance(image, Image)

Run:

> pip install -U opencv-python==4.10.0.84 nptyping==2.5.0 mypy==1.10.1
> mypy test.py
test.py:5: error: Parameterized generics cannot be used with class or instance checks  [misc]

How to use nptyping with opencv and isinstance() properly so mypy check is passed?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant