Skip to content

Commit a554f7b

Browse files
committed
Condensed cli.project_root init
1 parent 76b9642 commit a554f7b

2 files changed

Lines changed: 2 additions & 8 deletions

File tree

remove-json-keys/src/remove_json_keys/lib/settings.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,10 +35,7 @@ def load(cli, caller_file):
3535
# Load from config file
3636
cli.config = sn()
3737
caller_path = Path(caller_file)
38-
if 'src' in str(caller_path):
39-
cli.project_root = str(caller_path.parent.parent.parent)
40-
else:
41-
cli.project_root = str(caller_path.parent.parent)
38+
cli.project_root = str(caller_path.parent.parent.parent if 'src' in str(caller_path) else caller_path.parent.parent)
4239
possible_config_filenames = [
4340
f'{prefix}{name}.config.json{suffix}'
4441
for prefix in ['.', ''] for name in [cli.short_name, cli.name] for suffix in ['5', '', 'c']

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

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -47,10 +47,7 @@ def load(cli, caller_file):
4747
# Load from config file
4848
cli.config = sn()
4949
caller_path = Path(caller_file)
50-
if 'src' in str(caller_path):
51-
cli.project_root = str(caller_path.parent.parent.parent)
52-
else:
53-
cli.project_root = str(caller_path.parent.parent)
50+
cli.project_root = str(caller_path.parent.parent.parent if 'src' in str(caller_path) else caller_path.parent.parent)
5451
possible_config_filenames = [
5552
f'{prefix}{name}.config.json{suffix}'
5653
for prefix in ['.', ''] for name in [cli.short_name, cli.name] for suffix in ['5', '', 'c']

0 commit comments

Comments
 (0)