1
0
Fork 0

[compat] Add functools.cached_property

This commit is contained in:
pukkandan 2022-05-20 20:55:21 +05:30
commit 2762dbb17e
No known key found for this signature in database
GPG key ID: 7EEE9E1E817D0A39
5 changed files with 21 additions and 7 deletions

View file

@ -11,6 +11,7 @@ from ..minicurses import (
MultilinePrinter,
QuietMultilinePrinter,
)
from ..compat import functools
from ..utils import (
NUMBER_RE,
LockingUnsupportedError,
@ -102,7 +103,7 @@ class FileDownloader:
__to_screen = to_screen
@property
@functools.cached_property
def FD_NAME(self):
return re.sub(r'(?<!^)(?=[A-Z])', '_', type(self).__name__[:-2]).lower()

View file

@ -5,6 +5,7 @@ import sys
import time
from .fragment import FragmentFD
from ..compat import functools
from ..compat import compat_setenv, compat_str
from ..postprocessor.ffmpeg import EXT_TO_OUT_FORMATS, FFmpegPostProcessor
from ..utils import (
@ -74,7 +75,7 @@ class ExternalFD(FragmentFD):
def EXE_NAME(cls):
return cls.get_basename()
@property
@functools.cached_property
def exe(self):
return self.EXE_NAME