xlin 0.1.5__tar.gz → 0.1.7__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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: xlin
3
- Version: 0.1.5
3
+ Version: 0.1.7
4
4
  Summary: toolbox for LinXueyuan
5
5
  License: MIT
6
6
  Author: XiChen
@@ -1,6 +1,6 @@
1
1
  [tool.poetry]
2
2
  name = "xlin"
3
- version = "0.1.5"
3
+ version = "0.1.7"
4
4
  description = "toolbox for LinXueyuan"
5
5
  authors = ["XiChen <23211526+LinXueyuanStdio@users.noreply.github.com>"]
6
6
  license = "MIT"
@@ -62,6 +62,10 @@ def is_jsonl(filepath: str):
62
62
  else:
63
63
  return True # 第一行是json,所以是jsonl格式
64
64
 
65
+ def load_text(filename):
66
+ with open(filename, 'r') as f:
67
+ return f.read()
68
+
65
69
 
66
70
  def load_json_or_jsonl(filepath: str):
67
71
  if is_jsonl(filepath):
@@ -23,6 +23,7 @@ def element_mapping(
23
23
  if use_multiprocessing:
24
24
  pool = ThreadPool(thread_pool_size)
25
25
  results = pool.map(mapping_func, iterator)
26
+ pool.close()
26
27
  for ok, row in results:
27
28
  if ok:
28
29
  rows.append(row)
@@ -116,6 +117,7 @@ def multiprocessing_mapping_jsonlist(
116
117
  if len(tmp_list) > 0:
117
118
  results = pool.map(partial_func, tmp_list)
118
119
  output_list.extend([x for x in results])
120
+ pool.close()
119
121
  if need_caching:
120
122
  save_json_list(output_list, output_path)
121
123
  return output_list
@@ -176,6 +178,7 @@ def multiprocessing_mapping(
176
178
  if len(tmp_list) > 0:
177
179
  results = pool.map(partial_func, tmp_list)
178
180
  output_list.extend([x for x in results])
181
+ pool.close()
179
182
  output_df = pd.DataFrame(output_list)
180
183
  if need_caching:
181
184
  output_df.to_excel(output_path, index=False)
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes