Skip to content

Completed cv2.Error and cv2.error types #219

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

Merged
merged 6 commits into from
Jun 6, 2023
Merged

Conversation

Avasam
Copy link
Contributor

@Avasam Avasam commented Jul 23, 2022

I have completed the self-referencing cv2.error (mentioned in #213) and the missing module cv2.Error. I've done so by looking at the content during runtime.

There's still two issues I'm not sure how to fix, suggestions are welcome.

  1. Python language server in VSCode reporting Error as Any if imported from cv2:
import cv2
from cv2 import Error
cv2.Error.STS_ASSERT
Error.STS_ASSERT

image

Although the "Go to Definition" action still works.

  1. Pyrigth will report reportMissingModuleSource and Pylint will report no-name-in-module with import cv2.Error:
import cv2.Error
cv2.Error.STS_ASSERT

image
image

Pylint is somewhat excepted and can be worked around by adding "cv2" to the extension-pkg-allow-list configuration. Pyright however, I am not sure.

@Avasam
Copy link
Contributor Author

Avasam commented Jul 23, 2022

I figured out my first point, I replaced from cv2 import Error, by

import cv2.Error as Error
__all__ = ["Error"]

and it all references properly now.

As for the second point, I guess if you are going to use import cv2.Error, with Pyright just ignore the error for this line. Since Pyright is right that the source is missing, givent that it's generated.

@Avasam
Copy link
Contributor Author

Avasam commented Sep 1, 2022

Can I get a review on this?

@debonte debonte requested a review from bschnurr September 8, 2022 01:14
Avasam added a commit to Avasam/typeshed that referenced this pull request Oct 11, 2022
@debonte debonte merged commit 4d5e094 into microsoft:main Jun 6, 2023
@debonte
Copy link
Contributor

debonte commented Jun 6, 2023

@Avasam, thanks for this change and all your other recent cleanup work in this repo! :)

@Avasam Avasam deleted the cv2.error branch June 6, 2023 02:27
daniel-zullo-frequenz pushed a commit to daniel-zullo-frequenz/python-type-stubs that referenced this pull request Sep 18, 2023
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 this pull request may close these issues.

2 participants