-
Notifications
You must be signed in to change notification settings - Fork 353
Expand file tree
/
Copy path__init__.py
More file actions
123 lines (100 loc) · 3.21 KB
/
__init__.py
File metadata and controls
123 lines (100 loc) · 3.21 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
"""Set up the main qcodes namespace."""
# ruff: noqa: F401, E402
# This module still contains a lot of short hand imports
# since these imports are discouraged and they are officially
# added elsewhere under their respective submodules we cannot add
# them to __all__ here so silence the warning.
# config
import warnings
from typing import Any
from typing_extensions import deprecated
import qcodes.configuration as qcconfig
from qcodes.logger.logger import conditionally_start_all_logging
from qcodes.utils import QCoDeSDeprecationWarning
from qcodes.utils.spyder_utils import add_to_spyder_UMR_excludelist
config: qcconfig.Config = qcconfig.Config()
conditionally_start_all_logging()
# we dont want spyder to reload qcodes as this will overwrite the default station
# instrument list and running monitor
add_to_spyder_UMR_excludelist('qcodes')
import atexit
import qcodes.validators
from qcodes.dataset import (
Measurement,
ParamSpec,
SQLiteSettings,
experiments,
get_guids_by_run_spec,
initialise_database,
initialise_or_create_database_at,
initialised_database_at,
load_by_counter,
load_by_guid,
load_by_id,
load_by_run_spec,
load_experiment,
load_experiment_by_name,
load_last_experiment,
load_or_create_experiment,
new_data_set,
new_experiment,
)
from qcodes.instrument import (
ChannelList,
ChannelTuple,
Instrument,
InstrumentChannel,
IPInstrument,
VisaInstrument,
find_or_create_instrument,
)
from qcodes.monitor import Monitor
from qcodes.parameters import (
ArrayParameter,
CombinedParameter,
DelegateParameter,
Function,
ManualParameter,
MultiParameter,
Parameter,
ParameterWithSetpoints,
ScaledParameter,
SweepFixedValues,
SweepValues,
combine,
)
from qcodes.station import Station
from qcodes.utils import deprecate
# ensure to close all instruments when interpreter is closed
atexit.register(Instrument.close_all)
if config.core.import_legacy_api:
warnings.warn(
"`core.import_legacy_api` and `gui.plotlib` config option has no effect "
"and will be removed in the future. "
"Please avoid setting this in your `qcodesrc.json` config file.",
QCoDeSDeprecationWarning,
)
@deprecated(
"tests are no longer shipped as part of QCoDeS. Clone git repo to matching tag and run `pytest tests` from the root of the repo.",
category=QCoDeSDeprecationWarning,
)
def test(**kwargs: Any) -> int:
"""
Deprecated
"""
return 0
del deprecated
test.__test__ = False # type: ignore[attr-defined] # Don't try to run this method as a test
__version__: str
def __getattr__(name: str) -> Any:
"""
Getting __version__ is slow in an editable install since we have shell out to run git describe.
Here we only do it lazily if required.
TODO this means that unknown attributes are typed as Any rather than an error
Using Literal["__version__"] as the input type does not seem to result in other attributes being rejected
"""
if name == "__version__":
import qcodes._version
__version__ = qcodes._version.__version__
return __version__
raise AttributeError(f"module {__name__!r} has no attribute {name!r}")