aboutsummaryrefslogtreecommitdiffstats
path: root/yt_dlp/utils.py
diff options
context:
space:
mode:
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