Compare commits

..

4 commits

Author SHA1 Message Date
monosans d66370d6b3
Merge 8b11b75c11 into 21331874db 2023-10-06 07:53:29 +00:00
monosans 8b11b75c11
prevent oops in future 2023-10-06 10:53:22 +03:00
monosans f87be092a5
oops 2023-10-06 10:51:41 +03:00
monosans c5ad22c45b
Refactor file operations 2023-10-06 10:37:16 +03:00
3 changed files with 5 additions and 3 deletions

View file

@ -65,7 +65,7 @@ class KeyManager:
for filename in await aiofiles.os.listdir(os.path.join('api', 'secret')): for filename in await aiofiles.os.listdir(os.path.join('api', 'secret')):
if filename.endswith('.txt'): if filename.endswith('.txt'):
async with aiofiles.open(os.path.join('api', 'secret', 'filename')) as f: async with aiofiles.open(os.path.join('api', 'secret', 'filename')) as f:
async for line in f: for line in await f.readlines():
if not line.strip(): if not line.strip():
continue continue

View file

@ -14,7 +14,7 @@ except ImportError:
load_dotenv() load_dotenv()
with open(os.path.join(helpers.root, 'api', 'config', 'config.yml'), encoding='utf8') as f: with open(os.path.join(helpers.root, 'api', 'config', 'config.yml', encoding='utf8')) as f:
credits_config = yaml.safe_load(f) credits_config = yaml.safe_load(f)
## MONGODB Setup ## MONGODB Setup

View file

@ -5,7 +5,9 @@ from rich import print
def remove_duplicate_keys(file): def remove_duplicate_keys(file):
with open(file, 'r', encoding='utf8') as f: with open(file, 'r', encoding='utf8') as f:
unique_lines = set(f) lines = f.readlines()
unique_lines = set(lines)
with open(file, 'w', encoding='utf8') as f: with open(file, 'w', encoding='utf8') as f:
f.writelines(unique_lines) f.writelines(unique_lines)