From bd2bd68a542d28e86e9a00c74c81e6f5d7a050ba Mon Sep 17 00:00:00 2001 From: Sebastien Bourdeauducq Date: Wed, 22 Jul 2015 05:47:14 +0800 Subject: [PATCH] gui,client: do now show arguments --- artiq/frontend/artiq_client.py | 4 +--- artiq/gui/schedule.py | 5 +---- artiq/protocols/pc_rpc.py | 13 +++++++++++-- artiq/tools.py | 10 ---------- 4 files changed, 13 insertions(+), 19 deletions(-) diff --git a/artiq/frontend/artiq_client.py b/artiq/frontend/artiq_client.py index e7035381a..8277ba318 100755 --- a/artiq/frontend/artiq_client.py +++ b/artiq/frontend/artiq_client.py @@ -12,7 +12,6 @@ from prettytable import PrettyTable from artiq.protocols.pc_rpc import Client from artiq.protocols.sync_struct import Subscriber from artiq.protocols import pyon -from artiq.tools import format_arguments def clear_screen(): @@ -149,7 +148,7 @@ def _show_schedule(schedule): x[1]["due_date"] or 0, x[0])) table = PrettyTable(["RID", "Pipeline", " Status ", "Prio", - "Due date", "File", "Class name", "Arguments"]) + "Due date", "File", "Class name"]) for rid, v in l: row = [rid, v["pipeline"], v["status"], v["priority"]] if v["due_date"] is None: @@ -162,7 +161,6 @@ def _show_schedule(schedule): row.append("") else: row.append(v["expid"]["class_name"]) - row.append(format_arguments(v["expid"]["arguments"])) table.add_row(row) print(table) else: diff --git a/artiq/gui/schedule.py b/artiq/gui/schedule.py index cd9c8d402..363cc6570 100644 --- a/artiq/gui/schedule.py +++ b/artiq/gui/schedule.py @@ -6,14 +6,13 @@ from pyqtgraph import dockarea from artiq.protocols.sync_struct import Subscriber from artiq.gui.tools import DictSyncModel -from artiq.tools import format_arguments class _ScheduleModel(DictSyncModel): def __init__(self, parent, init): DictSyncModel.__init__(self, ["RID", "Pipeline", "Status", "Prio", "Due date", - "File", "Class name", "Arguments"], + "File", "Class name"], parent, init) def sort_key(self, k, v): @@ -42,8 +41,6 @@ class _ScheduleModel(DictSyncModel): return "" else: return v["expid"]["class_name"] - elif column == 7: - return format_arguments(v["expid"]["arguments"]) else: raise ValueError diff --git a/artiq/protocols/pc_rpc.py b/artiq/protocols/pc_rpc.py index 539e9f7f3..a16c3dfd9 100644 --- a/artiq/protocols/pc_rpc.py +++ b/artiq/protocols/pc_rpc.py @@ -22,7 +22,6 @@ import inspect from artiq.protocols import pyon from artiq.protocols.asyncio_server import AsyncioServer as _AsyncioServer -from artiq.tools import format_arguments logger = logging.getLogger(__name__) @@ -375,6 +374,16 @@ class BestEffortClient: return proxy +def _format_arguments(arguments): + fmtargs = [] + for k, v in sorted(arguments.items(), key=itemgetter(0)): + fmtargs.append(k + "=" + repr(v)) + if fmtargs: + return ", ".join(fmtargs) + else: + return "" + + class _PrettyPrintCall: def __init__(self, obj): self.obj = obj @@ -383,7 +392,7 @@ class _PrettyPrintCall: r = self.obj["name"] + "(" args = ", ".join([repr(a) for a in self.obj["args"]]) r += args - kwargs = format_arguments(self.obj["kwargs"]) + kwargs = _format_arguments(self.obj["kwargs"]) if args and kwargs: r += ", " r += kwargs diff --git a/artiq/tools.py b/artiq/tools.py index 2f7870eab..767e858dd 100644 --- a/artiq/tools.py +++ b/artiq/tools.py @@ -19,16 +19,6 @@ def parse_arguments(arguments): return d -def format_arguments(arguments): - fmtargs = [] - for k, v in sorted(arguments.items(), key=itemgetter(0)): - fmtargs.append(k + "=" + repr(v)) - if fmtargs: - return ", ".join(fmtargs) - else: - return "" - - def file_import(filename): linecache.checkcache(filename)