Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenCV
opencv
提交
32251c9b
O
opencv
项目概览
OpenCV
/
opencv
上一次同步 8 个月
通知
988
Star
71100
Fork
55581
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
1
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
O
opencv
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
1
Issue
1
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
提交
32251c9b
编写于
7月 04, 2023
作者:
A
Avasam
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Add missing properties to error class
上级
8839bd57
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
12 addition
and
3 deletion
+12
-3
modules/python/src2/typing_stubs_generation/api_refinement.py
...les/python/src2/typing_stubs_generation/api_refinement.py
+11
-2
modules/python/src2/typing_stubs_generation/nodes/__init__.py
...les/python/src2/typing_stubs_generation/nodes/__init__.py
+1
-1
未找到文件。
modules/python/src2/typing_stubs_generation/api_refinement.py
浏览文件 @
32251c9b
...
...
@@ -3,7 +3,8 @@ __all__ = [
]
from
typing
import
Sequence
,
Callable
from
.nodes
import
NamespaceNode
,
FunctionNode
,
OptionalTypeNode
from
.nodes
import
NamespaceNode
,
FunctionNode
,
OptionalTypeNode
,
ClassProperty
,
PrimitiveTypeNode
from
.ast_utils
import
find_function_node
,
SymbolName
...
...
@@ -11,7 +12,7 @@ def apply_manual_api_refinement(root: NamespaceNode) -> None:
# Export OpenCV exception class
builtin_exception
=
root
.
add_class
(
"Exception"
)
builtin_exception
.
is_exported
=
False
root
.
add_class
(
"error"
,
(
builtin_exception
,
))
root
.
add_class
(
"error"
,
(
builtin_exception
,
)
,
ERROR_CLASS_PROPERTIES
)
for
symbol_name
,
refine_symbol
in
NODES_TO_REFINE
.
items
():
refine_symbol
(
root
,
symbol_name
)
...
...
@@ -46,3 +47,11 @@ NODES_TO_REFINE = {
SymbolName
((
"cv"
,
),
(),
"resize"
):
make_optional_arg
(
"dsize"
),
SymbolName
((
"cv"
,
),
(),
"calcHist"
):
make_optional_arg
(
"mask"
),
}
ERROR_CLASS_PROPERTIES
=
(
ClassProperty
(
"code"
,
PrimitiveTypeNode
.
int_
(),
False
),
ClassProperty
(
"err"
,
PrimitiveTypeNode
.
str_
(),
False
),
ClassProperty
(
"file"
,
PrimitiveTypeNode
.
str_
(),
False
),
ClassProperty
(
"func"
,
PrimitiveTypeNode
.
str_
(),
False
),
ClassProperty
(
"line"
,
PrimitiveTypeNode
.
int_
(),
False
),
ClassProperty
(
"msg"
,
PrimitiveTypeNode
.
str_
(),
False
),
)
modules/python/src2/typing_stubs_generation/nodes/__init__.py
浏览文件 @
32251c9b
...
...
@@ -7,5 +7,5 @@ from .constant_node import ConstantNode
from
.type_node
import
(
TypeNode
,
OptionalTypeNode
,
UnionTypeNode
,
NoneTypeNode
,
TupleTypeNode
,
ASTNodeTypeNode
,
AliasTypeNode
,
SequenceTypeNode
,
AnyTypeNode
,
AggregatedTypeNode
,
NDArrayTypeNode
,
AliasRefTypeNode
,
AggregatedTypeNode
,
NDArrayTypeNode
,
AliasRefTypeNode
,
PrimitiveTypeNode
)
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录