From be3f05a4c0b9ce726dbbe83a7d237d2327725c93 Mon Sep 17 00:00:00 2001 From: pca006132 Date: Wed, 9 Mar 2022 11:00:20 +0800 Subject: [PATCH] artiq/language/core.py: define print_rpc --- artiq/language/core.py | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/artiq/language/core.py b/artiq/language/core.py index b2d0f2cec..3cff29c15 100644 --- a/artiq/language/core.py +++ b/artiq/language/core.py @@ -6,6 +6,7 @@ from typing import Generic, TypeVar from functools import wraps from inspect import getfullargspec, getmodule from types import SimpleNamespace +from typing import TypeVar from math import floor, ceil from artiq.language import import_cache @@ -16,7 +17,8 @@ __all__ = [ "round64", "floor64", "ceil64", "extern", "kernel", "portable", "nac3", "rpc", "parallel", "sequential", - "set_watchdog_factory", "watchdog", "TerminationRequested" + "set_watchdog_factory", "watchdog", "TerminationRequested", + "print_rpc" ] @@ -106,6 +108,14 @@ def rpc(arg=None, flags={}): return inner_decorator return arg + +T = TypeVar('T') + +@rpc +def print_rpc(a: T): + print(a) + + @nac3 class KernelContextManager: @kernel