From 87fdad97ca27c1c1df8103203ccaec8fcc837902 Mon Sep 17 00:00:00 2001 From: Sebastien Bourdeauducq Date: Wed, 10 Dec 2014 12:01:31 +0800 Subject: [PATCH] devices/lda: break off main function --- artiq/devices/lda/lda_client.py | 6 ++++-- artiq/devices/lda/lda_controller.py | 6 ++++-- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/artiq/devices/lda/lda_client.py b/artiq/devices/lda/lda_client.py index da476c51c..17dd81ace 100755 --- a/artiq/devices/lda/lda_client.py +++ b/artiq/devices/lda/lda_client.py @@ -5,8 +5,7 @@ import argparse from artiq.management.pc_rpc import Client -if __name__ == "__main__": - +def main(): parser = argparse.ArgumentParser() parser.add_argument('-s', '--server', default="::1", help="The IP address or hostname of the controller") @@ -25,3 +24,6 @@ if __name__ == "__main__": remote.set_attenuation(args.attenuation) finally: remote.close_rpc() + +if __name__ == "__main__": + main() diff --git a/artiq/devices/lda/lda_controller.py b/artiq/devices/lda/lda_controller.py index cd3d7640b..4882743a2 100755 --- a/artiq/devices/lda/lda_controller.py +++ b/artiq/devices/lda/lda_controller.py @@ -165,8 +165,7 @@ class Lda: """ self.set(0x8d, bytes(chr(int(round(attenuation*4))), 'ascii')) - -if __name__ == "__main__": +def main(): parser = argparse.ArgumentParser() parser.add_argument('-d', '--device', default="LDA-102", choices=["LDA-102", "LDA-602", "sim"]) @@ -185,3 +184,6 @@ if __name__ == "__main__": simple_server_loop(lda, "lda", args.bind, args.port) + +if __name__ == "__main__": + main()