MCPcopy Create free account
hub / github.com/ImageEngine/cortex / get

Method get

src/IECorePython/CompoundDataBinding.cpp:301–323  ·  view source on GitHub ↗

binding for get method

Source from the content-addressed store, hash-verified

299
300 /// binding for get method
301 static data_type
302 get( CompoundData &x, PyObject *i, PyObject *v )
303 {
304 key_type key = convertKey( x, i );
305 const CompoundDataMap &xData = x.readable();
306 CompoundDataMap::const_iterator value = xData.find( key );
307 if ( value == xData.end() )
308 {
309 extract<data_type> elem( v );
310 if ( elem.check() )
311 {
312 return elem();
313 }
314 else
315 {
316 PyErr_SetString( PyExc_TypeError, "Invalid parameter" );
317 throw_error_already_set();
318 }
319 return data_type();
320 }
321 // return the value from the map
322 return value->second;
323 }
324
325
326 /// binding for setdefault method

Callers

nothing calls this directly

Calls 4

readableMethod · 0.80
findMethod · 0.45
endMethod · 0.45
checkMethod · 0.45

Tested by

no test coverage detected