Skip to content

Commit

Permalink
MNT #14 rename
Browse files Browse the repository at this point in the history
  • Loading branch information
prjemian committed Dec 10, 2024
1 parent ef6faf3 commit c1d6972
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 11 deletions.
8 changes: 4 additions & 4 deletions apsbss/apsbss.py
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ def epicsUpdate(prefix):

if len(esaf_id) > 0:
bss.status_msg.put(f"get ESAF {esaf_id} from APS ...")
esaf = server.get_esaf(esaf_id)
esaf = server.esaf(esaf_id)

bss.status_msg.put("set ESAF PVs ...")
bss.esaf.description.put(esaf["description"])
Expand All @@ -184,7 +184,7 @@ def epicsUpdate(prefix):

if len(proposal_id) > 0:
bss.status_msg.put(f"get Proposal {proposal_id} from APS ...")
proposal = server.get_proposal(proposal_id, beamline, run)
proposal = server.proposal(proposal_id, beamline, run)

bss.status_msg.put("set Proposal PVs ...")
bss.proposal.end_date.put(proposal["endTime"])
Expand Down Expand Up @@ -509,7 +509,7 @@ def cmd_esaf(args):
Object returned by ``argparse``
"""
try:
esaf = server.get_esaf(args.esafId)
esaf = server.esaf(args.esafId)
print(yaml.dump(esaf))
except Exception as reason:
print(f"DM reported: {reason}")
Expand Down Expand Up @@ -577,7 +577,7 @@ def cmd_proposal(args):
Object returned by ``argparse``
"""
try:
proposal = server.get_proposal(args.proposalId, args.beamlineName, args.run)
proposal = server.proposal(args.proposalId, args.beamlineName, args.run)
print(yaml.dump(proposal))
except Exception as reason:
print(f"DM reported: {reason}")
Expand Down
9 changes: 4 additions & 5 deletions apsbss/servers.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,9 @@ class Server:
~current_esafs_and_proposals
~current_proposals
~current_run
~esaf
~esafs
~get_proposal
~proposal
~proposals
~recent_runs
~_runs
Expand Down Expand Up @@ -174,8 +175,7 @@ def esafs(self, sector, run):

return results

# TODO: rename to esaf
def get_esaf(self, esaf_id):
def esaf(self, esaf_id):
"""
Return ESAF as a dictionary.
Expand All @@ -191,8 +191,7 @@ def get_esaf(self, esaf_id):
raise EsafNotFound(f"{esaf_id=!r}")
return dict(record.data)

# TODO: rename to proposal
def get_proposal(self, proposal_id, beamline, run):
def proposal(self, proposal_id, beamline, run):
"""
Return proposal as a dictionary.
Expand Down
4 changes: 2 additions & 2 deletions apsbss/tests/test_servers.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,9 @@ def test_Server_raises():
assert "Could not find run='1915-1'" in str(reason)

with pytest.raises(EsafNotFound) as reason:
server.get_esaf("1")
server.esaf("1")
assert "esaf_id='1'" in str(reason)

with pytest.raises(ProposalNotFound) as reason:
server.get_proposal(1, "8-ID-I", "2024-3")
server.proposal(1, "8-ID-I", "2024-3")
assert "proposal_id='1' beamline='8-ID-I' run='2024-3'" in str(reason)

0 comments on commit c1d6972

Please sign in to comment.