Skip to content

Commit

Permalink
Updated deprecation warning according to the review
Browse files Browse the repository at this point in the history
  • Loading branch information
adrianboguszewski committed Aug 22, 2022
1 parent b32de01 commit fabc532
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 12 deletions.
10 changes: 1 addition & 9 deletions src/bindings/python/src/openvino/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ def add_openvino_libs_to_path() -> None:


def deprecated(version: str = "", message: str = "") -> Callable[..., Any]:
"""Prints deprecation warning and runs the function.
"""Prints deprecation warning "{function_name} is deprecated and will be removed in version {version}. {message}" and runs the function.
:param version: The version in which the code will be removed.
:param message: A message explaining why the function is deprecated and/or what to use instead.
Expand All @@ -46,12 +46,4 @@ def wrapper(*args: Any, **kwargs: Any) -> Callable[..., Any]:
deprecation_warning(wrapped.__name__, version, message)
return wrapped(*args, **kwargs)
return wrapper

# decorated function is assigned to version if there are no arguments passed
arg1 = version
if callable(arg1):
fun = arg1
version = ""
return decorator(fun)

return decorator
6 changes: 3 additions & 3 deletions src/bindings/python/src/pyopenvino/graph/util.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -78,10 +78,10 @@ void regmodule_graph_util(py::module m) {
Common::utils::deprecation_warning(function_name, version, message);
},
py::arg("function_name"),
py::arg("version") = std::string(),
py::arg("message") = std::string(),
py::arg("version") = "",
py::arg("message") = "",
R"(
Prints deprecation warning.
Prints deprecation warning "{function_name} is deprecated and will be removed in version {version}. {message}".
:param function_name: The name of the deprecated function.
:param version: The version in which the code will be removed.
Expand Down

0 comments on commit fabc532

Please sign in to comment.