Skip to content
Snippets Groups Projects
Commit 9a8291a1 authored by Cammille Carinan's avatar Cammille Carinan
Browse files

Refactor top-level module importing

parent 739ac0c2
No related branches found
No related tags found
2 merge requests!110WIP: Add docs on how to use ToolBox with Jupyter notebooks on Maxwell,!106Refactor packaging
from .load import (load, concatenateRuns, get_array, run_by_path)
from .constants import mnemonics
from .mnemonics_machinery import mnemonics_for_run
__all__ = (
# functions
"load",
"concatenateRuns",
"get_array",
"run_by_path",
"mnemonics_for_run",
# Classes
# Variables
"mnemonics",
)
from .constants import *
from .detectors import *
# Module name is the same as a child function, we use alias to avoid conflict
import load as load_module
from .load import *
# ------------------------------------------------------------------------------
# Clean namespace
# clean_ns is a collection of undesired items in the namespace
# ------------------------------------------------------------------------------
from .misc import *
from .mnemonics_machinery import *
from .routines import *
clean_ns = [
# filenames
'constants',
'mnemonics_machinery'
# folders
'misc',
'util',
'detectors',
'routines',
]
for name in dir():
if name in clean_ns:
del globals()[name]
__all__ = (
# top-level modules
constants.__all__
+ load_module.__all__
+ mnemonics_machinery.__all__
del globals()['clean_ns']
del globals()['name']
# submodules
+ detectors.__all__
+ misc.__all__
+ routines.__all__
)
__all__ = [
'mnemonics'
]
mnemonics = {
# Machine
"sase3": ({'source': 'SCS_RR_UTC/MDL/BUNCH_DECODER',
......
......@@ -21,6 +21,13 @@ from .mnemonics_machinery import mnemonics_for_run
from .util.exceptions import ToolBoxValueError
import toolbox_scs.detectors as tbdet
__all__ = [
'concatenateRuns',
'get_array',
'load',
'run_by_path',
]
log = logging.getLogger(__name__)
......
......@@ -10,6 +10,10 @@ import logging
from .constants import mnemonics as _mnemonics
__all__ = [
'mnemonics_for_run'
]
log = logging.getLogger(__name__)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment