From df00ea39fbb8cd9372d7232ea1377b6631f746dc Mon Sep 17 00:00:00 2001 From: narkopolo Date: Sun, 13 Dec 2020 20:41:14 +0100 Subject: [PATCH] change str.format() to f-strings --- unrar/rarfile.py | 4 ++-- unrar/unrarlib.py | 3 +-- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/unrar/rarfile.py b/unrar/rarfile.py index 0fa5bfd..519eb68 100644 --- a/unrar/rarfile.py +++ b/unrar/rarfile.py @@ -139,7 +139,7 @@ def __init__(self, filename, mode='r', pwd=None): self.comment = None self._load_metadata(handle) self._close(handle) - + def __enter__(self): return self @@ -388,7 +388,7 @@ def main(args=None): rf = RarFile(args[1], 'r') err = rf.testrar() if err: - print("The following enclosed file is corrupted: {!r}".format(err)) + print(f"The following enclosed file is corrupted: {err!r}") print("Done testing") elif cmd == '-e': # extract diff --git a/unrar/unrarlib.py b/unrar/unrarlib.py index 06df081..c021865 100644 --- a/unrar/unrarlib.py +++ b/unrar/unrarlib.py @@ -63,8 +63,7 @@ # find latest available version latest_version = max( version.parse(v) for v in os.listdir(BREW_UNRAR_PATH)) - lib_path = "{}{}/lib/{}".format( - BREW_UNRAR_PATH, latest_version, LIB_FILENAME) + lib_path = f"{BREW_UNRAR_PATH}{latest_version}/lib/{LIB_FILENAME}" unrarlib = ctypes.cdll.LoadLibrary(lib_path) else: raise LookupError(