Skip to content
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

Discussion: Should children automaticaly traverse more of the object #52

Closed
DominicOram opened this issue Nov 1, 2023 · 3 comments
Closed

Comments

@DominicOram
Copy link
Contributor

Currently the children function on a device checks if the Device has any direct attributes that are Devices. This results in the following:

class MyDevice(Device):
    def __init__():
        self.channels = [epics_signal_r(float, f"A"), epics_signal_r(float, f"B")]

my_device.connect() # channels will not get connected here

The fix for this is something like:

class MyDevice(Device):
    def __init__():
        self.channels = [epics_signal_r(float, f"A"), epics_signal_r(float, f"B")]
   def children():
       for signal in self.channels:
           yield signal
       return super().children()

@coretl, @callumforrester - I feel like we may have discussed this already but needs writing down

Acceptance Criteria

  • We decide if children should be more clever
  • Decision and reasoning is documented
  • If the above behaviour remains it should be documented as a gotcha
@coretl
Copy link
Collaborator

coretl commented Nov 2, 2023

If you use a DeviceVector (and please write docs for it too!) then this will work

@DominicOram DominicOram changed the title Discussion: Should children automaticaaly traverse more of the object Discussion: Should children automaticaly traverse more of the object Nov 2, 2023
@callumforrester
Copy link
Contributor

Docs for DeviceVector in #183

@DominicOram does it satisfy your requirements?

@DominicOram
Copy link
Contributor Author

Yes, happy to close this off

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants