You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
implement type narrowing all the way down to the lowest agent and policy level, through the use of generics
right now policies are typed as only a very high-level NoPolicy | BasePolicy which isn't useful at all
The text was updated successfully, but these errors were encountered:
here's an example of where the type narrowing is not correct
This type is incorrect, which means I can't auto-complete any of the random_hold_policy functions or discover the arguments.
and another for config:
these should be random hold policy & random hold policy config, which would have correct autocomplete.
I have a TODO in base.py:
# TODO: We add this as a helper property so that subclasses can access the config without# overwriting the __init__ function. The downside is that users of this member variable# can't be type checked. There's probably a way to do this with generics instead of Any.
This hints that the solution is to use Generics, which I still think is correct. We need to revamp IHyperdrive to also use generics for this all to work.
The meta issue is that the python type system is fine with you narrowing the type to a base class, which removes all the metadata and content. So while it's not returning any type errors, it is not the behavior we want.
implement type narrowing all the way down to the lowest agent and policy level, through the use of generics
right now policies are typed as only a very high-level
NoPolicy | BasePolicy
which isn't useful at allThe text was updated successfully, but these errors were encountered: