Introduce V2 of current and historical functions
This commit is contained in:
14
wow_token/db/cached_range.py
Normal file
14
wow_token/db/cached_range.py
Normal file
@@ -0,0 +1,14 @@
|
||||
class CachedRange:
|
||||
_PRECOMPUTE_RANGES = ['30d', '90d', '6m', '1y', '2y', 'all']
|
||||
# I despise magic strings but this is about as good as I can get without enum support
|
||||
def __init__(self, _range: str):
|
||||
if _range not in CachedRange._PRECOMPUTE_RANGES:
|
||||
raise ValueError(f'Invalid range: {_range}')
|
||||
self._range = _range
|
||||
|
||||
@property
|
||||
def range(self):
|
||||
return self._range
|
||||
|
||||
def __str__(self):
|
||||
return self._range
|
||||
Reference in New Issue
Block a user