Skip to content

Commit 14e5c3d

Browse files
committed
appease pyright (for now...)
1 parent 05d2ffb commit 14e5c3d

File tree

5 files changed

+9
-8
lines changed

5 files changed

+9
-8
lines changed

packages/smithy-core/src/smithy_core/aio/types.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,14 +46,14 @@ async def read(self, size: int = -1) -> bytes:
4646
if self._closed or not self._data:
4747
raise ValueError("I/O operation on closed file.")
4848

49-
if isinstance(self._data, BytesReader) and not iscoroutinefunction(
49+
if isinstance(self._data, BytesReader) and not iscoroutinefunction( # type: ignore - TODO(pyright)
5050
self._data.read
5151
):
5252
# Python's runtime_checkable can't actually tell the difference between
5353
# sync and async, so we have to check ourselves.
5454
return self._data.read(size)
5555

56-
if isinstance(self._data, AsyncByteStream):
56+
if isinstance(self._data, AsyncByteStream): # type: ignore - TODO(pyright)
5757
return await self._data.read(size)
5858

5959
return await self._read_from_iterable(
@@ -135,7 +135,7 @@ def __init__(self, data: StreamingBlob):
135135
if isinstance(data, bytes | bytearray):
136136
self._buffer = BytesIO(data)
137137
self._data_source = None
138-
elif isinstance(data, AsyncByteStream) and iscoroutinefunction(data.read):
138+
elif isinstance(data, AsyncByteStream) and iscoroutinefunction(data.read): # type: ignore - TODO(pyright)
139139
# Note that we need that iscoroutine check because python won't actually check
140140
# whether or not the read function is async.
141141
self._buffer = BytesIO()

packages/smithy-core/src/smithy_core/schemas.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -162,10 +162,10 @@ def collection(
162162
def member(
163163
cls,
164164
id: ShapeID,
165-
target: Self,
165+
target: "Schema",
166166
index: int,
167167
member_traits: list["Trait"] | None = None,
168-
) -> Self:
168+
) -> "Schema":
169169
"""Create a schema for a member shape.
170170
171171
Member schemas are largely copies of the schemas they target to make it easier

packages/smithy-http/src/smithy_http/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ def __init__(
113113
f"{', '.join(non_unique_names)}."
114114
)
115115
init_tuples = zip(init_field_names, init_fields)
116-
self.entries: OrderedDict[str, interfaces.Field] = OrderedDict(init_tuples)
116+
self.entries: dict[str, interfaces.Field] = OrderedDict(init_tuples)
117117
self.encoding: str = encoding
118118

119119
def set_field(self, field: interfaces.Field) -> None:

packages/smithy-http/src/smithy_http/interfaces/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ class Fields(Protocol):
7272

7373
# Entries are keyed off the name of a provided Field
7474
entries: dict[str, Field]
75-
encoding: str | None = "utf-8"
75+
encoding: str = "utf-8"
7676

7777
def set_field(self, field: Field) -> None:
7878
"""Alias for __setitem__ to utilize the field.name for the entry key."""

packages/smithy-http/tests/integration/aio/conftest.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,10 @@ def sample_request() -> HTTPRequest:
1717
Field(name="user-agent", values=["smithy-python-test"]),
1818
]
1919
)
20+
b: list[bytes] = []
2021
return HTTPRequest(
2122
method="GET",
2223
destination=URI(host="aws.amazon.com"),
2324
fields=headers,
24-
body=async_list([]),
25+
body=async_list(b),
2526
)

0 commit comments

Comments
 (0)