byzh-core 0.0.9.3__py3-none-any.whl → 0.0.9.5__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.
- byzh/core/Brecorder/record2d.py +11 -6
- {byzh_core-0.0.9.3.dist-info → byzh_core-0.0.9.5.dist-info}/METADATA +1 -1
- {byzh_core-0.0.9.3.dist-info → byzh_core-0.0.9.5.dist-info}/RECORD +7 -7
- {byzh_core-0.0.9.3.dist-info → byzh_core-0.0.9.5.dist-info}/LICENSE +0 -0
- {byzh_core-0.0.9.3.dist-info → byzh_core-0.0.9.5.dist-info}/WHEEL +0 -0
- {byzh_core-0.0.9.3.dist-info → byzh_core-0.0.9.5.dist-info}/entry_points.txt +0 -0
- {byzh_core-0.0.9.3.dist-info → byzh_core-0.0.9.5.dist-info}/top_level.txt +0 -0
byzh/core/Brecorder/record2d.py
CHANGED
@@ -1,12 +1,13 @@
|
|
1
1
|
import pandas as pd
|
2
2
|
from typing import Literal
|
3
3
|
|
4
|
-
|
5
|
-
from byzh.core import B_os
|
4
|
+
from .. import B_os
|
5
|
+
# from byzh.core import B_os
|
6
6
|
|
7
7
|
class B_Record2d:
|
8
|
-
def __init__(self, csv_path, mode:Literal["w", "a"]="
|
8
|
+
def __init__(self, csv_path, mode:Literal["w", "a", "r"]="r"):
|
9
9
|
self.csv_path = csv_path
|
10
|
+
self.mode = mode
|
10
11
|
|
11
12
|
B_os.makedirs(csv_path)
|
12
13
|
self.data = pd.DataFrame()
|
@@ -15,6 +16,8 @@ class B_Record2d:
|
|
15
16
|
self.__read()
|
16
17
|
elif mode == "a":
|
17
18
|
self.__read()
|
19
|
+
elif mode == "r":
|
20
|
+
self.__read()
|
18
21
|
|
19
22
|
# 支持 recorder[row, col] 访问
|
20
23
|
def __getitem__(self, key):
|
@@ -28,6 +31,8 @@ class B_Record2d:
|
|
28
31
|
|
29
32
|
# 支持 recorder[row, col] = value
|
30
33
|
def __setitem__(self, key, value):
|
34
|
+
assert self.mode!="r", "不允许读模式下赋值"
|
35
|
+
|
31
36
|
if isinstance(key, tuple) and len(key) == 2: # 赋值操作
|
32
37
|
row, col = key
|
33
38
|
row, col, value = str(row), str(col), str(value)
|
@@ -74,10 +79,10 @@ class B_Record2d:
|
|
74
79
|
return float(self[row, col])
|
75
80
|
|
76
81
|
def get_bool(self, row, col) -> bool:
|
77
|
-
result = self
|
78
|
-
if result in ("
|
82
|
+
result = self.get_str(row, col)
|
83
|
+
if result.lower() in ("true", "1"):
|
79
84
|
return True
|
80
|
-
elif result in ("
|
85
|
+
elif result.lower() in ("false", "0"):
|
81
86
|
return False
|
82
87
|
else:
|
83
88
|
raise ValueError(f"无法转换为布尔值 -> {result}")
|
@@ -4,7 +4,7 @@ byzh/core/Barchive/__init__.py,sha256=wUdz646VS0Uhq9lwMkd3YQHCvQhLDqgADoDjFGMqIn
|
|
4
4
|
byzh/core/Barchive/archive.py,sha256=S1hy3qYFEZr5RRmx_Mnq1s2IMUEw973ny1rKSL7J_a0,6721
|
5
5
|
byzh/core/Brecorder/__init__.py,sha256=rYlgYIhr_AcPuGkZRCitbi2_hZYyoERk4XIZ14CU1dk,108
|
6
6
|
byzh/core/Brecorder/record1d.py,sha256=P7y4Gbc0zYcRsZBT4CeYgv35k0tU4h3ED-3H8RQ6cuU,2083
|
7
|
-
byzh/core/Brecorder/record2d.py,sha256=
|
7
|
+
byzh/core/Brecorder/record2d.py,sha256=oG0Oq-ccBOljPSS3xqN-nPHLMmtioKN3BmR4KXbne7o,3587
|
8
8
|
byzh/core/Btable/__init__.py,sha256=NlQBjp_mvObEUm4y6wXbGipkNM2N3uNIUidaJkTwFsw,62
|
9
9
|
byzh/core/Btable/auto_table.py,sha256=avMeRWydw9L8s3fU0-BSl8a2dCyreIUzW--csm5eR0g,14734
|
10
10
|
byzh/core/Bterminal/__init__.py,sha256=azRLD-kY8Tv2c3llHRBrEJIdVgYw6hAoLgzJeA4PvE0,142
|
@@ -18,9 +18,9 @@ byzh/core/Butils/text_style.py,sha256=34u2-Rsur63iNQ0m7tHxpFWqnQZWybSxBx7vnhOhqD
|
|
18
18
|
byzh/core/Butils/timer.py,sha256=OLxbWWRauYjp1KwavACjoyrqrCciUiIG2ae7qgtZrVA,511
|
19
19
|
byzh/core/Bwriter/__init__.py,sha256=QcHzKs0305Pr78ZvZgcC_4miSYZh8jJQDt5TD0GIeEg,82
|
20
20
|
byzh/core/Bwriter/writer.py,sha256=ss9EWo-l7czBUlY7Fu0buvQgO5fRspYKtC2X6eaRa0c,3213
|
21
|
-
byzh_core-0.0.9.
|
22
|
-
byzh_core-0.0.9.
|
23
|
-
byzh_core-0.0.9.
|
24
|
-
byzh_core-0.0.9.
|
25
|
-
byzh_core-0.0.9.
|
26
|
-
byzh_core-0.0.9.
|
21
|
+
byzh_core-0.0.9.5.dist-info/LICENSE,sha256=-nRwf0Xga4AX5bsWBXXflpDpgX_U23X06oAMcdf0dSY,1089
|
22
|
+
byzh_core-0.0.9.5.dist-info/METADATA,sha256=0QBm3cncDxELlvVRkTLT9DRlG-uVRMWPd2SR55GGr98,371
|
23
|
+
byzh_core-0.0.9.5.dist-info/WHEEL,sha256=R0nc6qTxuoLk7ShA2_Y-UWkN8ZdfDBG2B6Eqpz2WXbs,91
|
24
|
+
byzh_core-0.0.9.5.dist-info/entry_points.txt,sha256=qoN3Uvulj0BcOQVDqsFqP2dBVQzG1QrUtC5wFsghSLo,51
|
25
|
+
byzh_core-0.0.9.5.dist-info/top_level.txt,sha256=tmaFVY8uApe6apOETSOgwz-4v5Mj4uxgRT8yNnDNZNA,5
|
26
|
+
byzh_core-0.0.9.5.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|