siibra.retrieval.cache
Maintaining and handling caching files on disk.
Attributes
Classes
int([x]) -> integer |
|
Typed version of namedtuple. |
Functions
|
Module Contents
- class siibra.retrieval.cache.Cache
- __iter__()
Iterate all element names in the cache directory.
- clear()
- classmethod instance()
Return an instance of the siibra cache. Create folder if needed.
- run_maintenance()
Shrinks the cache by deleting oldest files first until the total size is below cache size (Cache.SIZE) given in GiB.
- SIZE_GIB = 2
- folder = b'.'
- property size
Return size of the cache in GiB.
- class siibra.retrieval.cache.Warmup
- classmethod deregister_warmup_fn(original_fn)
- static fn_eql(wrapped_fn, original_fn)
- classmethod is_registered(fn)
- classmethod register_warmup_fn(warmup_level: WarmupLevel = WarmupLevel.INSTANCE, *, is_factory=False)
- classmethod warmup(warmup_level: WarmupLevel = WarmupLevel.INSTANCE, *, max_workers=4)
- class siibra.retrieval.cache.WarmupLevel
int([x]) -> integer int(x, base=10) -> integer
Convert a number or string to an integer, or return 0 if no arguments are given. If x is a number, return x.__int__(). For floating point numbers, this truncates towards zero.
If x is not a number or if base is given, then x must be a string, bytes, or bytearray instance representing an integer literal in the given base. The literal can be preceded by ‘+’ or ‘-’ and be surrounded by whitespace. The base defaults to 10. Valid bases are 0 and 2-36. Base 0 means to interpret the base from the string as an integer literal. >>> int(‘0b100’, base=0) 4
- DATA = 5
- INSTANCE = 1
- TEST = -1000
- class siibra.retrieval.cache.WarmupParam
Typed version of namedtuple.
Usage in Python versions >= 3.6:
class Employee(NamedTuple): name: str id: int
This is equivalent to:
Employee = collections.namedtuple('Employee', ['name', 'id'])
The resulting class has an extra __annotations__ attribute, giving a dict that maps field names to types. (The field names are also in the _fields attribute, which is part of the namedtuple API.) Alternative equivalent keyword syntax is also accepted:
Employee = NamedTuple('Employee', name=str, id=int)
In Python versions <= 3.5 use:
Employee = NamedTuple('Employee', [('name', str), ('id', int)])
- fn: Callable
- is_factory: bool = False
- level: int | WarmupLevel
- siibra.retrieval.cache.assert_folder(folder)
- siibra.retrieval.cache.CACHE = None
- siibra.retrieval.cache.jobmemory_path