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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: knify
3
- Version: 1.8.57
3
+ Version: 1.8.60
4
4
  Summary: Development tools for python
5
5
  Home-page: https://github.com/qicongsheng/knify
6
6
  Author: qicongsheng
@@ -8,7 +8,7 @@ def get_pip_name():
8
8
 
9
9
 
10
10
  def get_version():
11
- return '1.8.57'
11
+ return '1.8.60'
12
12
 
13
13
 
14
14
  def print_version():
@@ -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
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: knify
3
- Version: 1.8.57
3
+ Version: 1.8.60
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