raise RuntimeError, "Unable to find the XML constraints directory in your CASAPATH" return xmlpath.path ####---------------------------------------------------------- casa = find_casa() if casa.has_key("state") and casa["state"].has_key("init_version") and casa["state"]["init_version"] > 0: # ##allow globals for taskby default casaglobals = True casac = stack_find("casac") casalog = stack_find("casalog") gentools = stack_find("gentools") qatool = stack_find("qatool") qa = stack_find("qa") utilstool = stack_find("utilstool") cu = stack_find("cu") tbtool = stack_find("tbtool") tb = stack_find("tb") ms = stack_find("ms") mstool = stack_find("mstool") aftool = stack_find("aftool") cbtool = stack_find("cbtool") cltool = stack_find("cltool") write_history = stack_find("write_history") me = stack_find("me")
xmlpath.path = __casapath__ + "/xml" else: raise RuntimeError, "Unable to find the XML constraints directory in your CASAPATH" return xmlpath.path ####---------------------------------------------------------- casa = find_casa( ) if casa.has_key('state') and casa['state'].has_key('init_version') and casa['state']['init_version'] > 0: # ##allow globals for taskby default casaglobals=True casac = stack_find("casac") casalog = stack_find("casalog") gentools = stack_find("gentools") qatool = stack_find("qatool") qa = stack_find("qa") utilstool = stack_find("utilstool") cu = stack_find("cu") tbtool = stack_find("tbtool") tb = stack_find("tb") ms = stack_find("ms") mstool = stack_find("mstool") aftool = stack_find("aftool") cbtool = stack_find("cbtool") cltool = stack_find("cltool") write_history = stack_find("write_history") me = stack_find("me")
def add_shutdown_hook( func ): shutdown_handlers = stack_find('casa_shutdown_handlers','root') if shutdown_handlers is None: raise RuntimeError("unable to find casa shutdown hook list") else: shutdown_handlers.append(func)
def __init__(self): self.casa_builtins = stack_find('casa_builtins', 'root')
from IPython.core.error import InputRejected from casa_stack_manip import stack_find __casa = stack_find('casa') if __casa.has_key('state') and __casa['state'].has_key( 'init_version') and __casa['state']['init_version'] > 0: #### this provides two functions: #### register_builtin(str or [str]) - register builtin values #### enable_builtin_protection( ) - turn on builtin value protection import ast def static_var(varname, value): def decorate(func): setattr(func, varname, value) return func return decorate @static_var("builtin_dict", stack_find('casa_builtins', 'root')) def register_builtin(obj): if isinstance(obj, str): register_builtin.builtin_dict[obj] = True elif isinstance(obj, list) and all( isinstance(elem, str) for elem in obj): for b in obj: register_builtin.builtin_dict[b] = True else: raise RuntimeError("parameter is not a string or list of strings")
def add_shutdown_hook(func): shutdown_handlers = stack_find('casa_shutdown_handlers', 'root') if shutdown_handlers is None: raise RuntimeError("unable to find casa shutdown hook list") else: shutdown_handlers.append(func)