knify 1.8.56__tar.gz → 1.8.58__tar.gz
Sign up to get free protection for your applications and to get access to all the features.
- {knify-1.8.56 → knify-1.8.58}/PKG-INFO +1 -1
- {knify-1.8.56 → knify-1.8.58}/knify/excelutil.py +3 -2
- {knify-1.8.56 → knify-1.8.58}/knify/help.py +1 -1
- {knify-1.8.56 → knify-1.8.58}/knify/listutil.py +10 -1
- {knify-1.8.56 → knify-1.8.58}/knify.egg-info/PKG-INFO +1 -1
- {knify-1.8.56 → knify-1.8.58}/LICENSE +0 -0
- {knify-1.8.56 → knify-1.8.58}/README.md +0 -0
- {knify-1.8.56 → knify-1.8.58}/knify/__init__.py +0 -0
- {knify-1.8.56 → knify-1.8.58}/knify/dateutil.py +0 -0
- {knify-1.8.56 → knify-1.8.58}/knify/fileutil.py +0 -0
- {knify-1.8.56 → knify-1.8.58}/knify/logger.py +0 -0
- {knify-1.8.56 → knify-1.8.58}/knify/objutil.py +0 -0
- {knify-1.8.56 → knify-1.8.58}/knify/threadutil.py +0 -0
- {knify-1.8.56 → knify-1.8.58}/knify/warnutil.py +0 -0
- {knify-1.8.56 → knify-1.8.58}/knify.egg-info/SOURCES.txt +0 -0
- {knify-1.8.56 → knify-1.8.58}/knify.egg-info/dependency_links.txt +0 -0
- {knify-1.8.56 → knify-1.8.58}/knify.egg-info/requires.txt +0 -0
- {knify-1.8.56 → knify-1.8.58}/knify.egg-info/top_level.txt +0 -0
- {knify-1.8.56 → knify-1.8.58}/setup.cfg +0 -0
- {knify-1.8.56 → knify-1.8.58}/setup.py +0 -0
@@ -46,11 +46,12 @@ class HeaderBuilder:
|
|
46
46
|
return self.headers
|
47
47
|
|
48
48
|
|
49
|
-
def read_excel(file_path: str, sheet: str | int | None = 0, headers: list[Header] | None = None, start_row: int = 1
|
49
|
+
def read_excel(file_path: str, sheet: str | int | None = 0, headers: list[Header] | None = None, start_row: int = 1,
|
50
|
+
header_row: int = 0) -> list[object]:
|
50
51
|
results = []
|
51
52
|
workbook = load_workbook(filename=file_path)
|
52
53
|
sheet_ = workbook[sheet] if isinstance(sheet, str) else workbook[workbook.sheetnames[sheet]]
|
53
|
-
headers_ = [cell.value for cell in sheet_[
|
54
|
+
headers_ = [cell.value for cell in sheet_[header_row + 1]]
|
54
55
|
for row_idx, row in enumerate(sheet_.rows):
|
55
56
|
if row_idx < start_row:
|
56
57
|
continue
|
@@ -1,12 +1,21 @@
|
|
1
1
|
#!/usr/bin/env python
|
2
2
|
# -*- coding:utf-8 -*-
|
3
3
|
# Author: qicongsheng
|
4
|
+
from collections import defaultdict
|
5
|
+
from typing import Callable
|
4
6
|
|
5
7
|
|
6
|
-
def partition(list_obj: list, partition_size):
|
8
|
+
def partition(list_obj: list, partition_size: int) -> list[object]:
|
7
9
|
return [list_obj[i:i + partition_size] for i in range(0, len(list_obj), partition_size)]
|
8
10
|
|
9
11
|
|
12
|
+
def groupby(list_obj: list, key: Callable[[object], object], value: Callable[[object], object] = lambda v_: v_):
|
13
|
+
grouped = defaultdict(list)
|
14
|
+
for obj in list_obj:
|
15
|
+
grouped[key(obj)].append(value(obj))
|
16
|
+
return grouped
|
17
|
+
|
18
|
+
|
10
19
|
def is_empty(list_obj: list):
|
11
20
|
return list_obj is None or len(list_obj) == 0
|
12
21
|
|
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
|