lint fixes

This commit is contained in:
Your Name 2023-05-22 14:52:02 -04:00 committed by Henri Dickson
parent 1ec95bb7d0
commit 2ec3312fdf
3 changed files with 11 additions and 6 deletions

View file

@ -170,6 +170,7 @@ class ProxiedDownloader(BasicDownloader):
last_try = False
url = urls.pop(0) if len(urls) else None
resp = None
resp_type = None
while url:
resp, resp_type = self._download(url)
if (
@ -219,9 +220,12 @@ class ImageDownloaderMixin:
img = Image.open(BytesIO(raw_img))
img.load() # corrupted image will trigger exception
content_type = response.headers.get("Content-Type")
self.extention = filetype.get_type(
file_type = filetype.get_type(
mime=content_type.partition(";")[0].strip()
).extension
)
if file_type is None:
return RESPONSE_NETWORK_ERROR
self.extention = file_type.extension
return RESPONSE_OK
except Exception:
return RESPONSE_NETWORK_ERROR

View file

@ -21,9 +21,10 @@ import logging
_logger = logging.getLogger(__name__)
if settings.SEARCH_BACKEND == "MEILISEARCH":
from .search.meilisearch import Indexer
elif settings.SEARCH_BACKEND == "TYPESENSE":
# if settings.SEARCH_BACKEND == "MEILISEARCH":
# from .search.meilisearch import Indexer
# el
if settings.SEARCH_BACKEND == "TYPESENSE":
from .search.typesense import Indexer
else:

View file

@ -66,7 +66,7 @@ def enqueue_fetch(url, is_refetch):
return job_id
def fetch(request, url, is_refetch: bool = False, site: AbstractSite = None):
def fetch(request, url, is_refetch: bool = False, site: AbstractSite | None = None):
if not site:
site = SiteManager.get_site_by_url(url)
if not site: