Skip to content

Commit

Permalink
Explicitly import used libs from 'util'.
Browse files Browse the repository at this point in the history
This makes the code that uses siriuspy less restricted to some
dependencies, such as pyepics, if it's only using ps_search.
  • Loading branch information
gustavosr8 committed Mar 6, 2025
1 parent 7fcf866 commit ba8acb8
Showing 1 changed file with 13 additions and 13 deletions.
26 changes: 13 additions & 13 deletions siriuspy/siriuspy/search/ps_search.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import copy as _copy
from threading import Lock as _Lock

from .. import util as _util
from ..util import read_text_data, conv_splims_labels
from .. import clientweb as _web
from ..namesys import Filter as _Filter
from ..namesys import SiriusPVName as _SiriusPVName
Expand Down Expand Up @@ -143,7 +143,7 @@ def get_splims(pstype, label):
if label in PSSearch._splims_labels:
return PSSearch._pstype_2_splims_dict[pstype][label]
else:
label = _util.conv_splims_labels(label)
label = conv_splims_labels(label)
return PSSearch._pstype_2_splims_dict[pstype][label]

@staticmethod
Expand Down Expand Up @@ -411,7 +411,7 @@ def _reload_pstype_dict():
if not _web.server_online():
raise Exception('could not read pstypes from web server!')
text = _web.ps_pstypes_names_read()
data, _ = _util.read_text_data(text)
data, _ = read_text_data(text)
pstype_dict = dict()
for datum in data:
name, polarity, magfunc = datum[0], datum[1], datum[2]
Expand All @@ -430,7 +430,7 @@ def _reload_pstype_2_psnames_dict():
psnames_list = list()
for pstype in pstypes:
text = _web.ps_pstype_data_read(pstype + '.txt')
data, _ = _util.read_text_data(text)
data, _ = read_text_data(text)
psnames = [_SiriusPVName(datum[0]) for datum in data]
pstype_2_psnames_dict[pstype] = psnames
psnames_list += psnames
Expand All @@ -448,10 +448,10 @@ def _reload_pstype_2_splims_dict():
'could not read setpoint limits from web server!')
# ps data
text = _web.ps_pstype_setpoint_limits()
ps_data, ps_param_dict = _util.read_text_data(text)
ps_data, ps_param_dict = read_text_data(text)
# pu data
text = _web.pu_pstype_setpoint_limits()
pu_data, pu_param_dict = _util.read_text_data(text)
pu_data, pu_param_dict = read_text_data(text)

# checks consistency between PS and PU static tables.
# this should be implemented elsewhere, not in PSSearch!
Expand Down Expand Up @@ -493,8 +493,8 @@ def _reload_psname_2_psmodel_dict():
return
if not _web.server_online():
raise Exception('could not read psmodels from web server')
ps_data, _ = _util.read_text_data(_web.ps_psmodels_read())
pu_data, _ = _util.read_text_data(_web.pu_psmodels_read())
ps_data, _ = read_text_data(_web.ps_psmodels_read())
pu_data, _ = read_text_data(_web.pu_psmodels_read())
data = ps_data + pu_data
psname_2_psmodel_dict = dict()
psmodel_2_psname_dict = dict()
Expand All @@ -517,7 +517,7 @@ def _reload_psname_2_siggen_dict():
raise Exception(
'could not read siggen config from web server')
text = _web.ps_siggen_configuration_read()
data, _ = _util.read_text_data(text)
data, _ = read_text_data(text)
psname_2_siggen_dict = dict()
for datum in data:
psname, *siggen_data = datum
Expand Down Expand Up @@ -555,7 +555,7 @@ def _reload_bbb_2_freq_dict():
if not _web.server_online():
raise Exception(
'could not read BBB frequency map from web server')
data, _ = _util.read_text_data(_web.beaglebone_freq_mapping())
data, _ = read_text_data(_web.beaglebone_freq_mapping())
bbbname_2_freq_dict = dict()
for line in data:
bbbname, sync_off_freq = line
Expand All @@ -568,7 +568,7 @@ def _reload_bbb_2_udc_dict():
return
if not _web.server_online():
raise Exception('could not read BBB to UDC map from web server')
data, _ = _util.read_text_data(_web.bbb_udc_mapping())
data, _ = read_text_data(_web.bbb_udc_mapping())
bbbname_2_udc_dict = dict()
udc_2_bbbname_dict = dict()
for line in data:
Expand All @@ -585,7 +585,7 @@ def _reload_udc_2_bsmp_dict():
return
if not _web.server_online():
raise Exception('could not read UDC to BSMP map from web server')
data, _ = _util.read_text_data(_web.udc_ps_mapping())
data, _ = read_text_data(_web.udc_ps_mapping())
udc_2_bsmp_dict = dict()
bsmp_2_udc_dict = dict()
for line in data:
Expand All @@ -606,7 +606,7 @@ def _reload_ps_2_dclink_dict():
if not _web.server_online():
raise Exception(
'could not read BSMP to DCLink map from web server')
data, _ = _util.read_text_data(_web.bsmp_dclink_mapping())
data, _ = read_text_data(_web.bsmp_dclink_mapping())
ps_2_dclink_dict = dict()
dclink_2_ps_dict = dict()
for line in data:
Expand Down

0 comments on commit ba8acb8

Please sign in to comment.