Skip to content
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
4 changes: 2 additions & 2 deletions examples/browser-use-demo/exercise.py
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,7 @@ async def hold_verified(*, cancelled: Callable[[], bool] | None = None) -> None:
await asyncio.wait_for(release.wait(), timeout=5)
await original_capture(cancelled=cancelled)

current.capture = hold_verified # ty: ignore[invalid-assignment] # Test replaces a callable with a controlled fixture.
current.capture = hold_verified # Test replaces a callable with a controlled fixture.
try:
await post("/api/approval", {**binding(offered), "approvalId": offered["approval"]["id"], "approved": True})
await asyncio.wait_for(entered.wait(), timeout=5)
Expand Down Expand Up @@ -277,7 +277,7 @@ async def hold_verified(*, cancelled: Callable[[], bool] | None = None) -> None:
assert stopped["result"] == "unverified", "The old agent result survived human editing and Stop"
finally:
release.set()
current.capture = original_capture # ty: ignore[invalid-assignment] # Test replaces a callable with a controlled fixture.
current.capture = original_capture # Test replaces a callable with a controlled fixture.
await post("/api/start", {"taskId": "reservation", "api": "decisions", "mode": "rehearsal"})
offered = await until(lambda s: s["approval"] is not None)
await post("/api/take-control", binding(offered))
Expand Down
10 changes: 5 additions & 5 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -56,15 +56,15 @@ vertex = ["google-auth[requests]>=2.36,<3"]

[dependency-groups]
dev = [
"ty==0.0.95",
"ty==0.0.100",
"pytest>=9.0.3",
"pytest-asyncio>=1.4.0",
"Pillow==12.3.0",
"ruff",
"rich>=13.7.1",
"inline-snapshot>=0.28.0",
"azure-identity >=1.14.1",
"botocore==1.43.123",
"botocore==1.43.127",
"pandas-stubs >= 1.1.0.11",
"trio >=0.22.2",
"pytest-xdist>=3.6.1",
Expand All @@ -74,8 +74,8 @@ dev = [
pydantic-v1 = ["pydantic>=1.10.26,<2"]
pydantic-v2 = ["pydantic>=2,<3"]
provider-computer = ["Pillow==12.3.0"]
provider-browser = ["playwright==1.64.1"]
browser-demo = ["playwright==1.64.1"]
provider-browser = ["playwright==1.65.0"]
browser-demo = ["playwright==1.65.0"]
# Isolated build requirements are exported with hashes by scripts/build.
build = [
"hatchling==1.33.0",
Expand Down Expand Up @@ -202,7 +202,7 @@ include = [
[tool.ty.overrides.rules]
# These Pydantic models and HTTP exceptions intentionally narrow mutable fields.
# Preserve their existing contract without suppressing unrelated overrides.
invalid-mutable-override = "ignore"
incompatible-mutable-override = "ignore"

[[tool.ty.overrides]]
include = [
Expand Down
4 changes: 2 additions & 2 deletions src/openai/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -231,8 +231,8 @@ def api_key(self) -> str | None:
return api_key

@api_key.setter
def api_key(self, value: str | None) -> None: # ty: ignore[invalid-property-type-override]
global api_key # ty: ignore[invalid-property-type-override]
def api_key(self, value: str | None) -> None: # ty: ignore[incompatible-property-override]
global api_key # ty: ignore[incompatible-property-override]

api_key = value

Expand Down
4 changes: 2 additions & 2 deletions src/openai/_base_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -335,7 +335,7 @@ def _set_private_attributes(
# methods should continue to work as expected as there is an alternative method
# to cast a model to a dictionary, model.dict(), which is used internally
# by pydantic.
def __iter__(self) -> Iterator[_T]: # ty: ignore[invalid-method-override]
def __iter__(self) -> Iterator[_T]: # ty: ignore[incompatible-method-override]
for page in self.iter_pages():
for item in page._get_page_items():
yield item
Expand Down Expand Up @@ -2211,7 +2211,7 @@ def make_request_options(

if is_given(post_parser):
# Internal request hook deliberately omitted from the public RequestOptions type.
options["post_parser"] = post_parser # ty: ignore[invalid-key]
options["post_parser"] = post_parser # ty: ignore[invalid-typed-dict-key]

if security is not None:
options["security"] = security
Expand Down
2 changes: 1 addition & 1 deletion src/openai/_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -1017,7 +1017,7 @@ def _strip_raw_response_header(self) -> None:

# type ignore required because we're adding explicit types to `**values`
@classmethod
def construct( # ty: ignore[invalid-method-override]
def construct( # ty: ignore[incompatible-method-override]
cls,
_fields_set: set[str] | None = None,
**values: Unpack[FinalRequestOptionsInput],
Expand Down
2 changes: 1 addition & 1 deletion src/openai/_utils/_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -269,7 +269,7 @@ def wrapper(*args: object, **kwargs: object) -> object:
given_params.add(positional[i])
except IndexError:
raise TypeError(
f"{func.__name__}() takes {len(positional)} argument(s) but {len(args)} were given" # ty: ignore[unresolved-attribute]
f"{func.__name__}() takes {len(positional)} argument(s) but {len(args)} were given" # ty: ignore[missing-attribute]
) from None

for key in kwargs.keys():
Expand Down
2 changes: 1 addition & 1 deletion src/openai/lib/beta/agents/_tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -330,7 +330,7 @@ async def invoke_async(arguments: pydantic.BaseModel) -> object:
return pydantic_function_tool(
model,
handler=invoke_async if inspect.iscoroutinefunction(function) else invoke,
name=function.__name__ if name is None else name, # ty: ignore[unresolved-attribute]
name=function.__name__ if name is None else name, # ty: ignore[missing-attribute]
description=(inspect.getdoc(function) or "") if description is None else description,
defer_loading=defer_loading,
)
5 changes: 1 addition & 4 deletions src/openai/lib/realtime_translation.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,10 +78,7 @@ def _parse(data: str | bytes) -> RealtimeTranslationServerEvent:
# forward-compatible parsing, including unknown server events, elsewhere.
if is_dict(value) and value.get("type") == "session.closed":
return validate_type(type_=RealtimeTranslationSessionClosedEvent, value=value)
return cast(
RealtimeTranslationServerEvent,
construct_type_unchecked(value=value, type_=cast(Any, RealtimeTranslationServerEvent)),
)
return construct_type_unchecked(value=value, type_=cast(Any, RealtimeTranslationServerEvent))


class TranslationConnection:
Expand Down
2 changes: 1 addition & 1 deletion src/openai/lib/streaming/chat/_completions.py
Original file line number Diff line number Diff line change
Expand Up @@ -662,7 +662,7 @@ def _content_done_events(

events_to_fire.append(
build(
ContentDoneEvent,
cast("type[ContentDoneEvent[ResponseFormatT]]", ContentDoneEvent),
type="content.done",
content=choice_snapshot.message.content,
parsed=parsed,
Expand Down
2 changes: 1 addition & 1 deletion src/openai/lib/streaming/responses/_responses.py
Original file line number Diff line number Diff line change
Expand Up @@ -362,7 +362,7 @@ def handle_event(self, event: RawResponseStreamEvent) -> List[ResponseStreamEven

events.append(
build(
ResponseCompletedEvent,
cast("type[ResponseCompletedEvent[TextFormatT]]", ResponseCompletedEvent),
sequence_number=event.sequence_number,
type="response.completed",
response=response,
Expand Down
Loading
Loading