Skip to content
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 Self annotation in store self-partialing #409

Merged
merged 5 commits into from Feb 18, 2023
Merged

Use Self annotation in store self-partialing #409

merged 5 commits into from Feb 18, 2023

Conversation

rsokl
Copy link
Contributor

@rsokl rsokl commented Feb 8, 2023

A subclassed ZenStore will now return the correct type -- the subclass -- when self-partialing. This works for both pyright and mypy.

E.g.

from hydra_zen.wrapper import ZenStore

class MyStore(ZenStore):
    ...

store = MyStore()
optim_store = store(group="optim")

# Before: type checker sees `ZenStore`
# After: type checker sees `MyStore`
reveal_type(optim_store)

@rsokl rsokl added the type-checking Involves hydra_zen.typing or pyright/mypy label Feb 8, 2023
@rsokl rsokl merged commit 67f1a21 into main Feb 18, 2023
@rsokl rsokl deleted the use-self branch February 18, 2023 18:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type-checking Involves hydra_zen.typing or pyright/mypy
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant