Skip to content

Commit c982599

Browse files
fixed other imports
1 parent 359738d commit c982599

File tree

9 files changed

+47
-18
lines changed

9 files changed

+47
-18
lines changed

python/packages/ag-ui/agent_framework_ag_ui_examples/agents/ui_generator_agent.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,9 @@
99
from agent_framework.ag_ui import AgentFrameworkAgent
1010

1111
if sys.version_info >= (3, 13):
12-
from typing import TypeVar
12+
from typing import TypeVar # type: ignore # pragma: no cover
1313
else:
14-
from typing_extensions import TypeVar
14+
from typing_extensions import TypeVar # type: ignore # pragma: no cover
1515

1616
# Declaration-only tools (func=None) - actual rendering happens on the client side
1717
generate_haiku = AIFunction[Any, str](

python/packages/azure-ai/agent_framework_azure_ai/_chat_client.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
import re
77
import sys
88
from collections.abc import AsyncIterable, Mapping, MutableMapping, MutableSequence, Sequence
9-
from typing import Any, ClassVar, Generic, TypedDict, TypeVar
9+
from typing import Any, ClassVar, Generic, TypedDict
1010

1111
from agent_framework import (
1212
AGENT_FRAMEWORK_USER_AGENT,
@@ -94,11 +94,14 @@
9494

9595
from ._shared import AzureAISettings
9696

97+
if sys.version_info >= (3, 13):
98+
from typing import TypeVar # type: ignore # pragma: no cover
99+
else:
100+
from typing_extensions import TypeVar # type: ignore # pragma: no cover
97101
if sys.version_info >= (3, 12):
98102
from typing import override # type: ignore # pragma: no cover
99103
else:
100104
from typing_extensions import override # type: ignore[import] # pragma: no cover
101-
102105
if sys.version_info >= (3, 11):
103106
from typing import Self # pragma: no cover
104107
else:

python/packages/azure-ai/agent_framework_azure_ai/_client.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
import sys
44
from collections.abc import Mapping, MutableSequence
5-
from typing import TYPE_CHECKING, Any, ClassVar, Generic, TypeVar, cast
5+
from typing import TYPE_CHECKING, Any, ClassVar, Generic, TypedDict, cast
66

77
from agent_framework import (
88
AGENT_FRAMEWORK_USER_AGENT,
@@ -34,13 +34,14 @@
3434
if TYPE_CHECKING:
3535
from agent_framework.openai import OpenAIResponsesOptions
3636

37-
from typing import TypedDict
38-
37+
if sys.version_info >= (3, 13):
38+
from typing import TypeVar # type: ignore # pragma: no cover
39+
else:
40+
from typing_extensions import TypeVar # type: ignore # pragma: no cover
3941
if sys.version_info >= (3, 12):
4042
from typing import override # type: ignore # pragma: no cover
4143
else:
4244
from typing_extensions import override # type: ignore[import] # pragma: no cover
43-
4445
if sys.version_info >= (3, 11):
4546
from typing import Self # pragma: no cover
4647
else:

python/packages/core/agent_framework/azure/_assistants_client.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
# Copyright (c) Microsoft. All rights reserved.
22

3+
import sys
34
from collections.abc import Mapping
4-
from typing import TYPE_CHECKING, Any, ClassVar, Generic, TypeVar
5+
from typing import TYPE_CHECKING, Any, ClassVar, Generic
56

67
from openai.lib.azure import AsyncAzureADTokenProvider, AsyncAzureOpenAI
78
from pydantic import ValidationError
@@ -14,6 +15,11 @@
1415
if TYPE_CHECKING:
1516
from azure.core.credentials import TokenCredential
1617

18+
if sys.version_info >= (3, 13):
19+
from typing import TypeVar # type: ignore # pragma: no cover
20+
else:
21+
from typing_extensions import TypeVar # type: ignore # pragma: no cover
22+
1723
from typing import TypedDict
1824

1925
__all__ = ["AzureOpenAIAssistantsClient"]

python/packages/core/agent_framework/azure/_chat_client.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
import logging
55
import sys
66
from collections.abc import Mapping
7-
from typing import Any, Generic, TypedDict, TypeVar
7+
from typing import Any, Generic, TypedDict
88

99
from azure.core.credentials import TokenCredential
1010
from openai.lib.azure import AsyncAzureADTokenProvider, AsyncAzureOpenAI
@@ -29,6 +29,10 @@
2929
AzureOpenAISettings,
3030
)
3131

32+
if sys.version_info >= (3, 13):
33+
from typing import TypeVar # type: ignore # pragma: no cover
34+
else:
35+
from typing_extensions import TypeVar # type: ignore # pragma: no cover
3236
if sys.version_info >= (3, 12):
3337
from typing import override # type: ignore # pragma: no cover
3438
else:

python/packages/core/agent_framework/azure/_responses_client.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
# Copyright (c) Microsoft. All rights reserved.
22

3+
import sys
34
from collections.abc import Mapping
4-
from typing import Any, Generic, TypedDict, TypeVar
5+
from typing import Any, Generic, TypedDict
56
from urllib.parse import urljoin
67

78
from azure.core.credentials import TokenCredential
@@ -21,6 +22,11 @@
2122
AzureOpenAISettings,
2223
)
2324

25+
if sys.version_info >= (3, 13):
26+
from typing import TypeVar # type: ignore # pragma: no cover
27+
else:
28+
from typing_extensions import TypeVar # type: ignore # pragma: no cover
29+
2430
__all__ = ["AzureOpenAIResponsesClient", "AzureOpenAIResponsesOptions"]
2531

2632

python/packages/core/agent_framework/openai/_responses_client.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
from collections.abc import AsyncIterable, Awaitable, Callable, Mapping, MutableMapping, MutableSequence, Sequence
55
from datetime import datetime, timezone
66
from itertools import chain
7-
from typing import Any, Generic, Literal, TypedDict, TypeVar, cast
7+
from typing import Any, Generic, Literal, TypedDict, cast
88

99
from openai import AsyncOpenAI, BadRequestError
1010
from openai.types.responses.file_search_tool_param import FileSearchToolParam
@@ -69,6 +69,10 @@
6969
from ._exceptions import OpenAIContentFilterException
7070
from ._shared import OpenAIBase, OpenAIConfigMixin, OpenAISettings
7171

72+
if sys.version_info >= (3, 13):
73+
from typing import TypeVar # type: ignore # pragma: no cover
74+
else:
75+
from typing_extensions import TypeVar # type: ignore # pragma: no cover
7276
if sys.version_info >= (3, 12):
7377
from typing import override # type: ignore # pragma: no cover
7478
else:

python/packages/foundry_local/agent_framework_foundry_local/_foundry_local_client.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
# Copyright (c) Microsoft. All rights reserved.
22

3-
from typing import Any, ClassVar, Generic, TypedDict, TypeVar
3+
import sys
4+
from typing import Any, ClassVar, Generic, TypedDict
45

56
from agent_framework import ChatOptions, use_chat_middleware, use_function_invocation
67
from agent_framework._pydantic import AFBaseSettings
@@ -11,6 +12,12 @@
1112
from foundry_local.models import DeviceType
1213
from openai import AsyncOpenAI
1314

15+
if sys.version_info >= (3, 13):
16+
from typing import TypeVar # type: ignore # pragma: no cover
17+
else:
18+
from typing_extensions import TypeVar # type: ignore # pragma: no cover
19+
20+
1421
__all__ = [
1522
"FoundryLocalChatOptions",
1623
"FoundryLocalClient",

python/packages/purview/agent_framework_purview/_models.py

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,5 @@
11
# Copyright (c) Microsoft. All rights reserved.
22

3-
"""Unified Purview model definitions and public export surface."""
4-
5-
from __future__ import annotations
6-
73
from collections.abc import Mapping, MutableMapping, Sequence
84
from datetime import datetime
95
from enum import Enum, Flag, auto
@@ -179,6 +175,8 @@ def translate_activity(activity: Activity) -> ProtectionScopeActivities:
179175
# Simple value models
180176
# --------------------------------------------------------------------------------------
181177

178+
TAliasSerializable = TypeVar("TAliasSerializable", bound="_AliasSerializable")
179+
182180

183181
class _AliasSerializable(SerializationMixin):
184182
"""Base class adding alias mapping + pydantic-compat helpers.
@@ -232,7 +230,7 @@ def model_dump_json(self, *, by_alias: bool = True, exclude_none: bool = True, *
232230
return json.dumps(self.model_dump(by_alias=by_alias, exclude_none=exclude_none, **kwargs))
233231

234232
@classmethod
235-
def model_validate(cls, value: MutableMapping[str, Any]) -> _AliasSerializable: # type: ignore[name-defined]
233+
def model_validate(cls: type[TAliasSerializable], value: MutableMapping[str, Any]) -> TAliasSerializable: # type: ignore[name-defined]
236234
return cls(**value)
237235

238236
# ------------------------------------------------------------------

0 commit comments

Comments
 (0)