halib 0.2.9__py3-none-any.whl → 0.2.10__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- halib/system/_list_pc.csv +6 -0
- halib/system/path.py +31 -19
- {halib-0.2.9.dist-info → halib-0.2.10.dist-info}/METADATA +2 -2
- {halib-0.2.9.dist-info → halib-0.2.10.dist-info}/RECORD +7 -6
- {halib-0.2.9.dist-info → halib-0.2.10.dist-info}/WHEEL +0 -0
- {halib-0.2.9.dist-info → halib-0.2.10.dist-info}/licenses/LICENSE.txt +0 -0
- {halib-0.2.9.dist-info → halib-0.2.10.dist-info}/top_level.txt +0 -0
halib/system/path.py
CHANGED
|
@@ -3,28 +3,39 @@ from ..filetype import csvfile
|
|
|
3
3
|
import pandas as pd
|
|
4
4
|
import platform
|
|
5
5
|
import re # <--- [FIX 1] Added missing import
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
6
|
+
import csv
|
|
7
|
+
from importlib import resources
|
|
8
|
+
|
|
9
|
+
PC_TO_ABBR = {}
|
|
10
|
+
ABBR_DISK_MAP = {}
|
|
11
|
+
pc_df = None
|
|
12
|
+
cPlatform = platform.system().lower()
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
def load_pc_meta_info():
|
|
16
|
+
# 1. Define the package where the file lives (dotted notation)
|
|
17
|
+
# Since the file is in 'halib/system/', the package is 'halib.system'
|
|
18
|
+
package_name = "halib.system"
|
|
19
|
+
file_name = "_list_pc.csv"
|
|
20
|
+
|
|
21
|
+
# 2. Locate the file
|
|
22
|
+
csv_path = resources.files(package_name).joinpath(file_name)
|
|
23
|
+
global PC_TO_ABBR, ABBR_DISK_MAP, pc_df
|
|
24
|
+
pc_df = pd.read_csv(csv_path, sep=';', encoding='utf-8')
|
|
25
|
+
PC_TO_ABBR = dict(zip(pc_df['pc_name'], pc_df['abbr']))
|
|
26
|
+
ABBR_DISK_MAP = dict(zip(pc_df['abbr'], pc_df['working_disk']))
|
|
27
|
+
pprint("Loaded PC meta info:")
|
|
28
|
+
pprint(ABBR_DISK_MAP)
|
|
29
|
+
pprint(PC_TO_ABBR)
|
|
30
|
+
# ! must be called at the module load time
|
|
31
|
+
load_pc_meta_info()
|
|
21
32
|
|
|
22
33
|
|
|
23
34
|
def list_PCs(show=True):
|
|
24
|
-
|
|
35
|
+
global pc_df
|
|
25
36
|
if show:
|
|
26
|
-
csvfile.fn_display_df(
|
|
27
|
-
return
|
|
37
|
+
csvfile.fn_display_df(pc_df)
|
|
38
|
+
return pc_df
|
|
28
39
|
|
|
29
40
|
|
|
30
41
|
def get_PC_name():
|
|
@@ -44,11 +55,12 @@ def get_working_disk(abbr_disk_map=ABBR_DISK_MAP):
|
|
|
44
55
|
pc_abbr = get_PC_abbr_name()
|
|
45
56
|
return abbr_disk_map.get(pc_abbr, None)
|
|
46
57
|
|
|
58
|
+
cDisk = get_working_disk()
|
|
47
59
|
|
|
48
60
|
# ! This funcction search for full paths in the obj and normalize them according to the current platform and working disk
|
|
49
61
|
# ! E.g: "E:/zdataset/DFire", but working_disk: "D:", current_platform: "windows" => "D:/zdataset/DFire"
|
|
50
62
|
# ! E.g: "E:/zdataset/DFire", but working_disk: "D:", current_platform: "linux" => "/mnt/d/zdataset/DFire"
|
|
51
|
-
def normalize_paths(obj, working_disk=
|
|
63
|
+
def normalize_paths(obj, working_disk=cDisk, current_platform=cPlatform):
|
|
52
64
|
# [FIX 3] Resolve defaults inside function to be safer/cleaner
|
|
53
65
|
if working_disk is None:
|
|
54
66
|
working_disk = get_working_disk()
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: halib
|
|
3
|
-
Version: 0.2.
|
|
3
|
+
Version: 0.2.10
|
|
4
4
|
Summary: Small library for common tasks
|
|
5
5
|
Author: Hoang Van Ha
|
|
6
6
|
Author-email: hoangvanhauit@gmail.com
|
|
@@ -53,7 +53,7 @@ Dynamic: summary
|
|
|
53
53
|
|
|
54
54
|
# Helper package for coding and automation
|
|
55
55
|
|
|
56
|
-
**Version 0.2.
|
|
56
|
+
**Version 0.2.10**
|
|
57
57
|
+ reorganize packages with most changes in `research` package; also rename `research` to `exp` (package for experiment management and utilities)
|
|
58
58
|
+ update `exp/perfcalc.py` to allow save computed performance to csv file (without explicit calling method `calc_perfs`)
|
|
59
59
|
|
|
@@ -89,9 +89,10 @@ halib/sys/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
|
89
89
|
halib/sys/cmd.py,sha256=b2x7JPcNnFjLGheIESVYvqAb-w2UwBM1PAwYxMZ5YjA,228
|
|
90
90
|
halib/sys/filesys.py,sha256=ERpnELLDKJoTIIKf-AajgkY62nID4qmqmX5TkE95APU,2931
|
|
91
91
|
halib/system/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
92
|
+
halib/system/_list_pc.csv,sha256=IIQnC32RZ-j5uRS_C1HD0nvTlpxv-ItphZNmEns65iU,172
|
|
92
93
|
halib/system/cmd.py,sha256=b2x7JPcNnFjLGheIESVYvqAb-w2UwBM1PAwYxMZ5YjA,228
|
|
93
94
|
halib/system/filesys.py,sha256=102J2fkQhmH1_-HQVy2FQ4NOU8LTjMWV3hToT_APtq8,4401
|
|
94
|
-
halib/system/path.py,sha256=
|
|
95
|
+
halib/system/path.py,sha256=CvWMiGKtrqSq816W6rkiy6QRq3FGb4GWlnNkPZjIvnc,3688
|
|
95
96
|
halib/utils/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
96
97
|
halib/utils/dataclass_util.py,sha256=rj2IMLlUzbm2OlF5_B2dRTk9njZOaF7tTjYkOsq8uLY,1416
|
|
97
98
|
halib/utils/dict.py,sha256=wYE6Iw-_CnCWdMg9tpJ2Y2-e2ESkW9FxmdBkZkbUh80,299
|
|
@@ -101,8 +102,8 @@ halib/utils/list.py,sha256=BM-8sRhYyqF7bh4p7TQtV7P_gnFruUCA6DTUOombaZg,337
|
|
|
101
102
|
halib/utils/listop.py,sha256=Vpa8_2fI0wySpB2-8sfTBkyi_A4FhoFVVvFiuvW8N64,339
|
|
102
103
|
halib/utils/tele_noti.py,sha256=-4WXZelCA4W9BroapkRyIdUu9cUVrcJJhegnMs_WpGU,5928
|
|
103
104
|
halib/utils/video.py,sha256=zLoj5EHk4SmP9OnoHjO8mLbzPdtq6gQPzTQisOEDdO8,3261
|
|
104
|
-
halib-0.2.
|
|
105
|
-
halib-0.2.
|
|
106
|
-
halib-0.2.
|
|
107
|
-
halib-0.2.
|
|
108
|
-
halib-0.2.
|
|
105
|
+
halib-0.2.10.dist-info/licenses/LICENSE.txt,sha256=qZssdna4aETiR8znYsShUjidu-U4jUT9Q-EWNlZ9yBQ,1100
|
|
106
|
+
halib-0.2.10.dist-info/METADATA,sha256=EEhbKj7cVxfoVEyOWZRkJZTSFg4esZFIVqwa0-Idnh0,6838
|
|
107
|
+
halib-0.2.10.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
108
|
+
halib-0.2.10.dist-info/top_level.txt,sha256=7AD6PLaQTreE0Fn44mdZsoHBe_Zdd7GUmjsWPyQ7I-k,6
|
|
109
|
+
halib-0.2.10.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|