mirror of
https://github.com/opencv/opencv.git
synced 2026-11-20 00:05:12 -06:00
The generated cv2/typing/__init__.py defined LayerId as cv2.dnn.DictValue. This line runs on every "import cv2", so if cv2.dnn.DictValue is not available the whole import fails with AttributeError. Net::Impl::getLayerId(DictValue&) accepts only an integer layer index or a string layer name and asserts for anything else, so describe LayerId as Union[int, str]. This also removes the runtime dependency on cv2.dnn from the typing module. Add a test that checks the generated cv2.typing.LayerId alias.