Spaces:
Running
Running
File size: 575 Bytes
b00d2c6 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
#Thanks @DeletedFromEarth for helping in this journey
from os import environ
from typing import Dict, Optional
class TokenParser:
def __init__(self, config_file: Optional[str] = None):
self.tokens = {}
self.config_file = config_file
def parse_from_env(self) -> Dict[int, str]:
self.tokens = dict(
(c + 1, t)
for c, (_, t) in enumerate(
filter(
lambda n: n[0].startswith("MULTI_TOKEN"), sorted(environ.items())
)
)
)
return self.tokens
|