tabpy.models.deploy_models.main()   A
last analyzed

Complexity

Conditions 5

Size

Total Lines 14
Code Lines 9

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 9
dl 0
loc 14
rs 9.3333
c 0
b 0
f 0
cc 5
nop 0
1
import os
2
from pathlib import Path
3
import platform
4
import subprocess
5
import sys
6
from tabpy.models.utils import setup_utils
7
8
9
def main():
10
    # Determine if we run python or python3
11
    py = "python" if platform.system() == "Windows" else "python3"
12
13
    file_path = sys.argv[1] if len(sys.argv) > 1 else setup_utils.get_default_config_file_path()
14
    print(f"Using config file at {file_path}")
15
16
    port, auth_on, prefix = setup_utils.parse_config(file_path)
17
    auth_args = setup_utils.get_creds() if auth_on else []
18
19
    directory = str(Path(__file__).resolve().parent / "scripts")
20
    # Deploy each model in the scripts directory
21
    for filename in os.listdir(directory):
22
        subprocess.run([py, f"{directory}/{filename}", file_path] + auth_args)
23
24
25
if __name__ == "__main__":
26
    main()
27