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
@@ -1,4 +1,4 @@
from .node import ASTNode
from .node import ASTNode, ASTNodeType
from .namespace_node import NamespaceNode
from .class_node import ClassNode, ClassProperty
from .function_node import FunctionNode
@@ -1,7 +1,7 @@
import abc
import enum
import itertools
from typing import (Iterator, Type, TypeVar, Iterable, Dict,
from typing import (Iterator, Type, TypeVar, Dict,
Optional, Tuple, DefaultDict)
from collections import defaultdict
@@ -417,6 +417,10 @@ class ASTNodeTypeNode(TypeNode):
self._module_name = module_name
self._ast_node: Optional[weakref.ProxyType[ASTNode]] = None
@property
def ast_node(self):
return self._ast_node
@property
def typename(self) -> str:
if self._ast_node is None: