From f47688812d1755b58105cd5400205e3f75410441 Mon Sep 17 00:00:00 2001 From: Serene-Arc Date: Tue, 25 May 2021 18:51:24 +1000 Subject: [PATCH] Rename function --- bdfr/site_downloaders/download_factory.py | 4 ++-- tests/site_downloaders/test_download_factory.py | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/bdfr/site_downloaders/download_factory.py b/bdfr/site_downloaders/download_factory.py index 7035dc2..8eff2b8 100644 --- a/bdfr/site_downloaders/download_factory.py +++ b/bdfr/site_downloaders/download_factory.py @@ -21,7 +21,7 @@ from bdfr.site_downloaders.youtube import Youtube class DownloadFactory: @staticmethod def pull_lever(url: str) -> Type[BaseDownloader]: - sanitised_url = DownloadFactory._sanitise_url(url) + sanitised_url = DownloadFactory.sanitise_url(url) if re.match(r'(i\.)?imgur.*\.gifv$', sanitised_url): return Imgur elif re.match(r'.*/.*\.\w{3,4}(\?[\w;&=]*)?$', sanitised_url): @@ -49,7 +49,7 @@ class DownloadFactory: f'No downloader module exists for url {url}') @staticmethod - def _sanitise_url(url: str) -> str: + def sanitise_url(url: str) -> str: beginning_regex = re.compile(r'\s*(www\.?)?') split_url = urllib.parse.urlsplit(url) split_url = split_url.netloc + split_url.path diff --git a/tests/site_downloaders/test_download_factory.py b/tests/site_downloaders/test_download_factory.py index f89df8a..d5e84d8 100644 --- a/tests/site_downloaders/test_download_factory.py +++ b/tests/site_downloaders/test_download_factory.py @@ -70,5 +70,5 @@ def test_factory_lever_bad(test_url: str): ('https://i.imgur.com/BuzvZwb.gifv', 'i.imgur.com/BuzvZwb.gifv'), )) def test_sanitise_url(test_url: str, expected: str): - result = DownloadFactory._sanitise_url(test_url) + result = DownloadFactory.sanitise_url(test_url) assert result == expected