diff --git a/lib/dl_file_uploader_lib/dl_file_uploader_lib/yadocs_client.py b/lib/dl_file_uploader_lib/dl_file_uploader_lib/yadocs_client.py index c0aab4648..a310aacf9 100644 --- a/lib/dl_file_uploader_lib/dl_file_uploader_lib/yadocs_client.py +++ b/lib/dl_file_uploader_lib/dl_file_uploader_lib/yadocs_client.py @@ -1,3 +1,5 @@ +from __future__ import annotations + from typing import Any from aiohttp.client import ( @@ -44,7 +46,7 @@ async def get_spreadsheet_public_ref(self, link: str) -> str: raise yadocs_error_to_file_uploader_exception(resp.status, await resp.json()) return (await resp.json())["href"] - async def get_spreadsheet_public_meta(self, link: str) -> ClientResponse: + async def get_spreadsheet_public_meta(self, link: str) -> dict[str, Any]: resp = await self.session.get( f"{self.hostname}/public/resources/?public_key={link}", headers=self.headers, @@ -63,7 +65,7 @@ async def get_spreadsheet_private_ref(self, path: str, token: str) -> str: raise yadocs_error_to_file_uploader_exception(resp.status, await resp.json()) return (await resp.json())["href"] - async def get_spreadsheet_private_meta(self, path: str, token: str) -> ClientResponse: + async def get_spreadsheet_private_meta(self, path: str, token: str) -> dict[str, Any]: headers_with_token = self._create_headers_with_token(token) resp = await self.session.get( f"{self.hostname}/resources/?path={path}", diff --git a/lib/dl_file_uploader_worker_lib/dl_file_uploader_worker_lib/tasks/download_yadocs.py b/lib/dl_file_uploader_worker_lib/dl_file_uploader_worker_lib/tasks/download_yadocs.py index 2b39ecedd..818dca1e6 100644 --- a/lib/dl_file_uploader_worker_lib/dl_file_uploader_worker_lib/tasks/download_yadocs.py +++ b/lib/dl_file_uploader_worker_lib/dl_file_uploader_worker_lib/tasks/download_yadocs.py @@ -1,6 +1,5 @@ from __future__ import annotations - import logging from typing import Optional @@ -8,20 +7,21 @@ import attr from dl_constants.enums import FileProcessingStatus - from dl_file_uploader_lib import exc from dl_file_uploader_lib.data_sink.raw_bytes import ( RawBytesAsyncDataStream, S3RawFileAsyncDataSink, ) - from dl_file_uploader_lib.redis_model.base import RedisModelManager from dl_file_uploader_lib.redis_model.models import ( DataFile, FileProcessingError, YaDocsUserSourceProperties, ) -from dl_file_uploader_lib.yadocs_client import YaDocsClient, yadocs_error_to_file_uploader_exception +from dl_file_uploader_lib.yadocs_client import ( + YaDocsClient, + yadocs_error_to_file_uploader_exception, +) from dl_file_uploader_task_interface.context import FileUploaderTaskContext import dl_file_uploader_task_interface.tasks as task_interface from dl_task_processor.task import ( @@ -87,7 +87,7 @@ async def run(self) -> TaskResult: dfile.filename = spreadsheet_meta["name"] s3 = self._ctx.s3_service - async def _chunk_iter(chunk_size: int = 10 * 1024 * 1024): + async def _chunk_iter(chunk_size: int = 10 * 1024 * 1024) -> None: async with aiohttp.ClientSession() as session: async with session.get(spreadsheet_ref) as resp: if resp.status != 200: