From d7b9535e43bc32486cd3c45b0fe7d22b56e70854 Mon Sep 17 00:00:00 2001 From: Sasha Rahlin Date: Thu, 29 Feb 2024 00:51:01 -0600 Subject: [PATCH] remove now-pointless to_g3frameobject function --- core/include/core/pybindings.h | 3 --- core/src/python.cxx | 25 ++++++------------------- 2 files changed, 6 insertions(+), 22 deletions(-) diff --git a/core/include/core/pybindings.h b/core/include/core/pybindings.h index ede2b6b6..e42add8d 100644 --- a/core/include/core/pybindings.h +++ b/core/include/core/pybindings.h @@ -353,9 +353,6 @@ class G3ModuleRegistrator { .def(boost::python::init()) \ .def_pickle(g3frameobject_picklesuite()) -G3FrameObjectPtr -to_g3frameobject(boost::python::object obj); - // Declare a python module with a name and the name of its enclosing package scope. // name should be be a bare token, while pkg should be a string literal, e.g.: // SPT3G_PYTHON_MODULE_2(foo, "spt3g.bar") diff --git a/core/src/python.cxx b/core/src/python.cxx index bc6a3b12..71f63f94 100644 --- a/core/src/python.cxx +++ b/core/src/python.cxx @@ -154,31 +154,22 @@ boost::python::list g3frame_keys(const G3Frame &map) return keys; } -G3FrameObjectPtr to_g3frameobject(bp::object obj) +static void g3frame_python_put(G3Frame &f, std::string name, bp::object obj) { - G3FrameObjectPtr fo; - if (bp::extract(obj).check()) - fo = bp::extract(obj)(); + f.Put(name, bp::extract(obj)()); else if (PyBool_Check(obj.ptr())) - fo = boost::make_shared(bp::extract(obj)()); + f.Put(name, boost::make_shared(bp::extract(obj)())); else if (bp::extract(obj).check()) - fo = boost::make_shared(bp::extract(obj)()); + f.Put(name, boost::make_shared(bp::extract(obj)())); else if (bp::extract(obj).check()) - fo = boost::make_shared(bp::extract(obj)()); + f.Put(name, boost::make_shared(bp::extract(obj)())); else if (bp::extract(obj).check()) - fo = boost::make_shared(bp::extract(obj)()); + f.Put(name, boost::make_shared(bp::extract(obj)())); else { PyErr_SetString(PyExc_TypeError, "Object is not a G3FrameObject derivative or a plain-old-data type"); bp::throw_error_already_set(); } - - return fo; -} - -static void g3frame_python_put(G3Frame &f, std::string name, bp::object obj) -{ - f.Put(name, to_g3frameobject(obj)); } static bp::object g3frame_python_get(G3Frame &f, std::string name) @@ -548,10 +539,6 @@ SPT3G_PYTHON_MODULE(core) register_vector_of("Frame"); register_vector_of("FrameObject"); - bp::def("to_g3frameobject", to_g3frameobject, - "Convert the input argument to a G3FrameObject. Raises a TypeError " - "if the object cannot be converted."); - bp::class_, boost::noncopyable>("G3Module", "Base class for functors that can be " "added to a G3Pipeline.")