mirror of
https://github.com/kellyjonbrazil/jc.git
synced 2025-06-21 00:19:42 +02:00
more granular type annotations
This commit is contained in:
@ -296,7 +296,7 @@ class timestamp:
|
|||||||
|
|
||||||
def __init__(self,
|
def __init__(self,
|
||||||
datetime_string: str,
|
datetime_string: str,
|
||||||
format_hint: Optional[Iterable] = None
|
format_hint: Optional[Iterable[int]] = None
|
||||||
) -> None:
|
) -> None:
|
||||||
"""
|
"""
|
||||||
Input a datetime text string of several formats and convert to a
|
Input a datetime text string of several formats and convert to a
|
||||||
@ -501,7 +501,7 @@ class timestamp:
|
|||||||
|
|
||||||
# normalize the timezone by taking out any timezone reference, except UTC
|
# normalize the timezone by taking out any timezone reference, except UTC
|
||||||
cleandata = data.replace('(', '').replace(')', '')
|
cleandata = data.replace('(', '').replace(')', '')
|
||||||
normalized_datetime_list = []
|
normalized_datetime_list: List[str] = []
|
||||||
for term in cleandata.split():
|
for term in cleandata.split():
|
||||||
if term not in tz_abbr:
|
if term not in tz_abbr:
|
||||||
normalized_datetime_list.append(term)
|
normalized_datetime_list.append(term)
|
||||||
@ -519,7 +519,7 @@ class timestamp:
|
|||||||
normalized_datetime = p.sub(r'\g<1> ', normalized_datetime)
|
normalized_datetime = p.sub(r'\g<1> ', normalized_datetime)
|
||||||
|
|
||||||
# try format hints first, then fall back to brute-force method
|
# try format hints first, then fall back to brute-force method
|
||||||
hint_obj_list = []
|
hint_obj_list: List[TSFormatType] = []
|
||||||
for fmt_id in format_hint:
|
for fmt_id in format_hint:
|
||||||
for fmt in formats:
|
for fmt in formats:
|
||||||
if fmt_id == fmt['id']:
|
if fmt_id == fmt['id']:
|
||||||
|
Reference in New Issue
Block a user