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
commitb12aca2eea3676bb3cf2666b63542c019fac699d (patch)
tree026eec6b22f4422a90479fea630e8e173781aa79 /devscripts/tomlparse.py
parentAdding debian version 2024.03.10-1. (diff)
downloadyt-dlp-b12aca2eea3676bb3cf2666b63542c019fac699d.tar.xz
yt-dlp-b12aca2eea3676bb3cf2666b63542c019fac699d.zip
Merging upstream version 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))