def test_get_config_etc(): config = get_config("test", allow_user=False) assert isinstance(config, Configuration) assert config["cat1"]["key1"] == "value" config = get_config("test", allow_user=True) assert isinstance(config, Configuration) assert config["cat1"]["key1"] == "value"
def test_get_config_no_update(config_file): config = get_config( "test", config_file=BASE_CONFIG_FILE, user_path=config_file, merge_mode="replace", ) assert config["cat1"]["key1"] == "another_value" assert "cat2" not in config
# encoding: utf-8 from sdsstools import get_config, get_logger, get_package_version # pip package name NAME = 'sdss-tron-lite' # Loads config. config name is the package name. config = get_config('tron_lite') log = get_logger(NAME) __version__ = get_package_version(path=__file__, package_name=NAME)
# encoding: utf-8 from sdsstools import get_config, get_logger, get_package_version # pip package name NAME = 'sdss-fibermeas' # Loads config. config name is the package name. config = get_config('fibermeas') # Inits the logging system as NAME. Only shell logging, and exception and warning catching. # File logging can be started by calling log.start_file_logger(path). Filename can be different # than NAME. log = get_logger(NAME) # package name should be pip package name __version__ = get_package_version(path=__file__, package_name=NAME)
# encoding: utf-8 # isort:skip import os from sdsstools import get_config, get_package_version NAME = "sdss-flicamera" __version__ = get_package_version(__file__, "sdss-flicamera") or "dev" config = get_config( "flicamera", config_file=os.path.join(os.path.dirname(__file__), "etc/flicamera.yaml"), ) OBSERVATORY = os.environ.get("OBSERVATORY", "UNKNOWN") from .camera import * from .lib import LibFLI
#!/usr/bin/env python # encoding: utf-8 from __future__ import absolute_import, division, print_function from sdsstools import get_config, get_logger, get_package_version NAME = 'sdss-tree' # init the logger log = get_logger(NAME) # Loads config config = get_config('tree') __version__ = get_package_version(path=__file__, package_name=NAME) from tree.tree import Tree
# encoding: utf-8 from sdsstools import get_config, get_logger, get_package_version # pip package name NAME = 'sdss-lvmieb' # Loads config. config name is the package name. config = get_config('lvmieb') # Inits the logging system as NAME. Only shell logging, and exception and warning catching. # File logging can be started by calling log.start_file_logger(path). Filename can be different # than NAME. log = get_logger(NAME) # package name should be pip package name __version__ = get_package_version(path=__file__, package_name=NAME)
# encoding: utf-8 from sdsstools import get_config, get_logger, get_package_version # pip package name NAME = 'sdss-mugatu' # Loads config. config name is the package name. config = get_config('mugatu') # Inits the logging system as NAME. Only shell logging, and exception and warning catching. # File logging can be started by calling log.start_file_logger(path). Filename can be different # than NAME. log = get_logger(NAME) # package name should be pip package name __version__ = get_package_version(path=__file__, package_name=NAME)
#!/usr/bin/env python # -*- coding: utf-8 -*- # # @Author: José Sánchez-Gallego ([email protected]) # @Date: 2021-03-24 # @Filename: __init__.py # @License: BSD 3-clause (http://www.opensource.org/licenses/BSD-3-Clause) from clu import Command from sdsstools import get_config, get_logger, get_package_version NAME = "sdss-hal" config = get_config("hal") log = get_logger(NAME) __version__ = get_package_version(path=__file__, package_name=NAME) from .actor import HALActor HALCommandType = Command[HALActor]
def test_get_config_bad_module(mock_func): config = get_config("test") assert config == {}
def test_get_config_envvar_path(config_file): os.environ["TEST_CONFIG_PATH"] = str(config_file) config = get_config("test") assert config["cat1"]["key1"] == "another_value"
def test_get_config_default_path(update_default_paths): config = get_config("test") assert config["cat1"]["key1"] == "another_value"
def test_get_config_etc_with_user_str(config_file): config = get_config("test", allow_user=True, user_path=str(config_file)) assert isinstance(config, Configuration) assert config["cat1"]["key1"] == "another_value"
# encoding: utf-8 from sdsstools import get_config, get_logger, get_package_version from tree import Tree NAME = 'sdss_brain' # Loads config cfg_params = get_config(NAME) # Inits the logging system. Only shell logging, and exception and warning catching. # File logging can be started by calling log.start_file_logger(path). log = get_logger(NAME) log.setLevel("INFO") __version__ = get_package_version(path=__file__, package_name=NAME) tree = Tree()
if TYPE_CHECKING: from .actor import JaegerActor NAME = "jaeger" __version__ = get_package_version(path=__file__, package_name=NAME) log = get_logger("jaeger", log_level=logging.WARNING) can_log = get_logger("jaeger_can", log_level=logging.ERROR, capture_warnings=False) # Start by loading the internal configuration file. __ENVVARS__["OBSERVATORY"] = "?" config = get_config(NAME) # If we are not in debug mode, remove some possible warnings. if config["debug"] is False: warnings.filterwarnings( "ignore", message=".+was never awaited.+", category=RuntimeWarning, ) warnings.simplefilter("always", category=JaegerUserWarning) def start_file_loggers(start_log=True, start_can=True): if "files" in config and "log_dir" in config["files"]:
NAME = 'marvin' # Set the Marvin version __version__ = get_package_version(path=__file__, package_name='sdss-marvin') # Does this so that the implicit module definitions in extern can happen. # time - 483 ms from marvin.core.exceptions import MarvinUserWarning, MarvinError from brain.utils.general.general import getDbMachine from brain import bconfig from brain.core.core import URLMapDict from brain.core.exceptions import BrainError # Loads config curdir = os.path.dirname(os.path.abspath(__file__)) cfg_params = get_config(NAME, config_file=os.path.join(curdir, 'data/marvin.yml')) # Defines log dir. if 'MARVIN_LOGS_DIR' in os.environ: logFilePath = os.path.join(os.path.realpath(os.environ['MARVIN_LOGS_DIR']), 'marvin.log') else: logFilePath = os.path.realpath( os.path.join(os.path.expanduser('~'), '.marvin', 'marvin.log')) # Inits the log log = get_logger(NAME) log.start_file_logger(logFilePath) warnings.simplefilter('once') warnings.filterwarnings(
# encoding: utf-8 from sdsstools import get_config, get_logger, get_package_version # pip package name NAME = 'sdss-lvmscp' # Loads config. config name is the package name. config = get_config('lvmscp') # Inits the logging system as NAME. Only shell logging, and exception and warning catching. # File logging can be started by calling log.start_file_logger(path). Filename can be different # than NAME. log = get_logger(NAME) # package name should be pip package name __version__ = get_package_version(path=__file__, package_name=NAME)
import warnings from sdsstools import get_config, get_logger NAME = "baslerCam" config = get_config("baslerCam", allow_user=False) from .baslerCam import * from .actor import *
# encoding: utf-8 from sdsstools import get_config, get_logger, get_package_version # pip package name NAME = '{{cookiecutter.pip_name}}' # Loads config. config name is the package name. config = get_config('{{cookiecutter.package_name}}') # Inits the logging system as NAME. Only shell logging, and exception and warning catching. # File logging can be started by calling log.start_file_logger(path). Filename can be different # than NAME. log = get_logger(NAME) # package name should be pip package name __version__ = get_package_version(path=__file__, package_name=NAME)
# encoding: utf-8 from sdsstools import get_config, get_logger, get_package_version NAME = 'sdss-chernosim' config = get_config('chernosim') # Inits the logging system. Only shell logging, and exception and warning catching. # File logging can be started by calling log.start_file_logger(path). log = get_logger(NAME) __version__ = get_package_version(path=__file__, package_name=NAME)
# encoding: utf-8 from sdsstools import get_config, get_logger, get_package_version # pip package name NAME = "sdss-archon" # Loads config. config name is the package name. config = get_config("archon") # Inits the logging system as NAME. Only shell logging, # and exception and warning catching. # File logging can be started by calling log.start_file_logger(path). # Filename can be different than NAME. log = get_logger(NAME) # package name should be pip package name __version__ = get_package_version(path=__file__, package_name=NAME)
# encoding: utf-8 from sdsstools import get_config, get_logger, get_package_version # pip package name NAME = 'sdss-cthreepo' # Loads config. config name is the package name. config = get_config('cthreepo') # Inits the logging system as NAME. Only shell logging, and exception and warning catching. # File logging can be started by calling log.start_file_logger(path). Filename can be different # than NAME. log = get_logger(NAME) # package name should be pip package name __version__ = get_package_version(path=__file__, package_name=NAME)
# encoding: utf-8 from sdsstools import get_config, get_logger, get_package_version # pip package name NAME = 'sdss-valis' # Loads config. config name is the package name. config = get_config('valis') # Inits the logging system as NAME. Only shell logging, and exception and warning catching. # File logging can be started by calling log.start_file_logger(path). Filename can be different # than NAME. log = get_logger(NAME) # package name should be pip package name __version__ = get_package_version(path=__file__, package_name=NAME)
# encoding: utf-8 import os import enlighten from sdsstools import get_config, get_logger, get_package_version NAME = 'sdss-target-selection' config = get_config( 'target_selection', os.path.join(os.path.dirname(__file__), 'config/target_selection.yml')) log = get_logger(NAME) __version__ = get_package_version(path=__file__, package_name=NAME, pep_440=True) manager = enlighten.get_manager() from .xmatch import XMatchPlanner, XMatchModel # isort:skip