ezKit 1.12.17__tar.gz → 1.12.19__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.
Files changed (28) hide show
  1. {ezkit-1.12.17/ezKit.egg-info → ezkit-1.12.19}/PKG-INFO +1 -1
  2. {ezkit-1.12.17 → ezkit-1.12.19}/ezKit/database.py +2 -1
  3. {ezkit-1.12.17 → ezkit-1.12.19}/ezKit/utils.py +23 -0
  4. {ezkit-1.12.17 → ezkit-1.12.19/ezKit.egg-info}/PKG-INFO +1 -1
  5. {ezkit-1.12.17 → ezkit-1.12.19}/setup.py +1 -1
  6. {ezkit-1.12.17 → ezkit-1.12.19}/LICENSE +0 -0
  7. {ezkit-1.12.17 → ezkit-1.12.19}/MANIFEST.in +0 -0
  8. {ezkit-1.12.17 → ezkit-1.12.19}/README.md +0 -0
  9. {ezkit-1.12.17 → ezkit-1.12.19}/ezKit/__init__.py +0 -0
  10. {ezkit-1.12.17 → ezkit-1.12.19}/ezKit/_file.py +0 -0
  11. {ezkit-1.12.17 → ezkit-1.12.19}/ezKit/bottle.py +0 -0
  12. {ezkit-1.12.17 → ezkit-1.12.19}/ezKit/bottle_extensions.py +0 -0
  13. {ezkit-1.12.17 → ezkit-1.12.19}/ezKit/cipher.py +0 -0
  14. {ezkit-1.12.17 → ezkit-1.12.19}/ezKit/dockerhub.py +0 -0
  15. {ezkit-1.12.17 → ezkit-1.12.19}/ezKit/http.py +0 -0
  16. {ezkit-1.12.17 → ezkit-1.12.19}/ezKit/markdown_to_html.template +0 -0
  17. {ezkit-1.12.17 → ezkit-1.12.19}/ezKit/mongo.py +0 -0
  18. {ezkit-1.12.17 → ezkit-1.12.19}/ezKit/qywx.py +0 -0
  19. {ezkit-1.12.17 → ezkit-1.12.19}/ezKit/redis.py +0 -0
  20. {ezkit-1.12.17 → ezkit-1.12.19}/ezKit/sendemail.py +0 -0
  21. {ezkit-1.12.17 → ezkit-1.12.19}/ezKit/token.py +0 -0
  22. {ezkit-1.12.17 → ezkit-1.12.19}/ezKit/xftp.py +0 -0
  23. {ezkit-1.12.17 → ezkit-1.12.19}/ezKit/zabbix.py +0 -0
  24. {ezkit-1.12.17 → ezkit-1.12.19}/ezKit.egg-info/SOURCES.txt +0 -0
  25. {ezkit-1.12.17 → ezkit-1.12.19}/ezKit.egg-info/dependency_links.txt +0 -0
  26. {ezkit-1.12.17 → ezkit-1.12.19}/ezKit.egg-info/requires.txt +0 -0
  27. {ezkit-1.12.17 → ezkit-1.12.19}/ezKit.egg-info/top_level.txt +0 -0
  28. {ezkit-1.12.17 → ezkit-1.12.19}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: ezKit
3
- Version: 1.12.17
3
+ Version: 1.12.19
4
4
  Summary: Easy Kit
5
5
  Author: septvean
6
6
  Author-email: septvean@gmail.com
@@ -644,7 +644,8 @@ class DatabaseAsyncSession:
644
644
  if not utils.isTrue(item, dict):
645
645
  await session.rollback()
646
646
  return False
647
- await session.add(schema(**item))
647
+ # 这里不使用 await
648
+ session.add(schema(**item))
648
649
  await session.commit()
649
650
  return True
650
651
  except Exception as e:
@@ -1345,3 +1345,26 @@ def markdown_to_html(markdown_file: str, html_file: str, title: str) -> bool:
1345
1345
  logger.error(f"{info} [错误]")
1346
1346
  logger.error(e)
1347
1347
  return False
1348
+
1349
+
1350
+ # --------------------------------------------------------------------------------------------------
1351
+
1352
+
1353
+ def convert_field_to_datetime(data: list[dict], field: str, fmt: str = "%Y-%m-%d %H:%M:%S"):
1354
+ """
1355
+ 将列表中每个 dict 的指定字段转换为 datetime 对象
1356
+
1357
+ 参数:
1358
+ data (list[dict]): 列表数据
1359
+ field (str): 要转换的字段名
1360
+ fmt (str): 字符串的时间格式, 默认 "%Y-%m-%d %H:%M:%S"
1361
+ """
1362
+ _data = deepcopy(data)
1363
+ for item in _data:
1364
+ value = item.get(field)
1365
+ if isinstance(value, str):
1366
+ try:
1367
+ item[field] = datetime.strptime(value, fmt)
1368
+ except ValueError:
1369
+ pass
1370
+ return _data
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: ezKit
3
- Version: 1.12.17
3
+ Version: 1.12.19
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="1.12.17",
7
+ version="1.12.19",
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
File without changes
File without changes
File without changes
File without changes
File without changes