mirror of
https://github.com/opencv/opencv.git
synced 2025-06-11 20:09:23 +08:00
fix wrong python type hints for imread
This commit is contained in:
parent
740388b3ce
commit
bbca50ecc5
@ -52,6 +52,20 @@ def apply_manual_api_refinement(root: NamespaceNode) -> None:
|
||||
])
|
||||
|
||||
|
||||
def make_optional_none_return(root_node: NamespaceNode,
|
||||
function_symbol_name: SymbolName) -> None:
|
||||
"""
|
||||
Make return type Optional[MatLike],
|
||||
for the functions that may return None.
|
||||
"""
|
||||
function = find_function_node(root_node, function_symbol_name)
|
||||
for overload in function.overloads:
|
||||
if overload.return_type is not None:
|
||||
if not isinstance(overload.return_type.type_node, OptionalTypeNode):
|
||||
overload.return_type.type_node = OptionalTypeNode(
|
||||
overload.return_type.type_node
|
||||
)
|
||||
|
||||
def export_matrix_type_constants(root: NamespaceNode) -> None:
|
||||
MAX_PREDEFINED_CHANNELS = 4
|
||||
|
||||
@ -326,6 +340,8 @@ NODES_TO_REFINE = {
|
||||
SymbolName(("cv", ), (), "resize"): make_optional_arg("dsize"),
|
||||
SymbolName(("cv", ), (), "calcHist"): make_optional_arg("mask"),
|
||||
SymbolName(("cv", ), (), "floodFill"): make_optional_arg("mask"),
|
||||
SymbolName(("cv", ), (), "imread"): make_optional_none_return,
|
||||
SymbolName(("cv", ), (), "imdecode"): make_optional_none_return,
|
||||
}
|
||||
|
||||
ERROR_CLASS_PROPERTIES = (
|
||||
|
Loading…
Reference in New Issue
Block a user