wowtoken.app-backend

git clone https://git.emily.sh/wowtoken-app/wowtoken.app-backend.git
Log | Files | Refs | LICENSE

cached_range.py (468B)


      1 class CachedRange:
      2     _PRECOMPUTE_RANGES = ['30d', '90d', '6m', '1y', '2y', 'all']
      3     # I despise magic strings but this is about as good as I can get without enum support
      4     def __init__(self, _range: str):
      5         if _range not in CachedRange._PRECOMPUTE_RANGES:
      6             raise ValueError(f'Invalid range: {_range}')
      7         self._range = _range
      8 
      9     @property
     10     def range(self):
     11         return self._range
     12 
     13     def __str__(self):
     14         return self._range