[PyOV] Mark add_openvnio_libs as internal (#16971)

* [PyOV] Mark add_openvnio_libs as internal

* fix flake8
This commit is contained in:
Anastasia Kuporosova
2023-04-17 17:34:13 +01:00
committed by GitHub
parent 47f0d72f02
commit f9098cd67c
11 changed files with 30 additions and 23 deletions
@@ -4,9 +4,9 @@
# flake8: noqa
from openvino.utils import add_openvino_libs_to_path
from openvino.utils import _add_openvino_libs_to_search_path
add_openvino_libs_to_path()
_add_openvino_libs_to_search_path()
from openvino._pyopenvino import get_version
@@ -8,9 +8,9 @@ Low level wrappers for the FrontEnd C++ API.
# flake8: noqa
from openvino.utils import add_openvino_libs_to_path
from openvino.utils import _add_openvino_libs_to_search_path
add_openvino_libs_to_path()
_add_openvino_libs_to_search_path()
from openvino._pyopenvino import get_version
@@ -8,9 +8,9 @@ Low level wrappers for the FrontEnd C++ API.
# flake8: noqa
from openvino.utils import add_openvino_libs_to_path
from openvino.utils import _add_openvino_libs_to_search_path
add_openvino_libs_to_path()
_add_openvino_libs_to_search_path()
try:
from openvino.frontend.onnx.py_onnx_frontend import ConversionExtensionONNX as ConversionExtension
@@ -8,9 +8,9 @@ Low level wrappers for the FrontEnd C++ API.
# flake8: noqa
from openvino.utils import add_openvino_libs_to_path
from openvino.utils import _add_openvino_libs_to_search_path
add_openvino_libs_to_path()
_add_openvino_libs_to_search_path()
try:
@@ -8,9 +8,9 @@ Low level wrappers for the FrontEnd C++ API.
# flake8: noqa
from openvino.utils import add_openvino_libs_to_path
from openvino.utils import _add_openvino_libs_to_search_path
add_openvino_libs_to_path()
_add_openvino_libs_to_search_path()
try:
@@ -8,9 +8,9 @@ Low level wrappers for the FrontEnd C++ API.
# flake8: noqa
from openvino.utils import add_openvino_libs_to_path
from openvino.utils import _add_openvino_libs_to_search_path
add_openvino_libs_to_path()
_add_openvino_libs_to_search_path()
try:
from openvino.frontend.tensorflow.py_tensorflow_frontend import ConversionExtensionTensorflow as ConversionExtension
@@ -13,9 +13,9 @@ warnings.warn(
category=FutureWarning,
)
from openvino.utils import add_openvino_libs_to_path, deprecated
from openvino.utils import _add_openvino_libs_to_search_path, deprecated
add_openvino_libs_to_path()
_add_openvino_libs_to_search_path()
from openvino._pyopenvino import get_version
from openvino._pyopenvino import serialize as _base_serialize
@@ -8,9 +8,9 @@ Low level wrappers for the PrePostProcessing C++ API.
# flake8: noqa
from openvino.utils import add_openvino_libs_to_path
from openvino.utils import _add_openvino_libs_to_search_path
add_openvino_libs_to_path()
_add_openvino_libs_to_search_path()
from openvino._pyopenvino import get_version
@@ -5,9 +5,9 @@
"""openvino module namespace, exposing factory functions for all ops and other classes."""
# noqa: F401
from openvino.utils import add_openvino_libs_to_path
from openvino.utils import _add_openvino_libs_to_search_path
add_openvino_libs_to_path()
_add_openvino_libs_to_search_path()
from openvino._pyopenvino import get_version
+9 -2
View File
@@ -6,10 +6,11 @@ import os
import sys
from functools import wraps
from typing import Callable, Any
import warnings
def add_openvino_libs_to_path() -> None:
"""Adds OpenVINO libraries to the PATH environment variable on Windows."""
def _add_openvino_libs_to_search_path() -> None:
"""Add OpenVINO libraries to the DLL search path on Windows."""
if sys.platform == "win32":
# Installer, yum, pip installs openvino dlls to the different directories
# and those paths need to be visible to the openvino modules
@@ -38,6 +39,12 @@ def add_openvino_libs_to_path() -> None:
os.environ["PATH"] = os.path.abspath(lib_path) + ";" + os.environ["PATH"]
def add_openvino_libs_to_path() -> None:
warnings.warn("add_openvino_libs_to_path function was implemented for internal usage only "
"and will be removed in the 2023.2 release.", DeprecationWarning, stacklevel=2)
_add_openvino_libs_to_search_path()
def deprecated(name: Any = None, version: str = "", message: str = "", stacklevel: int = 2) -> Callable[..., Any]:
"""Prints deprecation warning "{function_name} is deprecated and will be removed in version {version}. {message}" and runs the function.
@@ -549,7 +549,7 @@ def test_serialize_rt_info(request, tmp_path):
# request - https://docs.pytest.org/en/7.1.x/reference/reference.html#request
def test_serialize_complex_rt_info(request, tmp_path):
def check_rt_info(model, serialized):
def check_rt_info(model):
assert model.has_rt_info(["config", "type_of_model"]) is True
assert model.has_rt_info(["config", "converter_type"]) is True
assert model.has_rt_info(["config", "model_parameters", "threshold"]) is True
@@ -610,13 +610,13 @@ def test_serialize_complex_rt_info(request, tmp_path):
model.set_rt_info(["sasd", "fdfdfsdf"], ["config", "model_parameters", "labels", "label_groups", "ids"])
model.set_rt_info([22.3, 33.11, 44.0], ["config", "model_parameters", "mean_values"])
check_rt_info(model, False)
check_rt_info(model)
serialize(model, xml_path, bin_path)
res_model = core.read_model(model=xml_path, weights=bin_path)
check_rt_info(res_model, True)
check_rt_info(res_model)
os.remove(xml_path)
os.remove(bin_path)