File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ # SPDX-License-Identifier: MIT
2+ # SPDX-FileCopyrightText: 2026 null8626 & Top.gg
3+
14from datetime import datetime
25from sys import version_info
36
47
5- if version_info .major == 3 and version_info .minor <= 10 :
8+ if version_info .major == 3 and version_info .minor <= 10 : # pragma: nocover
69 from re import compile
710
8- TIMESTAMP_MILLISECOND_FIX_REGEX = compile (r'\.(\d+ )' )
9- TIMESTAMP_MILLISECOND_FIX_TRIMMER = lambda match : match .group (1 )[:3 ]
11+ TIMESTAMP_MILLISECOND_FIX_REGEX = compile (r'\.(\d{4,} )' )
12+ TIMESTAMP_MILLISECOND_FIX_TRIMMER = lambda match : f'. { match .group (1 )[:3 ]} '
1013
1114
1215def parse_timestamp (timestamp : str ) -> datetime :
1316 """Parses an ISO format timestamp to a Python datetime instance."""
1417
15- if version_info .major == 3 and version_info .minor <= 10 :
18+ if version_info .major == 3 and version_info .minor <= 10 : # pragma: nocover
1619 timestamp = TIMESTAMP_MILLISECOND_FIX_REGEX .sub (
1720 TIMESTAMP_MILLISECOND_FIX_TRIMMER , timestamp
1821 )
You can’t perform that action at this time.
0 commit comments