-
Notifications
You must be signed in to change notification settings - Fork 187
Remove implicit node instantiation in Python #1763
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -74,14 +74,7 @@ void bind_videoencoder(pybind11::module& m, void* pCallstack) { | |
| }, | ||
| VIDEO_ENCODER_BUILD_PYARGS, | ||
| VIDEO_ENCODER_PYARGS) | ||
| .def(py::init([](VIDEO_ENCODER_BUILD_ARGS, VIDEO_ENCODER_ARGS) { | ||
| auto self = getImplicitPipeline()->create<VideoEncoder>(); | ||
| self->build(input); | ||
| VIDEO_ENCODER_CODE(->) | ||
| return self; | ||
| }), | ||
| VIDEO_ENCODER_BUILD_PYARGS, | ||
| VIDEO_ENCODER_PYARGS) | ||
| .def(py::init<>()) | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🧩 Analysis chain🏁 Script executed: #!/bin/bash
# Confirm VideoEncoder has an accessible default constructor.
ast-grep --pattern $'class VideoEncoder $_ {
$$$
VideoEncoder();
$$$
}'
rg -nP -C2 '\bVideoEncoder\s*\(\s*\)\s*(;|\{|=)' include/ src/Repository: luxonis/depthai-core Length of output: 46 🏁 Script executed: # Find VideoEncoder class definition
fd -type f -name "*.hpp" -o -name "*.h" | xargs rg -l "class VideoEncoder"
# Locate and read VideoEncoderBindings.cpp context
fd -type f -name "VideoEncoderBindings.cpp"Repository: luxonis/depthai-core Length of output: 469 🏁 Script executed: # Search more broadly for VideoEncoder in header files
rg "class VideoEncoder" -A 10 --max-count=3Repository: luxonis/depthai-core Length of output: 1056 🏁 Script executed: # Check the binding file to understand full context
wc -l bindings/python/src/pipeline/node/VideoEncoderBindings.cppRepository: luxonis/depthai-core Length of output: 126 🏁 Script executed: # Read the full VideoEncoderBindings.cpp file to see context
cat -n bindings/python/src/pipeline/node/VideoEncoderBindings.cppRepository: luxonis/depthai-core Length of output: 8973 🏁 Script executed: # Read the VideoEncoder class definition to understand constructors
cat -n include/depthai/pipeline/node/VideoEncoder.hppRepository: luxonis/depthai-core Length of output: 5058 🏁 Script executed: # Check the base class DeviceNodeCRTP to understand inherited constructors
rg "class DeviceNodeCRTP" -A 30 include/Repository: luxonis/depthai-core Length of output: 2542 🏁 Script executed: # Check the actual constructor definitions in DeviceNodeCRTP
rg "DeviceNodeCRTP\s*\(" include/depthai/pipeline/DeviceNode.hpp -A 3 -B 3Repository: luxonis/depthai-core Length of output: 1237 🏁 Script executed: # Also check what ADD_NODE macro does
rg "define ADD_NODE" bindings/python/src/ -A 5Repository: luxonis/depthai-core Length of output: 1091 🏁 Script executed: # Check if there's a default constructor template in DeviceNodeCRTP
cat -n include/depthai/pipeline/DeviceNode.hpp | head -80Repository: luxonis/depthai-core Length of output: 2800 🏁 Script executed: # Find the addNode template implementation
rg "template.*addNode" bindings/python/src/ -A 20Repository: luxonis/depthai-core Length of output: 46 🏁 Script executed: # Look at NodeBindings.hpp to see how ADD_NODE works
cat -n bindings/python/src/pipeline/node/NodeBindings.hpp | head -100Repository: luxonis/depthai-core Length of output: 1125 🏁 Script executed: # Look for the addNode function implementation
find bindings/python/src -name "*.hpp" -o -name "*.cpp" | xargs rg -l "addNode"Repository: luxonis/depthai-core Length of output: 108 🏁 Script executed: # Check the Common.hpp file which defines ADD_NODE
cat -n bindings/python/src/pipeline/node/Common.hpp | head -150Repository: luxonis/depthai-core Length of output: 3066 Line 77 will fail to compile:
Either provide a public default constructor in 🤖 Prompt for AI Agents |
||
| .def_readonly("input", &VideoEncoder::input, DOC(dai, node, VideoEncoder, input), DOC(dai, node, VideoEncoder, input)) | ||
| .def_readonly("bitstream", &VideoEncoder::bitstream, DOC(dai, node, VideoEncoder, bitstream), DOC(dai, node, VideoEncoder, bitstream)) | ||
| .def_readonly("out", &VideoEncoder::out, DOC(dai, node, VideoEncoder, out), DOC(dai, node, VideoEncoder, out)) | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🧹 Nitpick | 🔵 Trivial
Nit: style consistency — prefer
py::init<>().Other bindings in this PR (
VideoEncoderBindings.cpp,StereoDepthBindings.cpp) usepy::init<>()with empty angle brackets. Usingpy::init()here is functionally equivalent in pybind11 but inconsistent with the rest of the PR.🎨 Proposed nit
📝 Committable suggestion
🤖 Prompt for AI Agents