-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Making some functions complete async
- Loading branch information
Showing
16 changed files
with
124 additions
and
73 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
#!/usr/bin/env python3 | ||
# -*- coding: UTF-8 -*- | ||
import pytest | ||
import yaml | ||
import ast | ||
import astpretty | ||
import glob | ||
import sys | ||
|
||
from sausage_bot.util import envs | ||
from sausage_bot.docs.autodoc import get_funcs | ||
|
||
''' | ||
Get all python files | ||
Look for I18N.t() | ||
Get first link | ||
Get that locale file | ||
Compare links in python file with locale file | ||
''' | ||
|
||
filelist_py = glob.glob('**/*.py', recursive=True, root_dir=envs.ROOT_DIR) | ||
|
||
#for file in filelist: | ||
|
||
#_file = '{}/{}'.format(envs.ROOT_DIR, filelist[2]) | ||
_file = '/home/geir/coding/git/discord/sausage_bot/sausage_bot/testing/random_test.py' | ||
|
||
i18n_check = {} | ||
|
||
with open(_file) as fd: | ||
file_contents = fd.read() | ||
parsed_file = ast.parse(file_contents) | ||
for node in ast.walk(parsed_file): | ||
if isinstance(node, ast.Call): | ||
try: | ||
if node.func.value.id == 'I18N' and node.func.attr == 't': | ||
i18n_line = str(node.args[0].value) | ||
locale_splits = i18n_line.split('.') | ||
locale_name = locale_splits[0] | ||
locale_files = glob.glob( | ||
'**/{}*.yml'.format(locale_name), | ||
recursive=True, root_dir=envs.LOCALE_DIR | ||
) | ||
for locale_file in locale_files: | ||
locale_file_full = '{}/{}'.format( | ||
envs.LOCALE_DIR, | ||
locale_file | ||
) | ||
with open(locale_file_full, 'r') as file_in: | ||
locale_file_in = yaml.safe_load(file_in) | ||
print(locale_file_in) | ||
except: | ||
pass |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.