MCPcopy
hub / github.com/sqlalchemy/sqlalchemy / sizeof

Function sizeof

lib/sqlalchemy/testing/util.py:485–495  ·  lib/sqlalchemy/testing/util.py::sizeof
(o)

Source from the content-addressed store, hash-verified

483 default_size = getsizeof(0) class="cm"># estimate sizeof object without __sizeof__
484
485 def sizeof(o):
486 if id(o) in seen: class="cm"># do not double count the same object
487 return 0
488 seen.add(id(o))
489 s = getsizeof(o, default_size)
490
491 for typ, handler in all_handlers.items():
492 if isinstance(o, typ):
493 s += sum(map(sizeof, handler(o)))
494 break
495 return s
496
497 return sizeof(o)
498

Callers 1

total_sizeFunction · 0.85

Calls 3

sumClass · 0.85
addMethod · 0.45
itemsMethod · 0.45

Tested by

no test coverage detected