knify 1.8.51__tar.gz → 1.8.53__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.51
3
+ Version: 1.8.53
4
4
  Summary: Development tools for python
5
5
  Home-page: https://github.com/qicongsheng/knify
6
6
  Author: qicongsheng
@@ -16,19 +16,31 @@ class Header:
16
16
  class HeaderBuilder:
17
17
  def __init__(self):
18
18
  self.default_transformer = None
19
- self.data = []
19
+ self.headers = []
20
20
 
21
21
  def set_default_transformer(self, transformer: Callable[[object], object] = None):
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_names(self, names: list[str] = None):
26
+ for index_, name in enumerate(names):
27
+ self.headers.append(Header(len(self.headers), name, self.default_transformer))
28
+ return self
29
+
30
+ def set_transformer(self, name: str, transformer: Callable[[object], object] = None):
31
+ for header in self.headers:
32
+ if name == header.name:
33
+ header.transformer = transformer
34
+ return self
35
+
36
+ def append(self, index: int = None, name: str | None = None, transformer: Callable[[object], object] = None):
37
+ target_tindex = index if index is not None else len(self.headers)
26
38
  target_transformer = transformer if transformer is not None else self.default_transformer
27
- self.data.append(Header(len(self.data), name, target_transformer))
39
+ self.headers.append(Header(target_tindex, name, target_transformer))
28
40
  return self
29
41
 
30
42
  def to_headers(self):
31
- return self.data
43
+ return self.headers
32
44
 
33
45
 
34
46
  def read_excel(file_path: str, sheet: str | int | None = 0, headers: list[Header] | None = None, start_row: int = 1):
@@ -8,7 +8,7 @@ def get_pip_name():
8
8
 
9
9
 
10
10
  def get_version():
11
- return '1.8.51'
11
+ return '1.8.53'
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.51
3
+ Version: 1.8.53
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