1
0
mirror of https://github.com/opencv/opencv.git synced 2026-07-29 23:33:05 +04:00

fix: typing module enums references

Enum names exist only during type checking.
During runtime they should be denoted as named integral types
This commit is contained in:
Vadim Levin
2023-06-15 20:21:08 +03:00
parent 8e8638431d
commit a3b6a5b606
6 changed files with 94 additions and 15 deletions
@@ -12,6 +12,7 @@ if sys.version_info >= (3, 6):
from contextlib import contextmanager
from typing import Dict, Set, Any, Sequence, Generator, Union
import traceback
from pathlib import Path
@@ -46,10 +47,12 @@ if sys.version_info >= (3, 6):
try:
ret_type = func(*args, **kwargs)
except Exception as e:
except Exception:
self.has_failure = True
warnings.warn(
'Typing stubs generation has failed. Reason: {}'.format(e)
"Typing stubs generation has failed.\n{}".format(
traceback.format_exc()
)
)
if ret_type_on_failure is None:
return None