File tree Expand file tree Collapse file tree 7 files changed +14
-10
lines changed Expand file tree Collapse file tree 7 files changed +14
-10
lines changed Original file line number Diff line number Diff line change @@ -6,9 +6,11 @@ class PathConfig(BaseModel):
66 processName : str = "QuickNote"
77 tagPath : str = "./tags"
88
9+
910class ProxyConfig (BaseModel ):
1011 url : str = ""
1112
13+
1214class Config (BaseModel ):
1315 path : PathConfig = PathConfig ()
14- proxy : ProxyConfig = ProxyConfig ()
16+ proxy : ProxyConfig = ProxyConfig ()
Original file line number Diff line number Diff line change 99@lru_cache ()
1010def get_config () -> Config :
1111 with open (Path (__file__ ).parent .parent / "./data/config.yml" , "r" ) as f :
12- return Config (** yaml .safe_load (f ) or {})
12+ return Config (** yaml .safe_load (f ) or {})
Original file line number Diff line number Diff line change 11path :
2- workPath : ../
3- processName : QuickNote.exe
4- tagPath : ./data/tags
2+ workPath : ../
3+ processName : QuickNote.exe
4+ tagPath : ./data/tags
55
66proxy :
7- url : env
7+ url : env
Original file line number Diff line number Diff line change @@ -16,8 +16,9 @@ def get_goos_goarch():
1616
1717 return platform .system ().lower (), goarch
1818
19+
1920def get_package_name_from_current_machine ():
2021 goos , goarch = get_goos_goarch ()
2122
2223 ext = ".zip" if goos == "windows" else ".tar.gz"
23- return f"QuickNote_{ goos } _{ goarch } { ext } "
24+ return f"QuickNote_{ goos } _{ goarch } { ext } "
Original file line number Diff line number Diff line change @@ -17,6 +17,7 @@ def find_processes_by_path(target_path):
1717 continue
1818 return matches
1919
20+
2021def try_terminate (proc ):
2122 print (f"Trying to gracefully terminate PID { proc .pid } ({ proc .name ()} )..." )
2223 try :
@@ -28,4 +29,4 @@ def try_terminate(proc):
2829 print (f"Process { proc .pid } exited gracefully." )
2930 except (psutil .TimeoutExpired , psutil .NoSuchProcess ):
3031 print (f"Process { proc .pid } did not exit. Killing..." )
31- proc .kill ()
32+ proc .kill ()
Original file line number Diff line number Diff line change @@ -6,4 +6,4 @@ def read():
66 with open (get_config ().path .tagPath , "r" ) as f :
77 return f .read ().strip ()
88 except FileNotFoundError :
9- return "v0.0.0"
9+ return "v0.0.0"
Original file line number Diff line number Diff line change 33
44def write (tag : str ):
55 with open (get_config ().path .tagPath , "w" ) as f :
6- f .write (tag )
6+ f .write (tag )
You can’t perform that action at this time.
0 commit comments