knify 1.8.52__tar.gz → 1.8.53__tar.gz
Sign up to get free protection for your applications and to get access to all the features.
- {knify-1.8.52 → knify-1.8.53}/PKG-INFO +1 -1
- {knify-1.8.52 → knify-1.8.53}/knify/excelutil.py +12 -6
- {knify-1.8.52 → knify-1.8.53}/knify/help.py +1 -1
- {knify-1.8.52 → knify-1.8.53}/knify.egg-info/PKG-INFO +1 -1
- {knify-1.8.52 → knify-1.8.53}/LICENSE +0 -0
- {knify-1.8.52 → knify-1.8.53}/README.md +0 -0
- {knify-1.8.52 → knify-1.8.53}/knify/__init__.py +0 -0
- {knify-1.8.52 → knify-1.8.53}/knify/dateutil.py +0 -0
- {knify-1.8.52 → knify-1.8.53}/knify/fileutil.py +0 -0
- {knify-1.8.52 → knify-1.8.53}/knify/listutil.py +0 -0
- {knify-1.8.52 → knify-1.8.53}/knify/logger.py +0 -0
- {knify-1.8.52 → knify-1.8.53}/knify/objutil.py +0 -0
- {knify-1.8.52 → knify-1.8.53}/knify/threadutil.py +0 -0
- {knify-1.8.52 → knify-1.8.53}/knify/warnutil.py +0 -0
- {knify-1.8.52 → knify-1.8.53}/knify.egg-info/SOURCES.txt +0 -0
- {knify-1.8.52 → knify-1.8.53}/knify.egg-info/dependency_links.txt +0 -0
- {knify-1.8.52 → knify-1.8.53}/knify.egg-info/requires.txt +0 -0
- {knify-1.8.52 → knify-1.8.53}/knify.egg-info/top_level.txt +0 -0
- {knify-1.8.52 → knify-1.8.53}/setup.cfg +0 -0
- {knify-1.8.52 → knify-1.8.53}/setup.py +0 -0
@@ -16,25 +16,31 @@ class Header:
|
|
16
16
|
class HeaderBuilder:
|
17
17
|
def __init__(self):
|
18
18
|
self.default_transformer = None
|
19
|
-
self.
|
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
|
25
|
+
def set_names(self, names: list[str] = None):
|
26
26
|
for index_, name in enumerate(names):
|
27
|
-
self.
|
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
|
28
34
|
return self
|
29
35
|
|
30
36
|
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.
|
37
|
+
target_tindex = index if index is not None else len(self.headers)
|
32
38
|
target_transformer = transformer if transformer is not None else self.default_transformer
|
33
|
-
self.
|
39
|
+
self.headers.append(Header(target_tindex, name, target_transformer))
|
34
40
|
return self
|
35
41
|
|
36
42
|
def to_headers(self):
|
37
|
-
return self.
|
43
|
+
return self.headers
|
38
44
|
|
39
45
|
|
40
46
|
def read_excel(file_path: str, sheet: str | int | None = 0, headers: list[Header] | None = None, start_row: int = 1):
|
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
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|