]> jfr.im git - yt-dlp.git/commitdiff
Bugfix for 3a408f9d199127ca2626359e21a866a09ab236b3
authorpukkandan <redacted>
Fri, 20 May 2022 15:25:21 +0000 (20:55 +0530)
committerpukkandan <redacted>
Fri, 20 May 2022 15:55:07 +0000 (21:25 +0530)
yt_dlp/compat/functools.py
yt_dlp/downloader/common.py

index c3c4d8f486af3ffa5ec0a50550ed5d65e241e0f2..ec003ea90e076a6b4e714f242a5bd6006c0cb833 100644 (file)
@@ -20,5 +20,7 @@ def __init__(self, func):
             self.func = func
 
         def __get__(self, instance, _):
+            if instance is None:
+                return self
             setattr(instance, self.func.__name__, self.func(instance))
             return getattr(instance, self.func.__name__)
index d74692130db68eec96342b46bd87a2ba3bf7cff1..93eb10f768d852b622d2384165d453c4d20a9efe 100644 (file)
     MultilinePrinter,
     QuietMultilinePrinter,
 )
-from ..compat import functools
 from ..utils import (
     NUMBER_RE,
     LockingUnsupportedError,
     Namespace,
+    classproperty,
     decodeArgument,
     encodeFilename,
     error_to_compat_str,
@@ -103,9 +103,9 @@ def to_screen(self, *args, **kargs):
 
     __to_screen = to_screen
 
-    @functools.cached_property
-    def FD_NAME(self):
-        return re.sub(r'(?<!^)(?=[A-Z])', '_', type(self).__name__[:-2]).lower()
+    @classproperty
+    def FD_NAME(cls):
+        return re.sub(r'(?<!^)(?=[A-Z])', '_', cls.__name__[:-2]).lower()
 
     @staticmethod
     def format_seconds(seconds):