Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Speed up type checking by caching argument inference context#19323

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
JukkaL merged 1 commit intomasterfromoptimize-arg-infer-ctx
Jun 21, 2025
Merged
Changes fromall 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
12 changes: 9 additions & 3 deletionsmypy/checkexpr.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -318,6 +318,8 @@ class ExpressionChecker(ExpressionVisitor[Type], ExpressionCheckerSharedApi):
strfrm_checker: StringFormatterChecker
plugin: Plugin

_arg_infer_context_cache: ArgumentInferContext | None

def __init__(
self,
chk: mypy.checker.TypeChecker,
Expand DownExpand Up@@ -352,6 +354,8 @@ def __init__(
self.is_callee = False
type_state.infer_polymorphic = not self.chk.options.old_type_inference

self._arg_infer_context_cache = None

def reset(self) -> None:
self.resolved_type = {}

Expand DownExpand Up@@ -2277,9 +2281,11 @@ def infer_function_type_arguments_pass2(
return callee_type, inferred_args

def argument_infer_context(self) -> ArgumentInferContext:
return ArgumentInferContext(
self.chk.named_type("typing.Mapping"), self.chk.named_type("typing.Iterable")
)
if self._arg_infer_context_cache is None:
self._arg_infer_context_cache = ArgumentInferContext(
self.chk.named_type("typing.Mapping"), self.chk.named_type("typing.Iterable")
)
return self._arg_infer_context_cache

def get_arg_infer_passes(
self,
Expand Down

[8]ページ先頭

©2009-2025 Movatter.jp