Loads sidecar or creates one
972051
def get_sidecar(fname, allowedfileformats='default'):
    
    if allowedfileformats == 'default':
        allowedfileformats = ['.tsv', '.nii.gz']
    for f in allowedfileformats:
        fname = fname.split(f)[0]
    fname += '.json'
    if os.path.exists(fname):
        with open(fname) as fs:
            sidecar = json.load(fs)
    else:
        sidecar = {}
    if 'filestatus' not in sidecar:
        sidecar['filestatus'] = {}
        sidecar['filestatus']['reject'] = False
        sidecar['filestatus']['reason'] = []
    return sidecar
1324942
def startLoading(self):
        
        if self._loading:
            return False
        
        tree = self.treeWidget()
        if not tree:
            return
        
        self._loading = True
        self.setText(0, '')
        
        # create the label for this item
        lbl = QtGui.QLabel(self.treeWidget())
        lbl.setMovie(XLoaderWidget.getMovie())
        lbl.setAlignment(QtCore.Qt.AlignCenter)
        tree.setItemWidget(self, 0, lbl)
        
        try:
            tree.loadStarted.emit(self)
        except AttributeError:
            pass
        
        return True
1095892
def make_object(self, state=None, backend=None):
        ''''''
        model = self.model
        obj = model.__new__(model)
        self.load_state(obj, state, backend)
        return obj
355883
static function Init()
	{
		require_once 'verysimple/Phreeze/Controller.php';
		require_once 'verysimple/HTTP/RequestUtil.php';

		if (!self::$IS_INITIALIZED)
		{
			RequestUtil::NormalizeUrlRewrite();

			Controller::$SmartyViewPrefix = '';
			Controller::$DefaultRedirectMode = 'header';

			self::$IS_INITIALIZED = true;
		}

	}
817788
def register_finders():
  """"""

  # If the previous finder is set, then we've already monkeypatched, so skip.
  global __PREVIOUS_FINDER
  if __PREVIOUS_FINDER:
    return

  # save previous finder so that it can be restored
  previous_finder = _get_finder(zipimport.zipimporter)
  assert previous_finder, 'This appears to be using an incompatible setuptools.'

  # Enable finding zipped wheels.
  pkg_resources.register_finder(
      zipimport.zipimporter, ChainedFinder.of(pkg_resources.find_eggs_in_zip, find_wheels_in_zip))

  # append the wheel finder
  _add_finder(pkgutil.ImpImporter, find_wheels_on_path)

  if importlib_machinery is not None:
    _add_finder(importlib_machinery.FileFinder, find_wheels_on_path)

  __PREVIOUS_FINDER = previous_finder
491378
protected function loadMiddleware()
    {
        $middlewareLoader = new MiddlewareLoader($this->getClassLoader());
        $middlewareLoader->initialize();

        $this->setConfig("runtime.middlewares", $middlewareLoader->getMiddlewares());
    }
728557
function loadSubTree(root, own) {
            var loadSubTrees = function (nodes) {
                    for (var i = 0; i < nodes.length; i++) {
                        nodes[i] = self.loadSubTree(nodes[i], own);
                    }
                    return TASYNC.lift(nodes);

                },
                childLoading = own === true ? self.loadOwnChildren : self.loadChildren;
            return TASYNC.call(function (children) {
                if (children.length < 1) {
                    return [root];
                } else {
                    return TASYNC.call(function (subArrays) {
                        var nodes = [],
                            i;
                        for (i = 0; i < subArrays.length; i++) {
                            nodes = nodes.concat(subArrays[i]);
                        }
                        nodes.unshift(root);
                        return nodes;
                    }, loadSubTrees(children));
                }
            }, childLoading(root));
        }
956665
function init(options) {

    var fs = require('fs');
    var path = require('path');
    var rootdir = path.dirname(require.main);
    var options = options || {
        config: require(path.join(rootdir, 'config.json')),
        root: rootdir,
        callback: function (noop) {}
    };
    var def = {};
    function ModulePaths (moduledir) {
        this.moduledir = moduledir;
    }

    ModulePaths.prototype.then = function (accept, reject) {
      var moduledir = this.moduledir;
      fs.readdir(moduledir, function (err, files) {
        if (err) reject(err);
        files.forEach(function (file) {
            var name = path.basename(file, '.js');
            def[name] = path.join(moduledir, name);
        });
        accept();
      });
    };
    var pubpath = new ModulePaths(path.join(path.dirname(module.filename), '..', 'public', 'js'));
    var prvpath = new ModulePaths(path.join(path.dirname(module.filename), '..', 'private', 'js'));

    Promise.all([pubpath, prvpath])
        .then(function () {
            var requirejs = require('requirejs');
            requirejs.config({
                baseUrl: path.join(rootdir),
                paths: def
            });

            requirejs(['loader_factory'], function (LoaderFactory) {
                var fs = require('fs');
                var config = options.config;
                config.paths.push(path.dirname(pubpath.moduledir));
                var loader = 'loader_express';
                var db = 'db_mongo';
                if (config.loader) loader = config.loader;
                if (config.db) db = config.db;

                new LoaderFactory().create(loader, db, function (loader) {
                    loader.init(config, options.callback);
                });
            });
        })
    .catch(function (err) {
        console.error('err:', err);
    });
}
851214
function load(PATH, sequelize, opts) {
  var files = fs.readdirSync(PATH),
    models = {};
  opts = opts || {};

  if (opts.exclude) {
    removeAll(opts.exclude, files);
  }

  files.forEach(function (file) {
    if (fs.statSync(path.join(PATH, file)).isDirectory()) {
      models[file] = load(path.join(PATH, file), sequelize, opts);
    } else {
      file = file.split('.')[0];
      var model = sequelize.import(path.join(PATH, file))
      models[model.name] = model;
    }
  });
  return models;
}
1195130
public function init()
    {
        parent::init();
        if ($this->route === null && Yii::$app->controller !== null) {
            $this->route = Yii::$app->controller->getRoute();
        }
        if ($this->params === null) {
            $this->params = Yii::$app->request->getQueryParams();
        }
        if ($this->treeviewCaret === null) {
            $this->treeviewCaret = FA::icon('angle-left')->pullRight();
        }
        Html::addCssClass($this->options, ['widget' => 'sidebar-menu']);
    }
731363
def loading(self):
        """"""
        if getattr(self, '_initialized', False):
            raise ValueError("Already loading")
        self._initialized = False
        yield
        self._initialized = True
27772
public function load() {
		session_start();

		$this->loadSiteClass();
		$this->checkRedirect();
		$this->applyViewRenderer();

		$this->loadController();
		$this->render();

	}
858361
private static void loadDriver(String classname) throws ClassNotFoundException, InstantiationException, IllegalAccessException {
		if(!driversLoaded.containsKey(classname)) {
			Object O = Class.forName(classname).newInstance();
			driversLoaded.putIfAbsent(classname, O);
		}
	}
371036
def _load_or_create(self, *argv, **kwargs):
        
        if self.path.exists():
            self._info('loading work from {}'.format(self.path))
            with open(self.path, 'rb') as f:
                obj = pickle.load(f)
        else:
            self._info('saving work to {}'.format(self.path))
            with open(self.path, 'wb') as f:
                obj = self._do_work(*argv, **kwargs)
                pickle.dump(obj, f)
        return obj
22858
private function load()
    {
        if (file_exists(static::FILENAME)) {
            return MutableBag::from(Yaml::parse(file_get_contents(static::FILENAME)) ?: []);
        }

        return MutableBag::of();
    }
186140
private function autoload()
    {
        $app = $this;
        $finder = new Finder();

        foreach ($finder->in($app['singular.directory.app'])->files()->name('*.php') as $file) {
            include_once $file->getRealpath();
        }
    }
148274
public function load() {
		if ( true === $this->is_admin_loaded ) {
			return;
		}

		$this->loader->load();
		$this->is_admin_loaded = true;
	}