MCPcopy Create free account
hub / github.com/DeepRec-AI/DeepRec / IsAttrsHelper

Function IsAttrsHelper

tensorflow/python/util/util.cc:236–248  ·  view source on GitHub ↗

Returns 1 if `o` is an instance of attrs-decorated class. Returns 0 otherwise.

Source from the content-addressed store, hash-verified

234// Returns 1 if `o` is an instance of attrs-decorated class.
235// Returns 0 otherwise.
236int IsAttrsHelper(PyObject* o) {
237 static auto* const check_cache = new CachedTypeCheck([](PyObject* to_check) {
238 Safe_PyObjectPtr cls(PyObject_GetAttrString(to_check, "__class__"));
239 if (cls) {
240 return PyObject_HasAttrString(cls.get(), "__attrs_attrs__");
241 }
242
243 // PyObject_GetAttrString returns null on error
244 PyErr_Clear();
245 return 0;
246 });
247 return check_cache->CachedLookup(o);
248}
249
250// Returns 1 if `o` is an object of type IndexedSlices.
251// Returns 0 otherwise.

Callers 4

IsSequenceHelperFunction · 0.85
GetValueIteratorFunction · 0.85
GetValueIteratorForDataFunction · 0.85
IsAttrsFunction · 0.85

Calls 2

CachedLookupMethod · 0.80
getMethod · 0.45

Tested by

no test coverage detected