Skip to content

Commit

Permalink
Fix typing for post_upload_function io upload queue (#279)
Browse files Browse the repository at this point in the history
  • Loading branch information
einarmo authored Jan 4, 2024
1 parent acff7aa commit b89cc21
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion cognite/extractorutils/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,5 @@
Cognite extractor utils is a Python package that simplifies the development of new extractors.
"""

__version__ = "6.2.0"
__version__ = "6.2.1"
from .base import Extractor
12 changes: 6 additions & 6 deletions cognite/extractorutils/uploader/files.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,12 @@
from io import BytesIO
from os import PathLike
from types import TracebackType
from typing import Any, BinaryIO, Callable, List, Optional, Tuple, Type, Union
from typing import BinaryIO, Callable, List, Optional, Tuple, Type, Union

from requests import ConnectionError

from cognite.client import CogniteClient
from cognite.client.data_classes import Event, FileMetadata
from cognite.client.data_classes import FileMetadata
from cognite.client.exceptions import CogniteAPIError
from cognite.extractorutils.uploader._base import (
RETRIES,
Expand Down Expand Up @@ -64,7 +64,7 @@ class IOFileUploadQueue(AbstractUploadQueue):
def __init__(
self,
cdf_client: CogniteClient,
post_upload_function: Optional[Callable[[List[Event]], None]] = None,
post_upload_function: Optional[Callable[[List[FileMetadata]], None]] = None,
max_queue_size: Optional[int] = None,
max_upload_interval: Optional[int] = None,
trigger_log_level: str = "DEBUG",
Expand Down Expand Up @@ -128,7 +128,7 @@ def upload(self) -> None:
self.files_written.inc(self.upload_queue_size)

try:
self._post_upload(self.upload_queue)
self._post_upload([el[0] for el in self.upload_queue])
except Exception as e:
self.logger.error("Error in upload callback: %s", str(e))
self.upload_queue.clear()
Expand Down Expand Up @@ -228,7 +228,7 @@ class FileUploadQueue(IOFileUploadQueue):
def __init__(
self,
cdf_client: CogniteClient,
post_upload_function: Optional[Callable[[List[Event]], None]] = None,
post_upload_function: Optional[Callable[[List[FileMetadata]], None]] = None,
max_queue_size: Optional[int] = None,
max_upload_interval: Optional[int] = None,
trigger_log_level: str = "DEBUG",
Expand Down Expand Up @@ -284,7 +284,7 @@ class BytesUploadQueue(IOFileUploadQueue):
def __init__(
self,
cdf_client: CogniteClient,
post_upload_function: Optional[Callable[[List[Any]], None]] = None,
post_upload_function: Optional[Callable[[List[FileMetadata]], None]] = None,
max_queue_size: Optional[int] = None,
max_upload_interval: Optional[int] = None,
trigger_log_level: str = "DEBUG",
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "cognite-extractor-utils"
version = "6.2.0"
version = "6.2.1"
description = "Utilities for easier development of extractors for CDF"
authors = ["Mathias Lohne <[email protected]>"]
license = "Apache-2.0"
Expand Down

0 comments on commit b89cc21

Please sign in to comment.