-
Notifications
You must be signed in to change notification settings - Fork 10
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
ExperimentAxisQuery uses the thread pool from ContextBase #184
Changes from 1 commit
64f5043
35db360
dd49428
74e750e
4d40250
56ec49a
ed19b02
82782c0
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,6 +6,7 @@ | |
""" | ||
|
||
import sys | ||
from concurrent import futures | ||
from typing import TYPE_CHECKING, NoReturn, Optional, Sequence, Type, TypeVar | ||
|
||
from typing_extensions import Protocol, TypeGuard | ||
|
@@ -75,3 +76,12 @@ def is_slice_of(__obj: object, __typ: Type[_T]) -> TypeGuard[Slice[_T]]: | |
and (__obj.stop is None or isinstance(__obj.stop, __typ)) | ||
and (__obj.step is None or isinstance(__obj.step, __typ)) | ||
) | ||
|
||
|
||
class ContextBase(Protocol): | ||
"""A protocol for a context manager that can be used as a base class. | ||
|
||
The only requirement for somacore is that it should contain a threadpool. | ||
""" | ||
|
||
_threadpool: futures.ThreadPoolExecutor | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm a bit confused which values are required and which are optional (aka could be None). As coded in query.py, it appears that all objects must have a context, but a context may optionally have a threadpool. I.e., _threadpool may equal to None. But this code declares the type as non-optional. Suggest clarifying what is optional and what is required, and having the types and tests match. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Good call, I switched the context to be |
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.
the Experiment-ish protocol types _threadpool as a required value, i.e., won't be None. Which is correct?
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.
See comment above - I put all of them as
Optional
.