Skip to content

Commit a19fc81

Browse files
committed
Eliminated possible_filenames, moved project_root to cli ↞ [auto-sync from https://github.com/adamlui/python-utils/tree/main/translate-messages]
1 parent 36e4a3e commit a19fc81

File tree

1 file changed

+3
-4
lines changed
  • translate-messages/src/translate_messages/lib

1 file changed

+3
-4
lines changed

translate-messages/src/translate_messages/lib/init.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,10 @@ def cli(caller_file):
88

99
# Load from config file
1010
cli.config = sns()
11-
possible_filenames = [f'{cli.name}.config.json', f'{cli.name.replace("messages", "msgs")}.config.json']
12-
project_root = os.path.join(os.path.dirname(caller_file),
11+
cli.project_root = os.path.join(os.path.dirname(caller_file),
1312
f"{ '' if 'src' in os.path.dirname(caller_file) else '../../' }../../")
14-
for filename in possible_filenames:
15-
config_path = os.path.join(project_root, filename)
13+
for filename in [f'{cli.name}.config.json', f'{cli.name.replace("messages", "msgs")}.config.json']:
14+
config_path = os.path.join(cli.project_root, filename)
1615
if os.path.exists(config_path):
1716
cli.config = data.sns.from_dict(data.json.read(config_path)) ; break
1817

0 commit comments

Comments
 (0)