Skip to content

Commit 66843fe

Browse files
committed
Update
1 parent ab44b1a commit 66843fe

File tree

4 files changed

+10
-10
lines changed

4 files changed

+10
-10
lines changed

src/bindings/python/src/pyopenvino/core/core.cpp

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,10 @@
55
#include "pyopenvino/core/core.hpp"
66

77
#include <pybind11/stl.h>
8+
#include <pybind11/stl/filesystem.h>
89
#include <pybind11/typing.h>
910

11+
#include <filesystem>
1012
#include <fstream>
1113
#include <openvino/core/any.hpp>
1214
#include <openvino/runtime/core.hpp>
@@ -675,7 +677,7 @@ void regclass_Core(py::module m) {
675677
)");
676678

677679
cls.def("add_extension",
678-
static_cast<void (ov::Core::*)(const std::string&)>(&ov::Core::add_extension),
680+
static_cast<void (ov::Core::*)(const std::filesystem::path&)>(&ov::Core::add_extension),
679681
py::arg("library_path"),
680682
R"(
681683
Registers an extension to a Core object.
@@ -708,11 +710,7 @@ void regclass_Core(py::module m) {
708710
cls.def(
709711
"add_extension",
710712
[](ov::Core& self, py::object dtype) {
711-
if (py::isinstance(dtype, py::module_::import("pathlib").attr("Path"))) {
712-
self.add_extension(Common::utils::to_fs_path(dtype));
713-
} else {
714-
self.add_extension(PyOpExtension(dtype));
715-
}
713+
self.add_extension(PyOpExtension(dtype));
716714
},
717715
py::arg("custom_op"),
718716
R"(

src/bindings/python/src/pyopenvino/frontend/manager.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ void regclass_frontend_FrontEndManager(py::module m) {
5959
:param library_path: Path (absolute or relative) or name of a frontend library. If name is
6060
provided, depending on platform, it will be wrapped with shared library suffix and prefix
6161
to identify library full name.
62-
:type library_path: Union[str, bytes, pathlib.Path]
62+
:type library_path: Union[str, pathlib.Path]
6363
6464
:return: None
6565
)");

src/bindings/python/tests/test_runtime/test_core.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -448,9 +448,11 @@ def __init__(self) -> None:
448448

449449
def test_add_extension_from_path():
450450
core = Core()
451-
lib_name = "non_existent_extension.dll" if sys.platform == "win32" else "libnon_existent_extension.so"
451+
lib_name = "openvino_template_extension.dll" if sys.platform == "win32" else "libopenvino_template_extension.so"
452+
core.add_extension(Path(lib_name))
453+
452454
with pytest.raises(RuntimeError) as e:
453-
core.add_extension(Path(lib_name))
455+
core.add_extension(Path("non_existing_extension"))
454456
assert "Cannot load library" in str(e.value)
455457

456458

src/frontends/onnx/tests/tests_python/test_frontendmanager.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ def test_pickle():
5959

6060

6161
@mock_needed
62-
def test_register_front_end_with_pathlib_path():
62+
def test_register_front_end_path():
6363
fem2 = FrontEndManager()
6464
fem2.register_front_end(MOCK_PY_FRONTEND_NAME, Path(mock_py_fe_path_l[0]))
6565
fe = fem2.load_by_framework(framework=MOCK_PY_FRONTEND_NAME)

0 commit comments

Comments
 (0)