-
Notifications
You must be signed in to change notification settings - Fork 232
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
feat: use literal in type hints #1827
feat: use literal in type hints #1827
Conversation
@@ -52,6 +52,10 @@ | |||
'pymilvus': '"docarray[milvus]"', | |||
} | |||
|
|||
ProtocolType = Literal[ |
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.
Followed the ALLOWED_PROTOCOLS
constant at https://github.com/docarray/docarray/blob/main/docarray/array/doc_list/io.py#L54C1-L54C1
It makes me uncomfortable to define the same information twice, so I can investigate combining the ProtocolType
and ALLOWED_PROTOCOLS
objects, even though one is a type object and the other is a set of strings.
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.
In a follow-up PR you can define ALLOWED_PROTOCOLS in relation to these types
@@ -52,6 +52,10 @@ | |||
'pymilvus': '"docarray[milvus]"', | |||
} | |||
|
|||
ProtocolType = Literal[ |
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.
In a follow-up PR you can define ALLOWED_PROTOCOLS in relation to these types
Hello @bpshaver, We need for you to sign off your commits so that we can introduce your contributions. Thanks for the great one btw |
Drats! I signed off on the last commit but not the first two. Let me see about amending the older ones. Random question: is there a config file mypy should be detecting? I run mypy on the command line and as an LSP, and I'm seeing a lot of errors related to third party libraries that I'm used to ignoring in a config file. |
…tocol` parameters Signed-off-by: Ben Shaver <benpshaver@gmail.com>
Followed the ALLOWED_PROTOCOLS constant at https://github.com/docarray/docarray/blob/main/docarray/array/doc_list/io.py#L54C1-L54C1 Signed-off-by: Ben Shaver <benpshaver@gmail.com>
…rotocolType Signed-off-by: Ben Shaver <benpshaver@gmail.com>
Signed-off-by: Ben Shaver <benpshaver@gmail.com>
7634fe0
to
61eb05f
Compare
@JoanFM Commits are now signed! |
Signed-off-by: Ben Shaver <benpshaver@gmail.com>
Signed-off-by: Ben Shaver <benpshaver@gmail.com>
Codecov ReportAttention:
Additional details and impacted files@@ Coverage Diff @@
## main #1827 +/- ##
=======================================
Coverage 85.04% 85.05%
=======================================
Files 135 135
Lines 9028 9031 +3
=======================================
+ Hits 7678 7681 +3
Misses 1350 1350
Flags with carried forward coverage won't be shown. Click here to find out more.
☔ View full report in Codecov by Sentry. |
My understanding is that this should be defined in |
Closes the immediate type issue in #1670