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

Remove deprecated ByteString #608

Merged
merged 2 commits into from
Oct 30, 2024
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
7 changes: 3 additions & 4 deletions awscrt/eventstream/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,8 @@
# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
# SPDX-License-Identifier: Apache-2.0.

from collections.abc import ByteString
from enum import IntEnum
from typing import Any
from typing import Any, Union
from uuid import UUID

__all__ = ['HeaderType', 'Header']
Expand Down Expand Up @@ -135,7 +134,7 @@ def from_int64(cls, name: str, value: int) -> 'Header':
return cls(name, value, HeaderType.INT64)

@classmethod
def from_byte_buf(cls, name: str, value: ByteString) -> 'Header':
def from_byte_buf(cls, name: str, value: Union[bytes, bytearray]) -> 'Header':
"""Create a Header of type :attr:`~HeaderType.BYTE_BUF`

The value must be a bytes-like object"""
Expand Down Expand Up @@ -246,7 +245,7 @@ def value_as_int64(self) -> int:
Raises an exception if type is not :attr:`~HeaderType.INT64`"""
return self._value_as(HeaderType.INT64)

def value_as_byte_buf(self) -> ByteString:
def value_as_byte_buf(self) -> Union[bytes, bytearray]:
"""Return value of bytes

Raises an exception if type is not :attr:`~HeaderType.BYTE_BUF`"""
Expand Down
10 changes: 5 additions & 5 deletions awscrt/eventstream/rpc.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,11 @@
import awscrt.exceptions
from awscrt.eventstream import Header
from awscrt.io import ClientBootstrap, SocketOptions, TlsConnectionOptions
from collections.abc import ByteString, Callable
from collections.abc import Callable
from concurrent.futures import Future
from enum import IntEnum
from functools import partial
from typing import Optional, Sequence
from typing import Optional, Sequence, Union

__all__ = [
'MessageType',
Expand Down Expand Up @@ -381,7 +381,7 @@ def send_protocol_message(
self,
*,
headers: Optional[Sequence[Header]] = None,
payload: Optional[ByteString] = None,
payload: Optional[Union[bytes, bytearray]] = None,
message_type: MessageType,
flags: Optional[int] = None,
on_flush: Callable = None) -> 'concurrent.futures.Future':
Expand Down Expand Up @@ -483,7 +483,7 @@ def activate(
*,
operation: str,
headers: Sequence[Header] = None,
payload: ByteString = None,
payload: Union[bytes, bytearray] = None,
message_type: MessageType,
flags: int = None,
on_flush: Callable = None):
Expand Down Expand Up @@ -553,7 +553,7 @@ def send_message(
self,
*,
headers: Sequence[Header] = None,
payload: ByteString = None,
payload: Union[bytes, bytearray] = None,
message_type: MessageType,
flags: int = None,
on_flush: Callable = None) -> 'concurrent.futures.Future':
Expand Down
Loading