summaryrefslogtreecommitdiffstats
path: root/devscripts/tomlparse.py
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-17 07:54:09 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-17 07:54:09 +0000
commitb91227758bfa7527946b3e8530614724928005ac (patch)
tree3ddfa5e0c43164b29f5682a9c94b09b34def2ee1 /devscripts/tomlparse.py
parentAdding upstream version 2024.03.10. (diff)
downloadyt-dlp-b91227758bfa7527946b3e8530614724928005ac.tar.xz
yt-dlp-b91227758bfa7527946b3e8530614724928005ac.zip
Adding upstream version 2024.04.09.upstream/2024.04.09
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'devscripts/tomlparse.py')
-rwxr-xr-xdevscripts/tomlparse.py10
1 files changed, 5 insertions, 5 deletions
diff --git a/devscripts/tomlparse.py b/devscripts/tomlparse.py
index 85ac4ee..ac9ea31 100755
--- a/devscripts/tomlparse.py
+++ b/devscripts/tomlparse.py
@@ -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))