knify 1.8.50__tar.gz → 1.8.52__tar.gz

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: knify
3
- Version: 1.8.50
3
+ Version: 1.8.52
4
4
  Summary: Development tools for python
5
5
  Home-page: https://github.com/qicongsheng/knify
6
6
  Author: qicongsheng
@@ -22,9 +22,15 @@ class HeaderBuilder:
22
22
  self.default_transformer = transformer
23
23
  return self
24
24
 
25
- def build(self, name: str | None, transformer: Callable[[object], object] = None):
25
+ def set_header_names(self, names: list[str] = None):
26
+ for index_, name in enumerate(names):
27
+ self.data.append(Header(len(self.data), name, self.default_transformer))
28
+ return self
29
+
30
+ def append(self, index: int = None, name: str | None = None, transformer: Callable[[object], object] = None):
31
+ target_tindex = index if index is not None else len(self.data)
26
32
  target_transformer = transformer if transformer is not None else self.default_transformer
27
- self.data.append(Header(len(self.data), name, target_transformer))
33
+ self.data.append(Header(target_tindex, name, target_transformer))
28
34
  return self
29
35
 
30
36
  def to_headers(self):
@@ -55,5 +61,6 @@ def read_excel(file_path: str, sheet: str | int | None = 0, headers: list[Header
55
61
  cell_value = row[header_idx].value
56
62
  cell_value = cell_value if header.transformer is None else header.transformer(row[header_idx].value)
57
63
  result[col_name] = cell_value
64
+ if len(result.keys()) > 0:
58
65
  results.append(result)
59
66
  return results
@@ -8,7 +8,7 @@ def get_pip_name():
8
8
 
9
9
 
10
10
  def get_version():
11
- return '1.8.50'
11
+ return '1.8.52'
12
12
 
13
13
 
14
14
  def print_version():
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: knify
3
- Version: 1.8.50
3
+ Version: 1.8.52
4
4
  Summary: Development tools for python
5
5
  Home-page: https://github.com/qicongsheng/knify
6
6
  Author: qicongsheng
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
File without changes