Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
f1d74e2
feat(api): api update (#71)
stainless-app[bot] Mar 31, 2025
4e2d3a4
codegen metadata
stainless-app[bot] Apr 3, 2025
75e43a9
chore(internal): remove trailing character (#73)
stainless-app[bot] Apr 4, 2025
9808a93
chore(internal): slight transform perf improvement (#74)
stainless-app[bot] Apr 9, 2025
064117a
chore(internal): expand CI branch coverage
stainless-app[bot] Apr 10, 2025
e0381ae
chore(internal): reduce CI branch coverage
stainless-app[bot] Apr 10, 2025
62cf11f
fix(perf): skip traversing types for NotGiven values
stainless-app[bot] Apr 12, 2025
2130460
fix(perf): optimize some hot paths
stainless-app[bot] Apr 12, 2025
ccd70c6
chore(internal): update pyright settings
stainless-app[bot] Apr 15, 2025
024b925
chore(client): minor internal fixes
stainless-app[bot] Apr 15, 2025
730f781
chore(internal): bump pyright version
stainless-app[bot] Apr 17, 2025
bd85924
chore(internal): base client updates
stainless-app[bot] Apr 17, 2025
02396c5
chore(internal): update models test
stainless-app[bot] Apr 19, 2025
e3ab35a
chore(ci): add timeout thresholds for CI jobs
stainless-app[bot] Apr 23, 2025
0541854
chore(internal): import reformatting
stainless-app[bot] Apr 23, 2025
4ac36d0
chore(internal): fix list file params
stainless-app[bot] Apr 23, 2025
85d0556
chore(internal): refactor retries to not use recursion
stainless-app[bot] Apr 23, 2025
c9e8911
fix(pydantic v1): more robust ModelField.annotation check
stainless-app[bot] Apr 23, 2025
0ef9e84
chore(internal): minor formatting changes
stainless-app[bot] Apr 24, 2025
a5c88eb
chore(internal): codegen related update
stainless-app[bot] Apr 24, 2025
efaf732
chore(ci): only use depot for staging repos
stainless-app[bot] Apr 24, 2025
893312b
chore: broadly detect json family of content-type headers
stainless-app[bot] Apr 24, 2025
b109cd3
chore(internal): avoid errors for isinstance checks on proxies
stainless-app[bot] May 9, 2025
db3beee
fix(package): support direct resource imports
stainless-app[bot] May 10, 2025
6ee22ad
chore(ci): upload sdks to package manager
stainless-app[bot] May 15, 2025
1edfc67
chore(ci): fix installation instructions
stainless-app[bot] May 16, 2025
60b41d0
chore(docs): grammar improvements
stainless-app[bot] May 22, 2025
64cfb26
release: 2.9.0
stainless-app[bot] Aug 2, 2025
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
Prev Previous commit
Next Next commit
fix(perf): optimize some hot paths
  • Loading branch information
stainless-app[bot] committed Apr 12, 2025
commit 21304602461229683e8e63f72e0122550b05a618
14 changes: 13 additions & 1 deletion src/evrim/_utils/_transform.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,15 @@
import pathlib
from typing import Any, Mapping, TypeVar, cast
from datetime import date, datetime
from typing_extensions import Literal, get_args, override, get_type_hints
from typing_extensions import Literal, get_args, override, get_type_hints as _get_type_hints

import anyio
import pydantic

from ._utils import (
is_list,
is_given,
lru_cache,
is_mapping,
is_iterable,
)
Expand Down Expand Up @@ -109,6 +110,7 @@ class Params(TypedDict, total=False):
return cast(_T, transformed)


@lru_cache(maxsize=8096)
def _get_annotated_type(type_: type) -> type | None:
"""If the given type is an `Annotated` type then it is returned, if not `None` is returned.

Expand Down Expand Up @@ -433,3 +435,13 @@ async def _async_transform_typeddict(
else:
result[_maybe_transform_key(key, type_)] = await _async_transform_recursive(value, annotation=type_)
return result


@lru_cache(maxsize=8096)
def get_type_hints(
obj: Any,
globalns: dict[str, Any] | None = None,
localns: Mapping[str, Any] | None = None,
include_extras: bool = False,
) -> dict[str, Any]:
return _get_type_hints(obj, globalns=globalns, localns=localns, include_extras=include_extras)
2 changes: 2 additions & 0 deletions src/evrim/_utils/_typing.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
get_origin,
)

from ._utils import lru_cache
from .._types import InheritsGeneric
from .._compat import is_union as _is_union

Expand Down Expand Up @@ -66,6 +67,7 @@ def is_type_alias_type(tp: Any, /) -> TypeIs[typing_extensions.TypeAliasType]:


# Extracts T from Annotated[T, ...] or from Required[Annotated[T, ...]]
@lru_cache(maxsize=8096)
def strip_annotated_type(typ: type) -> type:
if is_required_type(typ) or is_annotated_type(typ):
return strip_annotated_type(cast(type, get_args(typ)[0]))
Expand Down