Skip to content

Commit 8ef9e48

Browse files
author
Matevz Morato
committed
Add the deprecation warnings in Python
1 parent b010e8b commit 8ef9e48

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

bindings/python/src/pipeline/PipelineBindings.cpp

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -177,6 +177,19 @@ void PipelineBindings::bind(pybind11::module& m, void* pCallstack) {
177177
// so we create in the same manner as device nodes.
178178
auto isFromBindings = class_.attr("__module__").cast<std::string>() == "depthai.node";
179179
// Create a copy from kwargs and add autoAddToPipeline to false
180+
181+
// Check if the node is a ColorCamera or a MonoCamera node and issue a deprecation warning
182+
py::object colorCameraClass = py::module::import("depthai").attr("node").attr("ColorCamera");
183+
py::object monoCameraClass = py::module::import("depthai").attr("node").attr("MonoCamera");
184+
if(class_.is(colorCameraClass)){
185+
PyErr_WarnEx(PyExc_DeprecationWarning,
186+
"ColorCamera node is deprecated. Use Camera node instead.", 1);
187+
}
188+
189+
if(class_.is(monoCameraClass)){
190+
PyErr_WarnEx(PyExc_DeprecationWarning,
191+
"MonoCamera node is deprecated. Use Camera node instead.", 1);
192+
}
180193
if(isSubclass && !isFromBindings) {
181194
setImplicitPipeline(&p);
182195
std::shared_ptr<Node> hostNode = py::cast<std::shared_ptr<node::ThreadedHostNode>>(class_(*args, **kwargs));

0 commit comments

Comments
 (0)