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

Convert Lists to sets and update ruff command #78

Merged
merged 2 commits into from
Jul 10, 2024
Merged

Convert Lists to sets and update ruff command #78

merged 2 commits into from
Jul 10, 2024

Conversation

keithralphs
Copy link
Contributor

Change function params which actually should be Sets (e.g. selction of detector) to Sets rather than Lists as the currently are. THis makes the JSONSchema for plans produced by BlueAPI more accurate. Also update ruff command from ruff to ruff check

Copy link
Contributor

@DiamondJoseph DiamondJoseph left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not all the changes are required here, but they don't hurt either way as we're just treating like collections in any case

src/i22_bluesky/plans/linkam.py Outdated Show resolved Hide resolved
@@ -206,7 +204,7 @@ def stopflow(

stream_name = "main"
flyer = HardwareTriggeredFlyable(StaticSeqTableTriggerLogic(panda.seq[1]))
devices = [flyer] + detectors + [panda] + baseline
devices = {flyer} | detectors | {panda} | baseline
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
devices = {flyer} | detectors | {panda} | baseline
devices = {flyer, panda} | detectors | baseline

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

Comment on lines 216 to 217
"detectors": {repr(device) for device in detectors},
"baseline": {repr(device) for device in baseline},
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this should become {device.name for ..., as the repr for the devices is unuseful and with the device references the name is closer to referencing what we're actually using.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

changed to device.name + ":" + repr(device) for ... as discussed.

src/i22_bluesky/plans/stopflow.py Outdated Show resolved Hide resolved
@@ -1,5 +1,6 @@
import os
from pathlib import Path
from typing import Set
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use set

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok

@@ -1,4 +1,5 @@
import asyncio
from typing import Set
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

set

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok

Copy link
Contributor

@DiamondJoseph DiamondJoseph left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

one potential nit, but I'm happy to make the f-string change it's own thing later on

Comment on lines +215 to +217
"panda": panda.name + ":" + repr(panda),
"detectors": {device.name + ":" + repr(device) for device in detectors},
"baseline": {device.name + ":" + repr(device) for device in baseline},
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
"panda": panda.name + ":" + repr(panda),
"detectors": {device.name + ":" + repr(device) for device in detectors},
"baseline": {device.name + ":" + repr(device) for device in baseline},
"panda": f"{panda.name}: {repr(panda)}",
"detectors": f"{detector.name}: {repr(detector)}" for detector in detectors},
"baseline": f"{device.name}: {repr(device)}" for device in baseline},

@DiamondJoseph DiamondJoseph marked this pull request as ready for review July 10, 2024 11:56
@DiamondJoseph DiamondJoseph added this pull request to the merge queue Jul 10, 2024
Merged via the queue into main with commit ae1cb1b Jul 10, 2024
13 checks passed
@DiamondJoseph DiamondJoseph deleted the sets branch July 10, 2024 12:00
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

Successfully merging this pull request may close these issues.

2 participants