Compare commits

..

3 commits

Author SHA1 Message Date
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')):
if filename.endswith('.txt'):
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():
continue

View file

@ -14,7 +14,7 @@ except ImportError:
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)
## MONGODB Setup

View file

@ -5,7 +5,9 @@ from rich import print
def remove_duplicate_keys(file):
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:
f.writelines(unique_lines)