Shortcut to load TEAL .cfg files for non-GUI access where
    loadOnly=True.
542489
def load(theTask, canExecute=True, strict=True, defaults=False):
    
    return teal(theTask, parent=None, loadOnly=True, returnAs="dict",
                canExecute=canExecute, strict=strict, errorsToTerm=True,
                defaults=defaults)
1235062
def _load_shader(filename):
    """"""
    curdir = op.dirname(op.realpath(__file__))
    glsl_path = op.join(curdir, 'glsl')
    path = op.join(glsl_path, filename)
    with open(path, 'r') as f:
        return f.read()
1279575
def load(name, base_path=None):
    """"""
    if '/' in name:
        return load_location(name, base_path, module=True)

    return importer.import_symbol(name, base_path)
784052
def _load(self):
        """"""
        for attr_name, config_prop in self._iter_config_props():
            found = False
            for loader in self._loaders:
                if loader.exists(config_prop.property_key):
                    raw_value = loader.get(config_prop.property_key)
                    converted_value = config_prop.load(raw_value)

                    self._set_instance_prop(attr_name, config_prop, converted_value)
                    found = True
                    break

            if not found:
                if not config_prop.required or config_prop.default is not None:
                    self._set_instance_prop(attr_name, config_prop, config_prop.default)
                else:
                    raise ValueError('Missing required ConfigProperty {}'.format(attr_name))
871596
def cfgdump(path, config):
    """"""
    dump = yaml_dump(config)
    if not os.path.exists(path):
        os.makedirs(path)
    with open(os.path.join(path, 'config.yaml'), 'w') as outf:
        outf.write(dump)
    print(dump)
703334
def load_abgfiles(dir=None):
    """"""
    import ephem,string
    if dir is None:
        import tkFileDialog
	try: 
            dir=tkFileDialog.askdirectory()
        except:
            return
    if dir is None:
        return None
    from glob import glob
    files=glob(dir+"/*.abg")
    import os
    for f in files:
        (name,ext)=os.path.splitext(os.path.basename(f))
	NAME=name.strip().upper()
	kbos[name]=f
	#print name
        aei=file(dir+"/"+name+".aei")
        lines=aei.readlines()
        aei.close()
        objInfoDict[name]="%6s %6s %6s\n" % ( string.center("a",6),
				            string.center("e",6),
	 				    string.center("i",6) ) 
        try:
          (a,e,i,N,w,T) = lines[4].split()
        except:
          print lines[4]
          (a,e,i,N,w,T) = (0,0,0,0,0,0)
        objInfoDict[name]+="%6.2f %6.3f %6.2f\n" % (float(a),float(e),float(i))
        s=lines[5][0:2]
        (a,e,i,N,w,T) = lines[5][2:-1].split()
        objInfoDict[name]+=" %6.3f %6.3f %6.3f\n" % (float(a),float(e),float(i))
        abg = file(dir+"/"+name+".abg")
        lines = abg.readlines()
        abg.close()
	for line in lines:
	    if not line[0:5] == "# Bar":
	        continue
            objInfoDict[name]+=line[2:-1]+"\n"
            break
        res=file(dir+"/"+name+".res")
        lines=res.readlines()
        res.close()
        line=lines.pop()
        values=line.split()
        s = "[nobs: "+values[0]+" dt: "+values[1]+"]\n"
        objInfoDict[name]+=s
        mpc = file(dir+"/../mpc/"+name+".mpc")
        lines=mpc.readlines()
        mpc.close()
	last_date=0
	for line in lines:
	    if len(line)==0:
		continue
	    if line[0]=="#":
		continue
            this_year=int(line[15:19])
            this_month=int(line[20:22])
            this_day = int(line[23:25])
	    this_date =  this_year+this_month/12.0 +this_day/365.25
	    if last_date < this_date:
		last_date=this_date
		year=this_year
		day = this_day
		month=this_month	
        mag={}
        for line in lines:
            try:
                mags=line[65:69].strip()
		if len(mags)==0:
		    continue
                filter=line[70]
	        if filter not in mag:
                    mag[filter]=[]
                mag[filter].append(float(mags)) 
	    except:
	        continue
        mags=''
        for filter in mag:
	    magv=0
 	    for m in mag[filter]:
	        magv = magv+m/len(mag[filter]) 
            mags = mags+ "%4.1f-%s " % ( magv , filter)
        if len(mags)==0:
	    mags= "N/A"
        objInfoDict[name]+="MAG: "+mags+"\n"
        objInfoDict[name]+="Last obs: %s %s %s \n" % (year,month, day)

    doplot(kbos)
1290167
def _load_lua_scripts(self):
        """"""
        # load lua scripts
        lua_script_path = os.path.join(
            os.path.dirname(os.path.abspath(__file__)),
            'scripts/lua'
        )
        with open(os.path.join(
                lua_script_path,
                'enqueue.lua'), 'r') as enqueue_file:
            self._lua_enqueue_script = enqueue_file.read()
            self._lua_enqueue = self._r.register_script(
                self._lua_enqueue_script)

        with open(os.path.join(
                lua_script_path,
                'dequeue.lua'), 'r') as dequeue_file:
            self._lua_dequeue_script = dequeue_file.read()
            self._lua_dequeue = self._r.register_script(
                self._lua_dequeue_script)

        with open(os.path.join(
                lua_script_path,
                'finish.lua'), 'r') as finish_file:
            self._lua_finish_script = finish_file.read()
            self._lua_finish = self._r.register_script(self._lua_finish_script)

        with open(os.path.join(
                lua_script_path,
                'interval.lua'), 'r') as interval_file:
            self._lua_interval_script = interval_file.read()
            self._lua_interval = self._r.register_script(
                self._lua_interval_script)

        with open(os.path.join(
                lua_script_path,
                'requeue.lua'), 'r') as requeue_file:
            self._lua_requeue_script = requeue_file.read()
            self._lua_requeue = self._r.register_script(
                self._lua_requeue_script)

        with open(os.path.join(
                lua_script_path,
                'metrics.lua'), 'r') as metrics_file:
            self._lua_metrics_script = metrics_file.read()
            self._lua_metrics = self._r.register_script(
                self._lua_metrics_script)
177005
def yaml_load(stream):
    """"""
    # Surprisingly, the CSafeLoader does not seem to be used by default.
    # Check whether the CSafeLoader is available and provide a log message
    # if it is not available.
    global _HAS_YAML_LIBRARY

    if _HAS_YAML_LIBRARY is None:
        _HAS_YAML_LIBRARY = hasattr(yaml, 'CSafeLoader')
        if not _HAS_YAML_LIBRARY:
            logger.warning('libyaml was not found! Please install libyaml to'
                           ' speed up loading the model files.')

    if _HAS_YAML_LIBRARY:
        loader = yaml.CSafeLoader(stream)
    else:
        loader = yaml.SafeLoader(stream)
    loader.add_constructor('tag:yaml.org,2002:float', float_constructor)
    return loader.get_data()
411905
function (cfg) {
            if (!ariaCoreJsonValidator.normalize({
                json : cfg,
                beanName : "aria.templates.CfgBeans.InitTemplateCfg"
            })) {
                return false;
            }
            this._out = null;
            this._cfg = cfg;
            if (cfg.id) {
                this._id = cfg.id;
            } else {
                this._id = "tpl" + idCount;
                idCount++;
            }

            if (Aria.testMode) {
                this._prefixIds = {};
            }

            // if the template has been customized, the widget returns already the actual (customized) classpath
            this.tplClasspath = cfg.classpath;

            // TODO: check if cfg.classpath corresponds to a template is a template
            var tpl;
            try {
                tpl = Aria.getClassInstance(cfg.classpath);
            } catch (e) {
                this.$logError(this.TEMPLATE_CONSTR_ERROR, [cfg.classpath], e);
                return false;
            }
            this._tpl = tpl;

            // set the macro after tpl
            if (cfg.macro == null) {
                cfg.macro = {
                    name : "main",
                    args : cfg.args,
                    scope : tpl
                };
            }
            cfg.macro = this.checkMacro(cfg.macro);

            // PTR05228660: use private interface for performances
            var context = cfg.context, moduleCtrl = cfg.moduleCtrl, data = cfg.data;
            var privateInfo, moduleCtrlPrivate;

            // retrieve information from context if not specified
            if (context && !moduleCtrl) {
                if (!data) {
                    data = context.data;
                }
                moduleCtrl = context.moduleCtrl;
            }

            if (moduleCtrl) {
                // When a moduleCtrl is used, the ModuleCtrlFactory should be loaded.
                // However, the ModuleCtrlFactory is not a static dependency cause sometimes we don't need it.
                // TODO: today, we just fail if it's not here, replace this with a silent dynamic loading
                // (Aria.load)
                if (!aria.templates.ModuleCtrlFactory) {
                    this.$logError(this.MISSING_MODULE_CTRL_FACTORY, [cfg.classpath]);
                } else {

                    if (!__getModulePrivateInfo) {
                        __getModulePrivateInfo = aria.templates.ModuleCtrlFactory.__getModulePrivateInfoMethod();
                    }
                    privateInfo = __getModulePrivateInfo.call(this, moduleCtrl);

                    if (!privateInfo) {
                        // if privateInfo is null, it means either the module controller was not created through
                        // aria.templates.ModuleCtrlFactory or it was already disposed (error was already logged in
                        // __getModulePrivateInfo)
                        return false;
                    }
                    moduleCtrlPrivate = privateInfo.moduleCtrlPrivate;

                    if (!data) {
                        data = moduleCtrlPrivate.getData();
                    } else {
                        // data where specified. If a context was also specified, try to match data with a sub
                        // controller
                        if (context) {
                            var newModuleCtrl = moduleCtrlPrivate.getSubModuleCtrl(data);
                            if (newModuleCtrl != moduleCtrl) {
                                moduleCtrl = newModuleCtrl;
                                // update moduleCtrl info
                                privateInfo = __getModulePrivateInfo.call(this, moduleCtrl);
                                if (!privateInfo) {
                                    // if privateInfo is null, it means either the module controller was not created
                                    // through aria.templates.ModuleCtrlFactory or it was already disposed (error
                                    // was already logged in __getModulePrivateInfo)
                                    return false;
                                }
                                moduleCtrlPrivate = privateInfo.moduleCtrlPrivate;
                            }
                        }
                    }
                }
            }

            this.data = data;
            this.moduleCtrl = moduleCtrl;
            if (privateInfo) {
                this.flowCtrl = privateInfo.flowCtrl;
                this.flowCtrlPrivate = privateInfo.flowCtrlPrivate;
                this.moduleCtrlPrivate = moduleCtrlPrivate;
                this.moduleRes = moduleCtrlPrivate.getResourceSet();
            }

            // update configuration
            cfg.data = data;
            cfg.moduleCtrl = moduleCtrl;

            // register this template in the templateCtxtManager
            ariaTemplatesTemplateCtxtManager.add(this);

            if (this.data != null) {
                this.__dataGround = {
                    data : this.data
                };
            }

            // We no longer create new methods in a closure each time a new instance of a template is created,
            // instead we use the interface mechanism to expose methods to the template and prevent access to the
            // template context
            // LEAK & PERF IMPROVMENT : interface on these two functions results in poor performance and leaks

            var oSelf = this, index, name;

            for (index = 0; name = paramMapping[index]; index++) {
                tpl[name] = this[name];
            }

            var functionUtils = ariaUtilsFunction;
            for (index = 0; name = methodMapping[index]; index++) {
                tpl[name] = functionUtils.bind(this[name], this);
            }

            // do not use bind for __$write as this method is called intensively (Perf improvment)
            tpl.__$write = function (s, line) {
                return oSelf.__$write(s, line, this.$classpath);
            };

            if (this.moduleCtrl) {
                this.moduleCtrl.$on({
                    '*' : {
                        fn : tpl.onModuleEvent,
                        scope : tpl
                    },
                    'beforeDispose' : {
                        fn : this._beforeModuleDispose,
                        scope : this
                    }
                });
            }
            if (this.flowCtrl) {
                this.flowCtrl.$on({
                    '*' : tpl.onFlowEvent,
                    scope : tpl
                });
            }

            this._width = {};
            this._height = {};
            this.$setViewportWidth(ariaTemplatesLayout.realWidth(cfg.width));
            this.$setViewportHeight(ariaTemplatesLayout.realHeight(cfg.height));
            this.$setSizeCfg(tpl.__$width, tpl.__$height);
            this.__addDebugInfo(cfg.tplDiv);
            var res = tpl.__$initTemplate();
            this.__loadLibs(tpl.__$macrolibs, "macrolibs");
            return res;
        }
150077
def load(self):
        """"""

        # Config files prior to 0.2.4 dor not have config version keys
        old_config = not self.cfg_file.Exists("config_version")

        # Reset data
        self.data.__dict__.update(self.defaults.__dict__)

        for key in self.defaults.__dict__:
            if self.cfg_file.Exists(key):
                setattr(self.data, key, self.cfg_file.Read(key))

        # Reset keys that should be reset on version upgrades
        if old_config or self.version != self.data.config_version:
            for key in self.reset_on_version_change:
                setattr(self.data, key, getattr(DefaultConfig(), key))
            self.data.config_version = self.version

        # Delete gpg_key_uid and insert fingerprint key

        if hasattr(self.data, "gpg_key_uid"):
            oldkey = "gpg_key_uid"
            delattr(self.data, oldkey)
            newkey = "gpg_key_fingerprint"
            setattr(self.data, newkey, getattr(DefaultConfig(), newkey))
1150549
def load(cls, filename=None):
        """"""
        if filename is None:
            LOGGER.debug("Loading default configuration.")
            with open_text(templates, "test_config.yml",
                           encoding="utf-8") as file_handle:
                content = yaml.load(file_handle)
        else:
            LOGGER.debug("Loading custom configuration '%s'.", filename)
            try:
                with open(filename, encoding="utf-8") as file_handle:
                    content = yaml.load(file_handle)
            except IOError as err:
                LOGGER.error(
                    "Failed to load the custom configuration '%s'. Skipping.",
                    filename)
                LOGGER.debug(str(err))
                content = dict()
        return cls(content)
261680
def browse( parent, filename = '' ):
        
        dlg = XdkWindow(parent)
        dlg.show()
        
        if ( filename ):
            dlg.loadFilename(filename)
666577
def load_toolbars(self):
        """"""
        toolbars_names = CONF.get('main', 'last_visible_toolbars', default=[])
        if toolbars_names:
            dic = {}
            for toolbar in self.toolbars:
                dic[toolbar.objectName()] = toolbar
                toolbar.toggleViewAction().setChecked(False)
                toolbar.setVisible(False)
            for name in toolbars_names:
                if name in dic:
                    dic[name].toggleViewAction().setChecked(True)
                    dic[name].setVisible(True)
1171134
def load(self, filename=None):
        """"""
        assert not self.__flag_loaded, "File can be loaded only once"
        if filename is None:
            filename = self.default_filename
        assert filename is not None, \
            "{0!s} class has no default filename".format(self.__class__.__name__)

        # Convention: trying to open empty file is an error,
        # because it could be of (almost) any type.

        size = os.path.getsize(filename)
        if size == 0:
            raise RuntimeError("Empty file: '{0!s}'".format(filename))

        self._test_magic(filename)
        self._do_load(filename)
        self.filename = filename
        self.__flag_loaded = True
750
def load_code(name, base_path=None, recurse=False):
    """"""
    if '/' in name:
        return load_location(name, base_path, module=False)

    return importer.import_code(name, base_path, recurse=recurse)
715645
def load_yaml(filepath):
    """"""
    with open(filepath) as f:
        txt = f.read()
    return yaml.load(txt)
1253771
def load(self):
        """"""
        try:
            with open(self.config_file) as configfile:
                self.config = yaml.load(configfile)
        except TypeError:
            # no config file (use environment variables)
            pass
        if self.config:
            self.prefix = self.config.get('config_prefix', None)
        if not self.prefix:
            if os.getenv(self.config_prefix):
                self.prefix = os.getenv(self.config_prefix)
            else:
                for path in [
                    os.path.join(self.basepath, self.default_file),
                    os.path.join(self.config_root, self.default_file)
                ]:
                    if os.path.exists(path):
                        with open(path) as conf:
                            config = yaml.load(conf)
                            prefix = config.get(
                                self.config_prefix.lower(), None
                            )
                            if prefix:
                                self.prefix = prefix
                                break