aboutsummaryrefslogtreecommitdiffstats
path: root/yt_dlp/utils.py
diff options
context:
space:
mode:
authorpukkandan <pukkandan.ytdlp@gmail.com>2022-05-17 18:36:29 +0530
committerpukkandan <pukkandan.ytdlp@gmail.com>2022-05-17 18:41:46 +0530
commit591bb9d3553a4d7b453777c1e28e0948741e3b50 (patch)
tree44e8e3873c6d8e6d06c7a92b3b32179242e114c2 /yt_dlp/utils.py
parent5faf6528fb701724ac32e0a487f92281c7800bda (diff)
downloadhypervideo-pre-591bb9d3553a4d7b453777c1e28e0948741e3b50.tar.lz
hypervideo-pre-591bb9d3553a4d7b453777c1e28e0948741e3b50.tar.xz
hypervideo-pre-591bb9d3553a4d7b453777c1e28e0948741e3b50.zip
Fix color in `-q -F`
and convert `ydl._out_files`/`ydl._allow_colors` to `Namespace` Closes #3761
Diffstat (limited to 'yt_dlp/utils.py')
-rw-r--r--yt_dlp/utils.py16
1 files changed, 14 insertions, 2 deletions
diff --git a/yt_dlp/utils.py b/yt_dlp/utils.py
index 8a9567de4..1249c0100 100644
--- a/yt_dlp/utils.py
+++ b/yt_dlp/utils.py
@@ -5322,8 +5322,20 @@ class classproperty:
return self.f(cls)
-def Namespace(**kwargs):
- return collections.namedtuple('Namespace', kwargs)(**kwargs)
+class Namespace:
+ """Immutable namespace"""
+ @property
+ def items_(self):
+ return self._dict.items()
+
+ def __init__(self, **kwargs):
+ self._dict = kwargs
+
+ def __getattr__(self, attr):
+ return self._dict[attr]
+
+ def __repr__(self):
+ return f'{type(self).__name__}({", ".join(f"{k}={v}" for k, v in self.items_)})'
# Deprecated