From fbe4d96572372836b7c7a47e2c8d99275ac54bf7 Mon Sep 17 00:00:00 2001 From: Robert Jordens Date: Mon, 25 Jan 2016 14:48:58 -0700 Subject: [PATCH] artiq: move namespace artiq.* -> artiq.language.* perl -i -pe 's/^from artiq import \*$/from artiq.language import */' your_experiments/*.py --- artiq/__init__.py | 10 ---------- artiq/language/__init__.py | 6 ++++-- artiq/test/coredevice/portability.py | 2 +- artiq/test/scheduler.py | 2 +- artiq/test/worker.py | 2 +- doc/manual/core_language_reference.rst | 2 +- doc/manual/getting_started_core.rst | 4 ++-- doc/manual/getting_started_mgmt.rst | 2 +- examples/master/repository/arguments_demo.py | 2 +- .../repository/coredevice_examples/photon_histogram.py | 2 +- .../coredevice_examples/simple/blink_forever.py | 2 +- .../repository/coredevice_examples/simple/dds_test.py | 2 +- .../repository/coredevice_examples/simple/handover.py | 2 +- .../coredevice_examples/simple/mandelbrot.py | 2 +- examples/master/repository/coredevice_examples/tdr.py | 2 +- .../master/repository/coredevice_examples/transport.py | 2 +- examples/master/repository/flopping_f_simulation.py | 2 +- examples/master/repository/run_forever.py | 2 +- examples/master/repository/speed_benchmark.py | 2 +- examples/master/repository/utilities/dds_setter.py | 2 +- examples/master/repository/utilities/terminate_all.py | 2 +- examples/sim/al_spectroscopy.py | 2 +- examples/sim/simple_simulation.py | 2 +- 23 files changed, 26 insertions(+), 34 deletions(-) diff --git a/artiq/__init__.py b/artiq/__init__.py index b7f5db75d..e44e9d156 100644 --- a/artiq/__init__.py +++ b/artiq/__init__.py @@ -1,13 +1,3 @@ -from artiq import language -from artiq.language import * -from artiq.coredevice.dds import (PHASE_MODE_CONTINUOUS, PHASE_MODE_ABSOLUTE, - PHASE_MODE_TRACKING) - -__all__ = [] -__all__.extend(language.__all__) -__all__ += ["PHASE_MODE_CONTINUOUS", "PHASE_MODE_ABSOLUTE", - "PHASE_MODE_TRACKING"] - from ._version import get_versions __version__ = get_versions()['version'] del get_versions diff --git a/artiq/language/__init__.py b/artiq/language/__init__.py index 763babfbd..e3d9df9e0 100644 --- a/artiq/language/__init__.py +++ b/artiq/language/__init__.py @@ -1,5 +1,3 @@ -# Copyright (C) 2014, 2015 Robert Jordens - from artiq.language import core, types, environment, units, scan from artiq.language.core import * from artiq.language.types import * @@ -7,6 +5,8 @@ from artiq.language.environment import * from artiq.language.units import * from artiq.language.scan import * +from artiq.coredevice.dds import (PHASE_MODE_CONTINUOUS, PHASE_MODE_ABSOLUTE, + PHASE_MODE_TRACKING) __all__ = [] __all__.extend(core.__all__) @@ -14,3 +14,5 @@ __all__.extend(types.__all__) __all__.extend(environment.__all__) __all__.extend(units.__all__) __all__.extend(scan.__all__) +__all__ += ["PHASE_MODE_CONTINUOUS", "PHASE_MODE_ABSOLUTE", + "PHASE_MODE_TRACKING"] diff --git a/artiq/test/coredevice/portability.py b/artiq/test/coredevice/portability.py index 546ef3d84..752ded674 100644 --- a/artiq/test/coredevice/portability.py +++ b/artiq/test/coredevice/portability.py @@ -1,7 +1,7 @@ from operator import itemgetter from fractions import Fraction -from artiq import * +from artiq.language import * from artiq.sim import devices as sim_devices from artiq.test.hardware_testbench import ExperimentCase diff --git a/artiq/test/scheduler.py b/artiq/test/scheduler.py index f6a029ee5..75522ad21 100644 --- a/artiq/test/scheduler.py +++ b/artiq/test/scheduler.py @@ -5,7 +5,7 @@ import sys import os from time import time, sleep -from artiq import * +from artiq.language import * from artiq.master.scheduler import Scheduler diff --git a/artiq/test/worker.py b/artiq/test/worker.py index bd69d03b8..8a02907c0 100644 --- a/artiq/test/worker.py +++ b/artiq/test/worker.py @@ -5,7 +5,7 @@ import sys import os from time import sleep -from artiq import * +from artiq.language import * from artiq.master.worker import * diff --git a/doc/manual/core_language_reference.rst b/doc/manual/core_language_reference.rst index b88b95ade..66fe50411 100644 --- a/doc/manual/core_language_reference.rst +++ b/doc/manual/core_language_reference.rst @@ -1,7 +1,7 @@ Core language reference ======================= -The most commonly used features from those modules can be imported with ``from artiq import *``. +The most commonly used features from those modules can be imported with ``from artiq.language import *``. :mod:`artiq.language.core` module --------------------------------- diff --git a/doc/manual/getting_started_core.rst b/doc/manual/getting_started_core.rst index 81a183c91..85e7d2e24 100644 --- a/doc/manual/getting_started_core.rst +++ b/doc/manual/getting_started_core.rst @@ -8,7 +8,7 @@ Connecting to the core device As a very first step, we will turn on a LED on the core device. Create a file ``led.py`` containing the following: :: - from artiq import * + from artiq.language import * class LED(EnvExperiment): @@ -93,7 +93,7 @@ The point of running code on the core device is the ability to meet demanding re Create a new file ``rtio.py`` containing the following: :: - from artiq import * + from artiq.language import * class Tutorial(EnvExperiment): diff --git a/doc/manual/getting_started_mgmt.rst b/doc/manual/getting_started_mgmt.rst index c030ad69f..41d5305bf 100644 --- a/doc/manual/getting_started_mgmt.rst +++ b/doc/manual/getting_started_mgmt.rst @@ -16,7 +16,7 @@ Then create a ``~/artiq-master/repository`` sub-folder to contain experiments. T Create a very simple experiment in ``~/artiq-master/repository`` and save it as ``mgmt_tutorial.py``: :: - from artiq import * + from artiq.language import * class MgmtTutorial(EnvExperiment): diff --git a/examples/master/repository/arguments_demo.py b/examples/master/repository/arguments_demo.py index 7b65e0bb9..8559383f8 100644 --- a/examples/master/repository/arguments_demo.py +++ b/examples/master/repository/arguments_demo.py @@ -1,6 +1,6 @@ import logging -from artiq import * +from artiq.language import * class SubComponent1(HasEnvironment): diff --git a/examples/master/repository/coredevice_examples/photon_histogram.py b/examples/master/repository/coredevice_examples/photon_histogram.py index 84e6f62c2..9cd574d9f 100644 --- a/examples/master/repository/coredevice_examples/photon_histogram.py +++ b/examples/master/repository/coredevice_examples/photon_histogram.py @@ -1,4 +1,4 @@ -from artiq import * +from artiq.language import * class PhotonHistogram(EnvExperiment): diff --git a/examples/master/repository/coredevice_examples/simple/blink_forever.py b/examples/master/repository/coredevice_examples/simple/blink_forever.py index 9abd3968f..37ed06c03 100644 --- a/examples/master/repository/coredevice_examples/simple/blink_forever.py +++ b/examples/master/repository/coredevice_examples/simple/blink_forever.py @@ -1,4 +1,4 @@ -from artiq import * +from artiq.language import * class BlinkForever(EnvExperiment): diff --git a/examples/master/repository/coredevice_examples/simple/dds_test.py b/examples/master/repository/coredevice_examples/simple/dds_test.py index cc2d4e6db..edcdf265c 100644 --- a/examples/master/repository/coredevice_examples/simple/dds_test.py +++ b/examples/master/repository/coredevice_examples/simple/dds_test.py @@ -1,4 +1,4 @@ -from artiq import * +from artiq.language import * class DDSTest(EnvExperiment): diff --git a/examples/master/repository/coredevice_examples/simple/handover.py b/examples/master/repository/coredevice_examples/simple/handover.py index ef3512bf8..6b63e338d 100644 --- a/examples/master/repository/coredevice_examples/simple/handover.py +++ b/examples/master/repository/coredevice_examples/simple/handover.py @@ -1,4 +1,4 @@ -from artiq import * +from artiq.language import * class Handover(EnvExperiment): diff --git a/examples/master/repository/coredevice_examples/simple/mandelbrot.py b/examples/master/repository/coredevice_examples/simple/mandelbrot.py index 1bd8dabf7..a599823e9 100644 --- a/examples/master/repository/coredevice_examples/simple/mandelbrot.py +++ b/examples/master/repository/coredevice_examples/simple/mandelbrot.py @@ -1,6 +1,6 @@ import sys -from artiq import * +from artiq.language import * class Mandelbrot(EnvExperiment): diff --git a/examples/master/repository/coredevice_examples/tdr.py b/examples/master/repository/coredevice_examples/tdr.py index a6ac2b127..41caa0624 100644 --- a/examples/master/repository/coredevice_examples/tdr.py +++ b/examples/master/repository/coredevice_examples/tdr.py @@ -1,6 +1,6 @@ # Copyright (C) 2014, 2015 Robert Jordens -from artiq import * +from artiq.language import * class PulseNotReceivedError(Exception): diff --git a/examples/master/repository/coredevice_examples/transport.py b/examples/master/repository/coredevice_examples/transport.py index 15f94666a..c0eca6e72 100644 --- a/examples/master/repository/coredevice_examples/transport.py +++ b/examples/master/repository/coredevice_examples/transport.py @@ -2,7 +2,7 @@ import numpy as np -from artiq import * +from artiq.language import * from artiq.wavesynth.coefficients import SplineSource diff --git a/examples/master/repository/flopping_f_simulation.py b/examples/master/repository/flopping_f_simulation.py index a2f0f04c9..14b30e203 100644 --- a/examples/master/repository/flopping_f_simulation.py +++ b/examples/master/repository/flopping_f_simulation.py @@ -5,7 +5,7 @@ import random import numpy as np from scipy.optimize import curve_fit -from artiq import * +from artiq.language import * def model(x, F0): diff --git a/examples/master/repository/run_forever.py b/examples/master/repository/run_forever.py index 73f6e2e20..adddfd21d 100644 --- a/examples/master/repository/run_forever.py +++ b/examples/master/repository/run_forever.py @@ -1,7 +1,7 @@ from itertools import count from time import sleep -from artiq import * +from artiq.language import * class RunForever(EnvExperiment): diff --git a/examples/master/repository/speed_benchmark.py b/examples/master/repository/speed_benchmark.py index e546ac854..4b5559700 100644 --- a/examples/master/repository/speed_benchmark.py +++ b/examples/master/repository/speed_benchmark.py @@ -1,6 +1,6 @@ import time -from artiq import * +from artiq.language import * class _PayloadNOP(EnvExperiment): diff --git a/examples/master/repository/utilities/dds_setter.py b/examples/master/repository/utilities/dds_setter.py index a50e242c0..8ba6f18cc 100644 --- a/examples/master/repository/utilities/dds_setter.py +++ b/examples/master/repository/utilities/dds_setter.py @@ -1,6 +1,6 @@ from operator import itemgetter -from artiq import * +from artiq.language import * class DDSSetter(EnvExperiment): diff --git a/examples/master/repository/utilities/terminate_all.py b/examples/master/repository/utilities/terminate_all.py index 9e1f38ff3..c61402fe9 100644 --- a/examples/master/repository/utilities/terminate_all.py +++ b/examples/master/repository/utilities/terminate_all.py @@ -1,4 +1,4 @@ -from artiq import * +from artiq.language import * class TerminateAll(EnvExperiment): diff --git a/examples/sim/al_spectroscopy.py b/examples/sim/al_spectroscopy.py index 944def945..97a55fb0b 100644 --- a/examples/sim/al_spectroscopy.py +++ b/examples/sim/al_spectroscopy.py @@ -1,4 +1,4 @@ -from artiq import * +from artiq.language import * class AluminumSpectroscopy(EnvExperiment): diff --git a/examples/sim/simple_simulation.py b/examples/sim/simple_simulation.py index 59c4875e4..5106e06b6 100644 --- a/examples/sim/simple_simulation.py +++ b/examples/sim/simple_simulation.py @@ -1,4 +1,4 @@ -from artiq import * +from artiq.language import * class SimpleSimulation(EnvExperiment):