byzh-core 0.0.9.4__tar.gz → 0.0.9.6__tar.gz

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.
Files changed (31) hide show
  1. {byzh_core-0.0.9.4 → byzh_core-0.0.9.6}/PKG-INFO +1 -1
  2. {byzh_core-0.0.9.4 → byzh_core-0.0.9.6}/byzh/core/Brecorder/record2d.py +12 -5
  3. {byzh_core-0.0.9.4 → byzh_core-0.0.9.6}/byzh_core.egg-info/PKG-INFO +1 -1
  4. {byzh_core-0.0.9.4 → byzh_core-0.0.9.6}/LICENSE +0 -0
  5. {byzh_core-0.0.9.4 → byzh_core-0.0.9.6}/README.md +0 -0
  6. {byzh_core-0.0.9.4 → byzh_core-0.0.9.6}/byzh/core/B_os.py +0 -0
  7. {byzh_core-0.0.9.4 → byzh_core-0.0.9.6}/byzh/core/Barchive/__init__.py +0 -0
  8. {byzh_core-0.0.9.4 → byzh_core-0.0.9.6}/byzh/core/Barchive/archive.py +0 -0
  9. {byzh_core-0.0.9.4 → byzh_core-0.0.9.6}/byzh/core/Brecorder/__init__.py +0 -0
  10. {byzh_core-0.0.9.4 → byzh_core-0.0.9.6}/byzh/core/Brecorder/record1d.py +0 -0
  11. {byzh_core-0.0.9.4 → byzh_core-0.0.9.6}/byzh/core/Btable/__init__.py +0 -0
  12. {byzh_core-0.0.9.4 → byzh_core-0.0.9.6}/byzh/core/Btable/auto_table.py +0 -0
  13. {byzh_core-0.0.9.4 → byzh_core-0.0.9.6}/byzh/core/Bterminal/__init__.py +0 -0
  14. {byzh_core-0.0.9.4 → byzh_core-0.0.9.6}/byzh/core/Bterminal/cmd.py +0 -0
  15. {byzh_core-0.0.9.4 → byzh_core-0.0.9.6}/byzh/core/Bterminal/run_func.py +0 -0
  16. {byzh_core-0.0.9.4 → byzh_core-0.0.9.6}/byzh/core/Btqdm/__init__.py +0 -0
  17. {byzh_core-0.0.9.4 → byzh_core-0.0.9.6}/byzh/core/Btqdm/my_tqdm.py +0 -0
  18. {byzh_core-0.0.9.4 → byzh_core-0.0.9.6}/byzh/core/Butils/__init__.py +0 -0
  19. {byzh_core-0.0.9.4 → byzh_core-0.0.9.6}/byzh/core/Butils/decorator.py +0 -0
  20. {byzh_core-0.0.9.4 → byzh_core-0.0.9.6}/byzh/core/Butils/text_style.py +0 -0
  21. {byzh_core-0.0.9.4 → byzh_core-0.0.9.6}/byzh/core/Butils/timer.py +0 -0
  22. {byzh_core-0.0.9.4 → byzh_core-0.0.9.6}/byzh/core/Bwriter/__init__.py +0 -0
  23. {byzh_core-0.0.9.4 → byzh_core-0.0.9.6}/byzh/core/Bwriter/writer.py +0 -0
  24. {byzh_core-0.0.9.4 → byzh_core-0.0.9.6}/byzh/core/__init__.py +0 -0
  25. {byzh_core-0.0.9.4 → byzh_core-0.0.9.6}/byzh_core.egg-info/SOURCES.txt +0 -0
  26. {byzh_core-0.0.9.4 → byzh_core-0.0.9.6}/byzh_core.egg-info/dependency_links.txt +0 -0
  27. {byzh_core-0.0.9.4 → byzh_core-0.0.9.6}/byzh_core.egg-info/entry_points.txt +0 -0
  28. {byzh_core-0.0.9.4 → byzh_core-0.0.9.6}/byzh_core.egg-info/requires.txt +0 -0
  29. {byzh_core-0.0.9.4 → byzh_core-0.0.9.6}/byzh_core.egg-info/top_level.txt +0 -0
  30. {byzh_core-0.0.9.4 → byzh_core-0.0.9.6}/setup.cfg +0 -0
  31. {byzh_core-0.0.9.4 → byzh_core-0.0.9.6}/setup.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: byzh-core
3
- Version: 0.0.9.4
3
+ Version: 0.0.9.6
4
4
  Summary: byzh-core是byzh系列的核心库,包含了一些常用的工具函数和类。
5
5
  Author: byzh_rc
6
6
  License: MIT
@@ -5,9 +5,10 @@ from .. import B_os
5
5
  # from byzh.core import B_os
6
6
 
7
7
  class B_Record2d:
8
- def __init__(self, csv_path, mode:Literal["w", "a", "r"]="r"):
8
+ def __init__(self, csv_path, mode:Literal["w", "a", "r"]="r", title:str=None):
9
9
  self.csv_path = csv_path
10
10
  self.mode = mode
11
+ self.title = title
11
12
 
12
13
  B_os.makedirs(csv_path)
13
14
  self.data = pd.DataFrame()
@@ -19,6 +20,8 @@ class B_Record2d:
19
20
  elif mode == "r":
20
21
  self.__read()
21
22
 
23
+ if self.data.index.name is None:
24
+ self.data.index.name = title
22
25
  # 支持 recorder[row, col] 访问
23
26
  def __getitem__(self, key):
24
27
  if isinstance(key, tuple) and len(key) == 2: # 读值操作
@@ -42,6 +45,7 @@ class B_Record2d:
42
45
  assert type(value) == pd.Series, "仅支持 Series 赋值"
43
46
  key = str(key)
44
47
  self.data.loc[key, :] = value.copy()
48
+ self.__save()
45
49
 
46
50
  # 复制一行
47
51
  def copy_row(self, new_row, origin_row):
@@ -79,7 +83,7 @@ class B_Record2d:
79
83
  return float(self[row, col])
80
84
 
81
85
  def get_bool(self, row, col) -> bool:
82
- result:str = self[row, col]
86
+ result = self.get_str(row, col)
83
87
  if result.lower() in ("true", "1"):
84
88
  return True
85
89
  elif result.lower() in ("false", "0"):
@@ -105,7 +109,7 @@ class B_Record2d:
105
109
  if __name__ == '__main__':
106
110
  csv_file = "test_data.csv"
107
111
 
108
- recorder = B_Record2d(csv_file, mode="w")
112
+ recorder = B_Record2d(csv_file, mode="w", title='x\y')
109
113
 
110
114
  # 用索引方式赋值
111
115
  recorder["awa", "OvO"] = 10
@@ -113,10 +117,13 @@ if __name__ == '__main__':
113
117
  recorder["qwq", "OvO"] = 30
114
118
  recorder["qwq", "TwT"] = 40
115
119
 
116
- recorder['aaa'] = recorder['qwwq']
120
+ recorder['aaa'] = recorder['qwq']
117
121
 
118
122
  print("当前内容:")
119
123
  print(recorder)
120
124
 
121
125
  # 用索引方式读取
122
- print("awa, OvO =", recorder["awa", "OvO"])
126
+ print("awa, OvO =", recorder["awa", "OvO"])
127
+
128
+ recorder = B_Record2d(csv_file, mode="r")
129
+ print(recorder)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: byzh-core
3
- Version: 0.0.9.4
3
+ Version: 0.0.9.6
4
4
  Summary: byzh-core是byzh系列的核心库,包含了一些常用的工具函数和类。
5
5
  Author: byzh_rc
6
6
  License: MIT
File without changes
File without changes
File without changes
File without changes