Skip to content

fix: recursively re-export nested submodules in typing stubs#23956

Merged
asmorkalov merged 1 commit intoopencv:4.xfrom
VadimLevin:dev/vlevin/recursive-re-export-submodules
Jul 11, 2023
Merged

fix: recursively re-export nested submodules in typing stubs#23956
asmorkalov merged 1 commit intoopencv:4.xfrom
VadimLevin:dev/vlevin/recursive-re-export-submodules

Conversation

@VadimLevin
Copy link
Copy Markdown
Contributor

Addresses the same issue as #23809 , but also handles nested modules case

e.g. adds the following section to cv2/gapi/__init__.pyi:

from cv2.gapi import core as core
from cv2.gapi import ie as ie
from cv2.gapi import imgproc as imgproc
from cv2.gapi import oak as oak
from cv2.gapi import onnx as onnx
from cv2.gapi import ov as ov
from cv2.gapi import own as own
from cv2.gapi import render as render
from cv2.gapi import streaming as streaming
from cv2.gapi import video as video
from cv2.gapi import wip as wip

Pull Request Readiness Checklist

See details at https://github.com/opencv/opencv/wiki/How_to_contribute#making-a-good-pull-request

  • I agree to contribute to the project under Apache 2 License.
  • To the best of my knowledge, the proposed patch is not based on a code under GPL or another license that is incompatible with OpenCV
  • The PR is proposed to the proper branch
  • [] There is a reference to the original bug report and related work
  • [] There is accuracy test, performance test and test data in opencv_extra repository, if applicable
    Patch to opencv_extra has the same branch name.
  • The feature is well documented and sample code can be built with the project CMake

@VadimLevin
Copy link
Copy Markdown
Contributor Author

@Avasam what do you think regarding this change?

Copy link
Copy Markdown
Contributor

@asmorkalov asmorkalov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@asmorkalov
Copy link
Copy Markdown
Contributor

cc @TolyaTalamanov

@TolyaTalamanov
Copy link
Copy Markdown
Contributor

TolyaTalamanov commented Jul 11, 2023

cc @TolyaTalamanov

I'm not sure that I got what this is about.
Is it needed to have an opportunity to import particular nested namespace like that?

from cv2.gapi import core as core

@VadimLevin
Copy link
Copy Markdown
Contributor Author

cc @TolyaTalamanov

I'm not sure that I got what this is about. Is it needed to have an opportunity to import particular nested namespace like that?

from cv2.gapi import core as core

Basically this is required to indicate that classes or functions are accessible without extra module imports.

e.g. without this patch mypy will complain regarding the following usage

import cv2

cv2.gapi.core.cpu.kernels

that is completely legal in terms of cv2 package

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants