mirror of
https://github.com/yt-dlp/yt-dlp.git
synced 2025-07-29 14:27:31 +02:00
[cleanup] Standardize import datetime as dt
(#8978)
This commit is contained in:
parent
e3a3ed8a98
commit
c305a25c1b
21 changed files with 94 additions and 94 deletions
|
@ -11,7 +11,7 @@ IMPORTANT: INVALID FILES OR MULTILINE STRINGS ARE NOT SUPPORTED!
|
|||
|
||||
from __future__ import annotations
|
||||
|
||||
import datetime
|
||||
import datetime as dt
|
||||
import json
|
||||
import re
|
||||
|
||||
|
@ -115,9 +115,9 @@ def parse_value(data: str, index: int):
|
|||
for func in [
|
||||
int,
|
||||
float,
|
||||
datetime.time.fromisoformat,
|
||||
datetime.date.fromisoformat,
|
||||
datetime.datetime.fromisoformat,
|
||||
dt.time.fromisoformat,
|
||||
dt.date.fromisoformat,
|
||||
dt.datetime.fromisoformat,
|
||||
{'true': True, 'false': False}.get,
|
||||
]:
|
||||
try:
|
||||
|
@ -179,7 +179,7 @@ def main():
|
|||
data = file.read()
|
||||
|
||||
def default(obj):
|
||||
if isinstance(obj, (datetime.date, datetime.time, datetime.datetime)):
|
||||
if isinstance(obj, (dt.date, dt.time, dt.datetime)):
|
||||
return obj.isoformat()
|
||||
|
||||
print(json.dumps(parse_toml(data), default=default))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue