mirror of
https://github.com/yt-dlp/yt-dlp.git
synced 2025-10-03 23:43:21 -04:00
[cleanup] Misc cleanup and refactor (#2173)
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
import contextlib
|
||||
import errno
|
||||
import json
|
||||
import os
|
||||
@@ -57,7 +58,7 @@ class Cache:
|
||||
return default
|
||||
|
||||
cache_fn = self._get_cache_fn(section, key, dtype)
|
||||
try:
|
||||
with contextlib.suppress(OSError):
|
||||
try:
|
||||
with open(cache_fn, encoding='utf-8') as cachef:
|
||||
self._ydl.write_debug(f'Loading {section}.{key} from cache')
|
||||
@@ -68,8 +69,6 @@ class Cache:
|
||||
except OSError as oe:
|
||||
file_size = str(oe)
|
||||
self._ydl.report_warning(f'Cache retrieval from {cache_fn} failed ({file_size})')
|
||||
except OSError:
|
||||
pass # No cache available
|
||||
|
||||
return default
|
||||
|
||||
|
Reference in New Issue
Block a user