-
Notifications
You must be signed in to change notification settings - Fork 16
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 our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Use a class for CachedMapper
-derived mappers instead of a dict
#549
Conversation
a34936a
to
378d439
Compare
1cf2454
to
df7db39
Compare
d40153c
to
e9b4ac5
Compare
c25dce2
to
7a556ad
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
pytato/transform/__init__.py
Outdated
# FIXME: Figure out the right way to type annotate these | ||
| tuple[CacheExprT, tuple[Any, ...], dict[str, Any]], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How should I annotate the args
tuple and kwargs
dict here so that it matches *args: P.args, **kwargs: P.kwargs
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
a60b0f3
to
387bafb
Compare
pytato/transform/__init__.py
Outdated
# FIXME: Figure out the right way to type annotate these | ||
| tuple[CacheExprT, tuple[Any, ...], dict[str, Any]], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
40b2a64
to
9cbe7f4
Compare
8546893
to
233c8e7
Compare
233c8e7
to
530f7e1
Compare
Probably good for another look now. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🎉
self, | ||
key_inputs: | ||
CacheExprT | ||
| tuple[CacheExprT, tuple[Any, ...], dict[str, Any]], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Link to the P
-in-containers discussion to justify the Any
s.
Adds classes to represent the caches of
CachedMapper
-derived mappers, which will be useful for adding array duplication checks and result deduplication (#550). Both of these features add additional cache dictionaries and cache retrieval/addition logic; this change minimizes the amount of logic that must be duplicated when mappers overriderec
, as well as minimizes the extra arguments that need to be passed around for function caches when cloning new mappers.Depends on #531(merged).