Skip to content

Commit

Permalink
Fix mypy
Browse files Browse the repository at this point in the history
  • Loading branch information
vallbull committed Oct 12, 2023
1 parent 4b97c25 commit 748b229
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 7 deletions.
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
from __future__ import annotations

from typing import Any

from aiohttp.client import (
Expand Down Expand Up @@ -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,
Expand All @@ -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}",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,27 +1,27 @@
from __future__ import annotations


import logging
from typing import Optional

import aiohttp
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 (
Expand Down Expand Up @@ -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:
Expand Down

0 comments on commit 748b229

Please sign in to comment.