File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1919from lib .core .settings import BIGARRAY_CHUNK_SIZE
2020from lib .core .settings import BIGARRAY_TEMP_PREFIX
2121
22- def _size_of (object ):
22+ DEFAULT_SIZE_OF = sys .getsizeof (object ())
23+
24+ def _size_of (object_ ):
2325 """
24- Returns total size of a given object (in bytes)
26+ Returns total size of a given object_ (in bytes)
2527 """
2628
27- retval = sys .getsizeof (object )
28- if isinstance (object , dict ):
29- retval += sum (_size_of (_ ) for _ in itertools .chain .from_iterable (object .items ()))
30- elif hasattr (object , "__iter__" ):
31- retval += sum (_size_of (_ ) for _ in object )
29+ retval = sys .getsizeof (object_ , DEFAULT_SIZE_OF )
30+ if isinstance (object_ , dict ):
31+ retval += sum (_size_of (_ ) for _ in itertools .chain .from_iterable (object_ .items ()))
32+ elif hasattr (object_ , "__iter__" ):
33+ retval += sum (_size_of (_ ) for _ in object_ )
3234 return retval
3335
3436class Cache (object ):
You can’t perform that action at this time.
0 commit comments