]> jfr.im git - yt-dlp.git/blobdiff - yt_dlp/utils.py
[cleanup Misc
[yt-dlp.git] / yt_dlp / utils.py
index adb7c0e8c5d4686a4e0e5b3b9c669331e293ab8f..1e2342f3e990e9f8d046407c22edc5fa93ad00d0 100644 (file)
@@ -5724,7 +5724,7 @@ def parse_args(self):
         return self.parser.parse_args(self.all_args)
 
 
-class WebSocketsWrapper():
+class WebSocketsWrapper:
     """Wraps websockets module to use in non-async scopes"""
     pool = None
 
@@ -5808,11 +5808,9 @@ def cached_method(f):
     def wrapper(self, *args, **kwargs):
         bound_args = signature.bind(self, *args, **kwargs)
         bound_args.apply_defaults()
-        key = tuple(bound_args.arguments.values())
+        key = tuple(bound_args.arguments.values())[1:]
 
-        if not hasattr(self, '__cached_method__cache'):
-            self.__cached_method__cache = {}
-        cache = self.__cached_method__cache.setdefault(f.__name__, {})
+        cache = vars(self).setdefault('__cached_method__cache', {}).setdefault(f.__name__, {})
         if key not in cache:
             cache[key] = f(self, *args, **kwargs)
         return cache[key]