mm-std 0.1.5__py3-none-any.whl → 0.1.7__py3-none-any.whl
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.
mm_std/date.py
CHANGED
@@ -1,8 +1,6 @@
|
|
1
1
|
import random
|
2
2
|
from datetime import UTC, datetime, timedelta
|
3
3
|
|
4
|
-
from dateutil import parser
|
5
|
-
|
6
4
|
|
7
5
|
def utc_now() -> datetime:
|
8
6
|
return datetime.now(UTC)
|
@@ -28,7 +26,34 @@ def utc_delta(
|
|
28
26
|
|
29
27
|
|
30
28
|
def parse_date(value: str, ignore_tz: bool = False) -> datetime:
|
31
|
-
|
29
|
+
if value.lower().endswith("z"):
|
30
|
+
value = value[:-1] + "+00:00"
|
31
|
+
date_formats = [
|
32
|
+
"%Y-%m-%d %H:%M:%S.%f%z",
|
33
|
+
"%Y-%m-%dT%H:%M:%S.%f%z",
|
34
|
+
"%Y-%m-%d %H:%M:%S.%f",
|
35
|
+
"%Y-%m-%d %H:%M:%S%z",
|
36
|
+
"%Y-%m-%d %H:%M:%S",
|
37
|
+
"%Y-%m-%d %H:%M%z",
|
38
|
+
"%Y-%m-%d %H:%M",
|
39
|
+
"%Y-%m-%d",
|
40
|
+
"%Y/%m/%d",
|
41
|
+
# Add more formats as needed
|
42
|
+
]
|
43
|
+
|
44
|
+
for fmt in date_formats:
|
45
|
+
try:
|
46
|
+
dt = datetime.strptime(value, fmt)
|
47
|
+
if ignore_tz and dt.tzinfo is not None:
|
48
|
+
dt = dt.replace(tzinfo=None)
|
49
|
+
return dt
|
50
|
+
except ValueError:
|
51
|
+
continue
|
52
|
+
raise ValueError(f"Time data '{value}' does not match any known format.")
|
53
|
+
|
54
|
+
|
55
|
+
# def parse_date(value: str, ignore_tz: bool = False) -> datetime:
|
56
|
+
# return parser.parse(value, ignoretz=ignore_tz)
|
32
57
|
|
33
58
|
|
34
59
|
def utc_random(
|
@@ -1,12 +1,11 @@
|
|
1
1
|
Metadata-Version: 2.3
|
2
2
|
Name: mm-std
|
3
|
-
Version: 0.1.
|
3
|
+
Version: 0.1.7
|
4
4
|
Requires-Python: >=3.12
|
5
5
|
Requires-Dist: cryptography~=43.0.3
|
6
6
|
Requires-Dist: httpx[http2,socks]~=0.27.2
|
7
|
-
Requires-Dist: pydantic~=2.
|
8
|
-
Requires-Dist: pydash~=8.0.
|
9
|
-
Requires-Dist: python-dateutil~=2.9.0
|
7
|
+
Requires-Dist: pydantic~=2.10.1
|
8
|
+
Requires-Dist: pydash~=8.0.4
|
10
9
|
Requires-Dist: python-dotenv~=1.0.1
|
11
10
|
Requires-Dist: pyyaml~=6.0.1
|
12
|
-
Requires-Dist: rich
|
11
|
+
Requires-Dist: rich~=13.0
|
@@ -3,7 +3,7 @@ mm_std/command.py,sha256=r1n9ZHyMFhNkNOH9grRCm5J0hhX4_v0c2wdaal8iCZY,1270
|
|
3
3
|
mm_std/concurrency.py,sha256=XSPYLUsGO1G0mcsdTn_Hwg5nb694-nUMhwQ6TvOrMCc,5340
|
4
4
|
mm_std/config.py,sha256=ftYrsZ4i715I20s2q8vqYyniMSCIAVrh-9TtAzsyMfQ,3147
|
5
5
|
mm_std/crypto.py,sha256=jdk0_TCmeU0pPXMyz9xH6kQHSjjZ9GcGClBwQps5vBo,340
|
6
|
-
mm_std/date.py,sha256=
|
6
|
+
mm_std/date.py,sha256=dhlBE8dTzPe0Qhu5f6YMeR5ka5k2B0IoMe8VA7_-pII,1969
|
7
7
|
mm_std/dict.py,sha256=kJBPVG9vEqHiSgKKoji8gVGL1yEBbxAmFNn0zz17AUg,180
|
8
8
|
mm_std/env.py,sha256=5zaR9VeIfObN-4yfgxoFeU5IM1GDeZZj9SuYf7t9sOA,125
|
9
9
|
mm_std/fs.py,sha256=RwarNRJq3tIMG6LVX_g03hasfYpjYFh_O27oVDt5IPQ,291
|
@@ -18,6 +18,6 @@ mm_std/str.py,sha256=nG5XF5870xM2PAvU0LZrJDk-d54LYwRLGnSahIekOVw,3151
|
|
18
18
|
mm_std/telegram.py,sha256=QrHPnsy0LTeqpd-g3RaHhk7gWIfHZEgnMs-S5DLW-vU,1220
|
19
19
|
mm_std/types.py,sha256=KpFtJ-BTmDfmmFeOSlgq6cMbCfGGOQjh1oWvdcrW-kw,116
|
20
20
|
mm_std/zip.py,sha256=2EXcae4HO5U4kObj2Lj8jl5F2OUpT-WRlJybTyFzt6I,370
|
21
|
-
mm_std-0.1.
|
22
|
-
mm_std-0.1.
|
23
|
-
mm_std-0.1.
|
21
|
+
mm_std-0.1.7.dist-info/METADATA,sha256=EuS_zOTV03c-AhjEiMwNykz0QkmphuKqehzc1tvGO4E,304
|
22
|
+
mm_std-0.1.7.dist-info/WHEEL,sha256=C2FUgwZgiLbznR-k0b_5k3Ai_1aASOXDss3lzCUsUug,87
|
23
|
+
mm_std-0.1.7.dist-info/RECORD,,
|