ezKit 2.0.6__tar.gz → 2.0.7__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.6
3
+ Version: 2.0.7
4
4
  Summary: Easy Kit
5
5
  Author: septvean
6
6
  Author-email: septvean@gmail.com
@@ -3,6 +3,7 @@
3
3
  import re
4
4
  import tomllib
5
5
 
6
+ from datetime import datetime, timezone
6
7
  from os import environ
7
8
  from typing import Iterable
8
9
 
@@ -143,3 +144,20 @@ def check_dict_values_incorrect(
143
144
  logger.error(e)
144
145
 
145
146
  return False
147
+
148
+
149
+ # --------------------------------------------------------------------------------------------------
150
+
151
+
152
+ def timestamp_to_datetime(timestamp: int | float, tz: timezone = timezone.utc) -> datetime | None:
153
+ """Unix Timestamp 转换为 Datatime"""
154
+ try:
155
+ if not isinstance(timestamp, (int, float)):
156
+ return None
157
+ return (datetime.fromtimestamp(timestamp, tz=tz)).replace(tzinfo=None)
158
+ except Exception as e:
159
+ if DEBUG:
160
+ logger.exception(e)
161
+ else:
162
+ logger.error(e)
163
+ return None
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: ezKit
3
- Version: 2.0.6
3
+ Version: 2.0.7
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.6",
7
+ version="2.0.7",
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