-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.py
35 lines (26 loc) · 1.09 KB
/
main.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
import argparse
import os
import re
import subprocess
def config(filename: str) -> None:
ROOT_DIR = os.path.abspath(os.curdir)
YML_DIR = f'{ROOT_DIR}/cv/pipeline_config.yml'
# Read the contents of the yml file
with open(YML_DIR, 'r', encoding='utf-8') as file:
contents = file.read()
# Use regular expression to replace only the specific custom Node lines
contents = re.sub(r"custom_nodes\.dabble\..*", f'custom_nodes.dabble.{filename}_stretch', contents)
contents = re.sub(r"custom_nodes\.draw\..*", f'custom_nodes.draw.{filename}_stats', contents)
# Write the modified contents back to the yml file
with open(YML_DIR, 'w', encoding='utf-8') as file:
file.write(contents)
if __name__ == '__main__':
parser = argparse.ArgumentParser(
prog='Stretch925',
description='Take a break. Have a stretch.'
)
parser.add_argument("exercise", choices=['arm', 'neck', 'side'])
args = parser.parse_args()
config({'arm': 'yw', 'neck': 'ms', 'side': 'lat'}[args.exercise])
os.chdir('cv')
subprocess.run(["peekingduck", "run"])