Esempio n. 1
0
 def __init__(self, path, chunkbytes, limitbytes, parallel):
     from uproot.rootio import _memsize
     m = _memsize(chunkbytes)
     if m is not None:
         chunkbytes = int(math.ceil(m))
     m = _memsize(limitbytes)
     if m is not None:
         limitbytes = int(math.ceil(m))
     self.path = path
     self._chunkbytes = chunkbytes
     self._limitbytes = limitbytes
     if limitbytes is None:
         self.cache = {}
     else:
         self.cache = uproot.cache.ThreadSafeArrayCache(limitbytes)
     self._source = None
     self._setup_futures(parallel)
Esempio n. 2
0
 def __init__(self, limitbytes, method="LRU"):
     from uproot.rootio import _memsize
     m = _memsize(limitbytes)
     if m is not None:
         limitbytes = int(math.ceil(m))
     if method == "LRU":
         self._cache = cachetools.LRUCache(limitbytes,
                                           getsizeof=self.getsizeof)
     elif method == "LFU":
         self._cache = cachetools.LFUCache(limitbytes,
                                           getsizeof=self.getsizeof)
     else:
         raise ValueError("unrecognized method: {0}".format(method))