-
Notifications
You must be signed in to change notification settings - Fork 233
fix: better generic support in document array stack #1147
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
Conversation
Signed-off-by: samsja <[email protected]>
Signed-off-by: samsja <[email protected]>
Signed-off-by: samsja <[email protected]>
Signed-off-by: samsja <[email protected]>
Signed-off-by: samsja <[email protected]>
Signed-off-by: samsja <[email protected]>
📝 Docs are deployed on https://ft-fix-generic--jina-docs.netlify.app 🎉 |
def __class_getitem__(cls, item: Type[BaseDocument]): | ||
def __class_getitem__(cls, item: Union[Type[BaseDocument], TypeVar, str]): | ||
if not isinstance(item, type): | ||
return Generic.__class_getitem__.__func__(cls, item) # type: ignore |
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 did you know this is what is required?
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.
is this even doing anything?
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.
is this even doing anything?
this is not doing anything else than checking the the item
is valid Generic. I think it does not harm to keep it
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.
is this even doing anything?
this is not doing anything else than checking the the
item
is valid Generic. I think it does not harm to keep it
Crashed in Python 3.12.0
return Generic.__class_getitem__.__func__(cls, item) # type: ignore
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AttributeError: 'builtin_function_or_method' object has no attribute '__func__'. Did you mean: '__doc__'?
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.
Tried with pydantic generic model. Seems to work
Signed-off-by: 954 <[email protected]>
Signed-off-by: 954 <[email protected]> fix: judge based on Python version Signed-off-by: 954 <[email protected]> fix: format for black Signed-off-by: 954 <[email protected]>
Signed-off-by: 954 <[email protected]>
Signed-off-by: 954 <[email protected]>
Signed-off-by: 954 <[email protected]>
Context
Make AbstractArray a generic compatbile with type var and string
fix this : #1146
this work now