Selfie
Loading...
Searching...
No Matches
selfie_lib.CacheSelfie Namespace Reference

Classes

class  CacheSelfie
 
class  CacheSelfieBinary
 

Functions

"CacheSelfie[str]" cache_selfie (Callable[..., str] to_cache)
 
"CacheSelfie[T]" cache_selfie (Callable[..., T] to_cache, Roundtrip[T, str] roundtrip)
 
Union["CacheSelfie[str]", "CacheSelfie[T]"] cache_selfie (Union[Callable[..., str], Callable[..., T]] to_cache, Optional[Roundtrip[T, str]] roundtrip=None)
 
"CacheSelfie[T]" cache_selfie_json (Callable[..., T] to_cache)
 
"CacheSelfieBinary[bytes]" cache_selfie_binary (Callable[..., bytes] to_cache)
 
"CacheSelfieBinary[T]" cache_selfie_binary (Callable[..., T] to_cache, Roundtrip[T, bytes] roundtrip)
 
Union["CacheSelfieBinary[bytes]", "CacheSelfieBinary[T]"] cache_selfie_binary (Union[Callable[..., bytes], Callable[..., T]] to_cache, Optional[Roundtrip[T, bytes]] roundtrip=None)
 

Variables

 T = TypeVar("T", covariant=True)
 

Function Documentation

◆ cache_selfie() [1/3]

"CacheSelfie[str]" selfie_lib.CacheSelfie.cache_selfie ( Callable[..., str]  to_cache)

Definition at line 14 of file CacheSelfie.py.

14def cache_selfie(to_cache: Callable[..., str]) -> "CacheSelfie[str]": ...
15
16
17@overload

◆ cache_selfie() [2/3]

"CacheSelfie[T]" selfie_lib.CacheSelfie.cache_selfie ( Callable[..., T to_cache,
Roundtrip[T, str]   roundtrip 
)

Definition at line 18 of file CacheSelfie.py.

20) -> "CacheSelfie[T]": ...
21
22

◆ cache_selfie() [3/3]

Union["CacheSelfie[str]", "CacheSelfie[T]"] selfie_lib.CacheSelfie.cache_selfie ( Union[Callable[..., str], Callable[..., T]]  to_cache,
Optional[Roundtrip[T, str]]   roundtrip = None 
)

Definition at line 23 of file CacheSelfie.py.

26) -> Union["CacheSelfie[str]", "CacheSelfie[T]"]:
27 if roundtrip is None:
28 # the cacheable better be a string!
29 return cache_selfie(to_cache, Roundtrip.identity()) # type: ignore
30 elif isinstance(roundtrip, Roundtrip) and to_cache is not None:
31 deferred_disk_storage = _selfieSystem().disk_thread_local()
32 return CacheSelfie(deferred_disk_storage, roundtrip, to_cache) # type: ignore
33 else:
34 raise TypeError("Invalid arguments provided to cache_selfie")
35
36

◆ cache_selfie_binary() [1/3]

"CacheSelfieBinary[bytes]" selfie_lib.CacheSelfie.cache_selfie_binary ( Callable[..., bytes]  to_cache)

Definition at line 42 of file CacheSelfie.py.

44) -> "CacheSelfieBinary[bytes]": ...
45
46
47@overload

◆ cache_selfie_binary() [2/3]

"CacheSelfieBinary[T]" selfie_lib.CacheSelfie.cache_selfie_binary ( Callable[..., T to_cache,
Roundtrip[T, bytes]   roundtrip 
)

Definition at line 48 of file CacheSelfie.py.

50) -> "CacheSelfieBinary[T]": ...
51
52

◆ cache_selfie_binary() [3/3]

Union["CacheSelfieBinary[bytes]", "CacheSelfieBinary[T]"] selfie_lib.CacheSelfie.cache_selfie_binary ( Union[Callable[..., bytes], Callable[..., T]]  to_cache,
Optional[Roundtrip[T, bytes]]   roundtrip = None 
)

Definition at line 53 of file CacheSelfie.py.

56) -> Union["CacheSelfieBinary[bytes]", "CacheSelfieBinary[T]"]:
57 if roundtrip is None:
58 # the cacheable better be a bytes!
59 return cache_selfie_binary(to_cache, Roundtrip.identity()) # type: ignore
60 elif isinstance(roundtrip, Roundtrip) and to_cache is not None:
61 deferred_disk_storage = _selfieSystem().disk_thread_local()
62 return CacheSelfieBinary(deferred_disk_storage, roundtrip, to_cache) # type: ignore
63 else:
64 raise TypeError("Invalid arguments provided to cache_selfie")
65
66

◆ cache_selfie_json()

"CacheSelfie[T]" selfie_lib.CacheSelfie.cache_selfie_json ( Callable[..., T to_cache)

Definition at line 37 of file CacheSelfie.py.

37def cache_selfie_json(to_cache: Callable[..., T]) -> "CacheSelfie[T]":
38 return cache_selfie(to_cache, Roundtrip.json())
39
40
41@overload

Variable Documentation

◆ T

selfie_lib.CacheSelfie.T = TypeVar("T", covariant=True)

Definition at line 10 of file CacheSelfie.py.