Skip to content

Commit

Permalink
MNT #14 remove deprecated code
Browse files Browse the repository at this point in the history
  • Loading branch information
prjemian committed Dec 10, 2024
1 parent 8af04ff commit ef6faf3
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 45 deletions.
37 changes: 1 addition & 36 deletions apsbss/apsbss.py
Original file line number Diff line number Diff line change
Expand Up @@ -407,10 +407,6 @@ def get_options():

subcommand.add_parser("beamlines", help="print list of beamlines")

msg = "print current ESAF(s) and proposal(s)" ", DEPRECATED: use 'list' instead"
p_sub = subcommand.add_parser("current", help=msg)
p_sub.add_argument("beamlineName", type=str, help="Beamline name")

p_sub = subcommand.add_parser("runs", help="print APS run cycle names")
p_sub.add_argument(
"-f",
Expand Down Expand Up @@ -502,34 +498,6 @@ def sorter(entry):
printColumns(server.runs)


def cmd_current(args):
"""
Handle ``current`` command.
DEPRECATED: use ``list`` instead
PARAMETERS
args
*obj* :
Object returned by ``argparse``
"""
warnings.warn("Command 'current' is deprecated, use 'list' instead.")
records = getCurrentProposals(args.beamlineName)
tNow = datetime.datetime.now().isoformat(sep=" ")
if len(records) == 0:
print(f"No current proposals for {args.beamlineName}")
else:
printProposalTable(records, f"Current Proposal(s): {args.beamlineName} at {tNow}")

sector = args.beamlineName.split("-")[0]
records = server.current_esafs(sector)
if len(records) == 0:
print(f"No current ESAFs for sector {sector}")
else:
printEsafTable(records, f"Current ESAF(s): sector {sector} at {tNow}")


def cmd_esaf(args):
"""
Handle ``esaf`` command.
Expand Down Expand Up @@ -564,7 +532,7 @@ def cmd_list(args):

if not len(run) or run in "now current".split():
run = server.current_run
# elif run == "all":
# elif run == "all": # TODO: re-enable
# run = server.runs
elif run in "future next".split():
runs = server.runs
Expand Down Expand Up @@ -640,9 +608,6 @@ def main():
elif args.subcommand == "clear":
epicsClear(args.prefix)

elif args.subcommand == "current":
cmd_current(args)

elif args.subcommand == "runs":
cmd_runs(args)

Expand Down
2 changes: 2 additions & 0 deletions apsbss/servers.py
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,7 @@ def esafs(self, sector, run):

return results

# TODO: rename to esaf
def get_esaf(self, esaf_id):
"""
Return ESAF as a dictionary.
Expand All @@ -190,6 +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):
"""
Return proposal as a dictionary.
Expand Down
9 changes: 0 additions & 9 deletions apsbss/tests/test_apsbss.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
General tests of the apsbss module
"""

import datetime
import pathlib
import socket
import subprocess
Expand Down Expand Up @@ -255,14 +254,6 @@ def test_apsbss_commands_beamlines(argv):
assert args.subcommand == sys.argv[1]


def test_apsbss_commands_current(argv):
sys.argv = argv + ["current", "9-ID-B,C"]
args = apsbss.get_options()
assert args is not None
assert args.subcommand == sys.argv[1]
assert args.beamlineName == sys.argv[2]


def test_apsbss_commands_runs(argv):
sys.argv = argv + [
"runs",
Expand Down

0 comments on commit ef6faf3

Please sign in to comment.