Allows for calling getConfiguration without parametter for geting the
default configuration
This commit is contained in:
@ -6,5 +6,5 @@ cpdef str getRootConfigName()
|
|||||||
cdef dict buildDefaultConfiguration(str root_config_name,
|
cdef dict buildDefaultConfiguration(str root_config_name,
|
||||||
dict config)
|
dict config)
|
||||||
|
|
||||||
cpdef dict getConfiguration(str root_config_name,
|
cpdef dict getConfiguration(str root_config_name=?,
|
||||||
dict config)
|
dict config=?)
|
@ -12,7 +12,7 @@ from .command import getCommandsList
|
|||||||
from .logging cimport getLogger
|
from .logging cimport getLogger
|
||||||
from .arguments cimport buildArgumentParser
|
from .arguments cimport buildArgumentParser
|
||||||
|
|
||||||
from obitools3.version import version
|
from ..version import version
|
||||||
from _curses import version
|
from _curses import version
|
||||||
|
|
||||||
cdef dict __default_config__ = {}
|
cdef dict __default_config__ = {}
|
||||||
@ -57,13 +57,20 @@ cdef dict buildDefaultConfiguration(str root_config_name,
|
|||||||
return __default_config__
|
return __default_config__
|
||||||
|
|
||||||
|
|
||||||
cpdef dict getConfiguration(str root_config_name,
|
cpdef dict getConfiguration(str root_config_name="__default__",
|
||||||
dict config):
|
dict config={}):
|
||||||
global __default_config__
|
global __default_config__
|
||||||
|
|
||||||
if '__done__' in __default_config__:
|
if '__done__' in __default_config__:
|
||||||
return __default_config__
|
return __default_config__
|
||||||
|
|
||||||
|
if root_config_name=="__default__":
|
||||||
|
raise RuntimeError("No root_config_name specified")
|
||||||
|
|
||||||
|
if not config:
|
||||||
|
raise RuntimeError("Base configuration is empty")
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
config = buildDefaultConfiguration(root_config_name,
|
config = buildDefaultConfiguration(root_config_name,
|
||||||
config)
|
config)
|
||||||
|
Reference in New Issue
Block a user