-
Notifications
You must be signed in to change notification settings - Fork 6
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
Resolve some nits in the codebase #708
base: main
Are you sure you want to change the base?
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #708 +/- ##
=======================================
Coverage 92.33% 92.33%
=======================================
Files 35 35
Lines 1800 1800
=======================================
Hits 1662 1662
Misses 138 138 ☔ View full report in Codecov by Sentry. |
(some of these type: ignores may need to be reinstated for #619 |
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.
I like this! Just a few small comments.
from blueapi.cli.scratch import setup_scratch | ||
from blueapi.cli.updates import CliEventRenderer |
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.
Could: If we're against relative imports as a policy, is there any way we can make the linting fail if they are present?
@@ -61,7 +60,7 @@ def find_device(self, addr: str | list[str]) -> Device | None: | |||
Find a device in this context, allows for recursive search. | |||
|
|||
Args: | |||
addr (Union[str, List[str]]): Address of the device, examples: | |||
addr (str | list[str]): Address of the device, examples: |
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.
Nit: I don't tend to bother with type annotations at all in docstrings, since I already put them in the function signatures and AFAIK that's enough for tools like autodoc.
@@ -18,7 +22,7 @@ def events(mock_stomp_client: StompClient) -> EventBusClient: | |||
|
|||
def test_context_manager_connects_and_disconnects( | |||
events: EventBusClient, | |||
mock_stomp_client: Mock, | |||
mock_stomp_client: StompClient, |
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.
Honestly I never know what to do with type annotations for mocks. If you annotated with the mocked type you get code completion for its methods but you don't get assert_called_once
et al. and vice versa.
I tend to annotate based on whether I'm using the real methods or the mock utilities more often but we should probably have a cohesive answer. I've tried using Mock(spec=ActualType)
before but vscode doesn't seem to pick that up.
No description provided.