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

types for opencv causing errors #210

Closed
kaczmarj opened this issue Jan 4, 2024 · 0 comments · Fixed by #211
Closed

types for opencv causing errors #210

kaczmarj opened this issue Jan 4, 2024 · 0 comments · Fixed by #211

Comments

@kaczmarj
Copy link
Member

kaczmarj commented Jan 4, 2024

cv2 has a typ Mat, which is aliased to a generic numpy array. previously, we expected uint8 arrays, not generics. this causes issues when type checking

wsinfer/patchlib/patch.py:56: error: Incompatible types in assignment (expression has type "Mat | ndarray[Any, dtype[generic]]", variable has type "ndarray[Any, dtype[signedinteger[Any]]]")  [assignment]
wsinfer/patchlib/patch.py:68: error: Unsupported operand types for * ("ndarray[Any, dtype[generic]]" and "ndarray[Any, dtype[floating[Any]]]")  [operator]
wsinfer/patchlib/patch.py:118: error: Incompatible return value type (got "tuple[Any, Sequence[ndarray[Any, dtype[generic]]], ndarray[Any, dtype[signedinteger[Any]]]]", expected "tuple[Any, Sequence[ndarray[Any, dtype[signedinteger[Any]]]], ndarray[Any, dtype[signedinteger[Any]]]]")  [return-value]
wsinfer/patchlib/segment.py:50: error: Incompatible types in assignment (expression has type "ndarray[Any, dtype[generic]]", variable has type "ndarray[Any, dtype[unsignedinteger[_8Bit]]]")  [assignment]
wsinfer/patchlib/segment.py:63: error: Incompatible types in assignment (expression has type "ndarray[Any, dtype[generic]]", variable has type "ndarray[Any, dtype[unsignedinteger[_8Bit]]]")  [assignment]
wsinfer/patchlib/segment.py:66: error: Incompatible types in assignment (expression has type "Mat | ndarray[Any, dtype[generic]]", variable has type "ndarray[Any, dtype[unsignedinteger[_8Bit]]]")  [assignment]

found in #209

kaczmarj added a commit that referenced this issue Jan 4, 2024
kaczmarj added a commit that referenced this issue Jan 4, 2024
* fix types when using cv2

fixes #210

* sort imports
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

Successfully merging a pull request may close this issue.

1 participant