ezKit 2.0.7__tar.gz → 2.0.8__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: ezKit
3
- Version: 2.0.7
3
+ Version: 2.0.8
4
4
  Summary: Easy Kit
5
5
  Author: septvean
6
6
  Author-email: septvean@gmail.com
@@ -3,9 +3,9 @@
3
3
  import re
4
4
  import tomllib
5
5
 
6
+ from collections.abc import Callable, Iterable
6
7
  from datetime import datetime, timezone
7
8
  from os import environ
8
- from typing import Iterable
9
9
 
10
10
  from loguru import logger
11
11
 
@@ -49,6 +49,21 @@ def load_toml_file(file: str) -> dict:
49
49
  # --------------------------------------------------------------------------------------------------
50
50
 
51
51
 
52
+ def map_filter(func: Callable, iterable: Iterable) -> list:
53
+ """对 iterable 执行 func, 并保留为 True 的返回值"""
54
+ try:
55
+ return [x for x in map(func, iterable) if x]
56
+ except Exception as e:
57
+ if DEBUG:
58
+ logger.exception(e)
59
+ else:
60
+ logger.error(e)
61
+ return []
62
+
63
+
64
+ # --------------------------------------------------------------------------------------------------
65
+
66
+
52
67
  def check_dict_values_incorrect(
53
68
  data: dict[str, object],
54
69
  errors: object | Iterable[object] | None = None,
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: ezKit
3
- Version: 2.0.7
3
+ Version: 2.0.8
4
4
  Summary: Easy Kit
5
5
  Author: septvean
6
6
  Author-email: septvean@gmail.com
@@ -4,7 +4,7 @@ from setuptools import find_packages, setup
4
4
 
5
5
  setup(
6
6
  name="ezKit",
7
- version="2.0.7",
7
+ version="2.0.8",
8
8
  author="septvean",
9
9
  author_email="septvean@gmail.com",
10
10
  description="Easy Kit",
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