-
Notifications
You must be signed in to change notification settings - Fork 0
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
DM-45744 Implement ATBuilding CSC +790-148 #3
Conversation
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.
Here is an initial round of comments.
General comment:
Please, document all the assertion Errors that can happen with the inclusion assert self.connected
.
.pre-commit-config.yaml
Outdated
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.
Please, don't commit the .pre-commit-config.yaml
file. This should be generated by generate_pre_commit_conf
from ts-pre-commit-config
package.
from .dispatcher import Dispatcher | ||
|
||
__all__ = ["__version__", "Config", "Controller", "Dispatcher"] |
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.
We usually don't have this __all__`` definition here in the
init` file.
@@ -22,33 +22,49 @@ | |||
import logging | |||
from enum import IntEnum | |||
|
|||
import megaind | |||
try: | |||
import megaind |
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 missed the inclusion of this package dependency. I don't think this is part of our stack. Do you really need it?
Usually, adding new package dependencies require approval by myself and/or Wouter. We should discuss this.
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 think it's necessary as a part of the hardware controlling the vents - the Sequent Microsystems Industrial Automation Hat.
|
||
__all__ = ["Controller"] | ||
__all__ = ["Controller", "VentGateState"] | ||
|
||
|
||
class VentGateState(IntEnum): |
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.
Should this be in ts-xml?
FAULT = -1 | ||
|
||
|
||
class FanDriveState(IntEnum): |
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.
Shouldn't this be in ts-xml?
raise ModuleNotFoundError("The megaind module is not available.") | ||
return megaind.getOptoCh(*args, **kwargs) | ||
|
||
def setOd(self, *args, **kwargs) -> None: |
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.
Methods should be snake_case
but, same as above, we need to talk about the use of megaind
.
return value.lower() in ("true", "t", "1") | ||
if value.lower() in ("true", "t", "1"): | ||
return True | ||
if value.lower() in ("false", "f", "0"): |
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.
should this be elif
instead?
return True | ||
if value.lower() in ("false", "f", "0"): | ||
return False | ||
raise ValueError(f"Expected bool value but got {value}") |
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.
Maybe document what are the valid values for conversion to bool?
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.
Consider renaming this dome_vents_simulator.py
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.
Forgot to mark "request changes"
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 have a few additional comments I hope you will take into account but otherwise this looks good! thanks for the updates!
async def get_drive_state(self) -> FanDriveState: | ||
"""Returns the current fan drive state based on the contents | ||
of the IPAE register. | ||
|
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.
Please use the numpy docs style.
This should be something like:
Returns
--------
`FanDriveState`
Current fan drive state.
You don't need to document all the values as that should be in the enumeration.
def get_opto_ch(self, *args, **kwargs) -> int: | ||
"""Calls hardware I/O or a simulated substitute depending | ||
whether the class was instantiated with simulate = True. | ||
|
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.
Please, document input arguments and return values (use numpy docs style).
def set_od(self, *args, **kwargs) -> None: | ||
"""Calls harware I/O or a simulated substitute depending | ||
whether the class was instantiated with simulate = True. | ||
|
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.
Please, document input args.
@@ -27,7 +49,15 @@ def _cast_string_to_type(new_type: type, value: str): | |||
""" |
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.
Please document return value
No description provided.