Buckets:
AnonymousSpottedToad/candidate_bucket / codebase /python /trisongz_lazyops /src /lazyops /libs /proxyobj /extra.py
| from __future__ import annotations | |
| """ | |
| Extra Helper Types | |
| """ | |
| import threading | |
| class Singleton(object): | |
| """ | |
| This is a singleton that is not locked to a single thread | |
| """ | |
| __instance = None | |
| def __new__(cls): | |
| """ | |
| If the instance is not created, then create it | |
| """ | |
| if cls.__instance is None: | |
| cls.__instance = super(Singleton, cls).__new__(cls) | |
| return cls.__instance | |
| class LockedSingleton(object): | |
| """ | |
| This is a singleton that is locked to a single thread | |
| """ | |
| __instance = None | |
| __instance_lock = threading.RLock() | |
| def __new__(cls): | |
| """ | |
| If the instance is not created, then create it | |
| """ | |
| if cls.__instance is None: | |
| with cls.__instance_lock: | |
| cls.__instance = super(LockedSingleton, cls).__new__(cls) | |
| return cls.__instance | |
Xet Storage Details
- Size:
- 894 Bytes
- Xet hash:
- 0fd5a186194506a3ba46c5de6dde10df95b6bb52c80fcbc4472c4d24e4c18dc3
·
Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.