From 59b798a115fab30a3240c2adbb6694d1e901d0b9 Mon Sep 17 00:00:00 2001 From: Dimitris Zlatanidis Date: Fri, 1 Dec 2023 11:53:55 +0200 Subject: [PATCH] Refactor class methods --- slpkg/downloader.py | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/slpkg/downloader.py b/slpkg/downloader.py index 9fe6f19e..316a8320 100644 --- a/slpkg/downloader.py +++ b/slpkg/downloader.py @@ -23,10 +23,10 @@ class Downloader(Configs): self.filename = None self.downloader_command: str = '' self.downloader_tools: dict = { - 'wget': self.wget_downloader, - 'wget2': self.wget_downloader, - 'curl': self.curl_downloader, - 'lftp': self.lftp_downloader + 'wget': self.set_wget_downloader, + 'wget2': self.set_wget_downloader, + 'curl': self.set_curl_downloader, + 'lftp': self.set_lftp_downloader } self.option_for_parallel: bool = self.utils.is_option( ('-P', '--parallel'), flags) @@ -78,14 +78,14 @@ class Downloader(Configs): except FileNotFoundError as error: self.errors.raise_error_message(f'{error}', 1) - def wget_downloader(self, url: str, path: Path) -> None: + def set_wget_downloader(self, url: str, path: Path) -> None: self.downloader_command: str = f'{self.downloader} {self.wget_options} --directory-prefix={path} "{url}"' - def curl_downloader(self, url: str, path: Path) -> None: + def set_curl_downloader(self, url: str, path: Path) -> None: self.downloader_command: str = (f'{self.downloader} {self.curl_options} "{url}" ' f'--output {path}/{self.filename}') - def lftp_downloader(self, url: str, path: Path) -> None: + def set_lftp_downloader(self, url: str, path: Path) -> None: self.downloader_command: str = f'{self.downloader} {self.lftp_get_options} {url} -o {path}' def check_if_downloaded(self, url: str, path: Path) -> None: