MCPcopy Create free account
hub / github.com/sqlalchemy/sqlalchemy / sizeof

Function sizeof

lib/sqlalchemy/testing/util.py:526–536  ·  view source on GitHub ↗
(o)

Source from the content-addressed store, hash-verified

524 default_size = getsizeof(0) # estimate sizeof object without __sizeof__
525
526 def sizeof(o):
527 if id(o) in seen: # do not double count the same object
528 return 0
529 seen.add(id(o))
530 s = getsizeof(o, default_size)
531
532 for typ, handler in all_handlers.items():
533 if isinstance(o, typ):
534 s += sum(map(sizeof, handler(o)))
535 break
536 return s
537
538 return sizeof(o)
539

Callers 1

total_sizeFunction · 0.85

Calls 3

sumClass · 0.85
addMethod · 0.45
itemsMethod · 0.45

Tested by

no test coverage detected