Skip to content

Default to None rather than empty string #25

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

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions src/genie_python/genie.py
Original file line number Diff line number Diff line change
Expand Up @@ -789,9 +789,9 @@ def connected_pvs_in_list(pv_list: list[str], is_local: bool = False) -> list[st
def begin(
period: int = 1,
meas_id: str | None = None,
meas_type: str = "",
meas_subid: str = "",
sample_id: str = "",
meas_type: str | None = None,
meas_subid: str | None = None,
sample_id: str | None = None,
delayed: bool = False,
quiet: bool = False,
paused: bool = False,
Expand Down
14 changes: 12 additions & 2 deletions src/genie_python/genie_epics_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,8 @@ def __init__(
self.motion_suffix = "CS:MOT:MOVING"
self.pre_post_cmd_manager = PrePostCmdManager()
self.logger = GenieLogger()
self._sample_par_names_cache = None
self._beamline_par_names_cache = None

if environment_details is None:
self._environment_details = EnvironmentDetails()
Expand Down Expand Up @@ -624,7 +626,11 @@ def set_sample_par(self, name: str, value: "PVValue") -> None:
name: the name of the parameter to change
value: the new value
"""
names = self.blockserver.get_sample_par_names()
try:
names = self.blockserver.get_sample_par_names()
self._sample_par_names_cache = names
except Exception:
names = self._sample_par_names_cache
if names is not None:
for n in names:
m = re.match(".+:SAMPLE:%s" % name.upper(), n)
Expand All @@ -648,7 +654,11 @@ def set_beamline_par(self, name: str, value: "PVValue") -> None:
name: the name of the parameter to change
value: the new value
"""
names = self.blockserver.get_beamline_par_names()
try:
names = self.blockserver.get_beamline_par_names()
self._beamline_par_names_cache = names
except Exception:
names = self._beamline_par_names_cache
if names is not None:
for n in names:
m = re.match(".+:BL:%s" % name.upper(), n)
Expand Down