Skip to content

Conversation

@JoanFM
Copy link
Member

@JoanFM JoanFM commented Feb 2, 2023

Goals:

Implement reduce methods in utils

Joan Fontanals Martinez added 4 commits February 1, 2023 19:08
Signed-off-by: Joan Fontanals Martinez <[email protected]>
Signed-off-by: Joan Fontanals Martinez <[email protected]>
Signed-off-by: Joan Fontanals Martinez <[email protected]>
Signed-off-by: Joan Fontanals Martinez <[email protected]>
Signed-off-by: Joan Fontanals Martinez <[email protected]>
Signed-off-by: Joan Fontanals Martinez <[email protected]>
@JoanFM JoanFM changed the title feat: Implement reduce methods in utils feat: reduce and update methods for docarray and document Feb 3, 2023
@JoanFM JoanFM changed the title feat: reduce and update methods for docarray and document feat: reduce and update methods for DocumentArray and BaseDocument Feb 3, 2023
@JoanFM JoanFM requested a review from samsja February 3, 2023 11:46
Comment on lines 130 to 133
elif (
isinstance(field_type, _GenericAlias)
and field_type.__origin__ is list
):
Copy link
Member

@samsja samsja Feb 3, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am wondering if this will work with newer python version where you can pass list instead of List as a valid type hint ?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what Python version are u referring to?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

in python 3.9 you can do

class A:
   b: list[inŧ]

instead of

class A:
   b: List[int]

I am almost sure they have maintain compatibility with older version but the fact that we are using a private object from the typing library tell me that we are not 100% sure we will support this new way.

Maybe there is a way not to use the _GenericAlias since it is private ?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh actually we can use

from typing_inspect import is_generic_type

we already rely on this library for some type hint things and they make sure that their function are compatible with every python version

https://github.com/ilevkivskyi/typing_inspect

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can u propose a PR on top of mine to do this? I am not sure what u are intending to tell. I did trial and error until I found the working formula

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I pushed a commit

Signed-off-by: samsja <[email protected]>
@JoanFM JoanFM requested a review from samsja February 6, 2023 09:12
@github-actions
Copy link

github-actions bot commented Feb 6, 2023

📝 Docs are deployed on https://ft-feat-reduce-v2--jina-docs.netlify.app 🎉

@JoanFM JoanFM merged commit 149ee5e into feat-rewrite-v2 Feb 6, 2023
@JoanFM JoanFM deleted the feat-reduce-v2 branch February 6, 2023 09:48
@samsja samsja mentioned this pull request Feb 6, 2023
47 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants