Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(deps-dev): bump mypy from 1.1.1 to 1.2.0 #2096

Merged
merged 3 commits into from
Apr 11, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 21 additions & 3 deletions aws_lambda_powertools/utilities/streaming/_s3_seekable_io.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,29 @@
import io
import logging
from typing import IO, TYPE_CHECKING, AnyStr, Iterable, List, Optional, cast
from typing import (
IO,
TYPE_CHECKING,
Any,
Iterable,
List,
Optional,
Sequence,
TypeVar,
Union,
cast,
)

import boto3

from aws_lambda_powertools.utilities.streaming.compat import PowertoolsStreamingBody

if TYPE_CHECKING:
from mmap import mmap

from mypy_boto3_s3 import Client

_CData = TypeVar("_CData")

logger = logging.getLogger(__name__)


Expand Down Expand Up @@ -177,8 +192,11 @@ def isatty(self) -> bool:
def truncate(self, size: Optional[int] = 0) -> int:
raise NotImplementedError("this stream is not writable")

def write(self, data: AnyStr) -> int:
def write(self, data: Union[bytes, Union[bytearray, memoryview, Sequence[Any], "mmap", "_CData"]]) -> int:
raise NotImplementedError("this stream is not writable")

def writelines(self, lines: Iterable[AnyStr]) -> None:
def writelines(
self,
data: Iterable[Union[bytes, Union[bytearray, memoryview, Sequence[Any], "mmap", "_CData"]]],
) -> None:
raise NotImplementedError("this stream is not writable")
15 changes: 12 additions & 3 deletions aws_lambda_powertools/utilities/streaming/s3_object.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,13 @@
from typing import (
IO,
TYPE_CHECKING,
AnyStr,
Any,
Iterable,
List,
Optional,
Sequence,
TypeVar,
Union,
cast,
overload,
)
Expand All @@ -26,8 +28,12 @@
)

if TYPE_CHECKING:
from mmap import mmap

from mypy_boto3_s3 import Client

_CData = TypeVar("_CData")


# Maintenance: almost all this logic should be moved to a base class
class S3Object(IO[bytes]):
Expand Down Expand Up @@ -252,8 +258,11 @@ def isatty(self) -> bool:
def truncate(self, size: Optional[int] = 0) -> int:
raise NotImplementedError("this stream is not writable")

def write(self, data: AnyStr) -> int:
def write(self, data: Union[bytes, Union[bytearray, memoryview, Sequence[Any], "mmap", "_CData"]]) -> int:
raise NotImplementedError("this stream is not writable")

def writelines(self, lines: Iterable[AnyStr]) -> None:
def writelines(
self,
data: Iterable[Union[bytes, Union[bytearray, memoryview, Sequence[Any], "mmap", "_CData"]]],
) -> None:
raise NotImplementedError("this stream is not writable")
54 changes: 27 additions & 27 deletions poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.