knify 1.8.57__tar.gz → 1.8.60__tar.gz
Sign up to get free protection for your applications and to get access to all the features.
- {knify-1.8.57 → knify-1.8.60}/PKG-INFO +1 -1
- {knify-1.8.57 → knify-1.8.60}/knify/help.py +1 -1
- {knify-1.8.57 → knify-1.8.60}/knify/listutil.py +11 -1
- {knify-1.8.57 → knify-1.8.60}/knify.egg-info/PKG-INFO +1 -1
- {knify-1.8.57 → knify-1.8.60}/LICENSE +0 -0
- {knify-1.8.57 → knify-1.8.60}/README.md +0 -0
- {knify-1.8.57 → knify-1.8.60}/knify/__init__.py +0 -0
- {knify-1.8.57 → knify-1.8.60}/knify/dateutil.py +0 -0
- {knify-1.8.57 → knify-1.8.60}/knify/excelutil.py +0 -0
- {knify-1.8.57 → knify-1.8.60}/knify/fileutil.py +0 -0
- {knify-1.8.57 → knify-1.8.60}/knify/logger.py +0 -0
- {knify-1.8.57 → knify-1.8.60}/knify/objutil.py +0 -0
- {knify-1.8.57 → knify-1.8.60}/knify/threadutil.py +0 -0
- {knify-1.8.57 → knify-1.8.60}/knify/warnutil.py +0 -0
- {knify-1.8.57 → knify-1.8.60}/knify.egg-info/SOURCES.txt +0 -0
- {knify-1.8.57 → knify-1.8.60}/knify.egg-info/dependency_links.txt +0 -0
- {knify-1.8.57 → knify-1.8.60}/knify.egg-info/requires.txt +0 -0
- {knify-1.8.57 → knify-1.8.60}/knify.egg-info/top_level.txt +0 -0
- {knify-1.8.57 → knify-1.8.60}/setup.cfg +0 -0
- {knify-1.8.57 → knify-1.8.60}/setup.py +0 -0
@@ -1,12 +1,22 @@
|
|
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_func: Callable[[object], object],
|
13
|
+
value_func: Callable[[object], object] = lambda v_: v_) -> dict[object, list[object]]:
|
14
|
+
grouped = defaultdict(list)
|
15
|
+
for obj in list_obj:
|
16
|
+
grouped[key_func(obj)].append(value_func(obj))
|
17
|
+
return grouped
|
18
|
+
|
19
|
+
|
10
20
|
def is_empty(list_obj: list):
|
11
21
|
return list_obj is None or len(list_obj) == 0
|
12
22
|
|
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
|