loads an rml mapping into memory

        args:
            rml_name(str): the name of the rml file
6722
def load_rml(self, rml_name):
        
        conn = CFG.rml_tstore
        cache_path = os.path.join(CFG.CACHE_DATA_PATH, 'rml_files', rml_name)
        if not os.path.exists(cache_path):
            results = get_graph(NSM.uri(getattr(NSM.kdr, rml_name), False),
                                conn)
            with open(cache_path, "w") as file_obj:
                file_obj.write(json.dumps(results, indent=4))
        else:
            results = json.loads(open(cache_path).read())
        self.rml[rml_name] = RdfDataset(results)
        return self.rml[rml_name]
1297399
def get_name_curr(self, name):
        
        self._register_name(name)

        return self._var_name_mappers[name].get_current()
1230787
def __load(file_name):
        

        if os.path.exists(file_name) and not os.path.isfile(file_name):
            raise RuntimeError(
                'Cache should be initialized with valid full file name')
        if not os.path.exists(file_name):
            open(file_name, 'w+b').close()
            return {}
        cache_file_obj = open(file_name, 'rb')
        try:
            file_cache_t.logger.info('Loading cache file "%s".', file_name)
            start_time = timeit.default_timer()
            cache = pickle.load(cache_file_obj)
            file_cache_t.logger.debug(
                "Cache file has been loaded in %.1f secs",
                (timeit.default_timer() - start_time))
            file_cache_t.logger.debug(
                "Found cache in file: [%s]  entries: %s",
                file_name, len(list(cache.keys())))
        except (pickle.UnpicklingError, AttributeError, EOFError,
                ImportError, IndexError) as error:
            file_cache_t.logger.exception(
                "Error occurred while reading cache file: %s",
                error)
            cache_file_obj.close()
            file_cache_t.logger.info(
                "Invalid cache file: [%s]  Regenerating.",
                file_name)
            open(file_name, 'w+b').close()   # Create empty file
            cache = {}                       # Empty cache
        finally:
            cache_file_obj.close()
        return cache
341623
def load(self , filename=None, data=None):
        

        self.__load(filename=filename, data=data)
469404
def load_model(
            self, the_metamodel, filename, is_main_model, encoding='utf-8',
            add_to_local_models=True):
        

        if not self.local_models.has_model(filename):
            if self.all_models.has_model(filename):
                new_model = self.all_models.filename_to_model[filename]
            else:
                # print("LOADING {}".format(filename))
                # all models loaded here get their references resolved from the
                # root model
                new_model = the_metamodel.internal_model_from_file(
                    filename, pre_ref_resolution_callback=lambda
                    other_model: self.pre_ref_resolution_callback(other_model),
                    is_main_model=is_main_model, encoding=encoding)
                self.all_models.filename_to_model[filename] = new_model
            # print("ADDING {}".format(filename))
            if add_to_local_models:
                self.local_models.filename_to_model[filename] = new_model
        assert self.all_models.has_model(filename)  # to be sure...
        return self.all_models.filename_to_model[filename]
522653
def load_array(self, fn, name):
        

        if os.path.exists(fn + '.npz'):
            array = np.load(fn + '.npz')
            try:
                setattr(self, name, array['arr_0'])
            except Exception, e:
                print e
            finally:
                array.close()

        else:
            raise RuntimeError("File %s does not exist." % (fn + '.npz'))
902188
def load_module(self, name):
        
        # Implementation inspired from pytest.rewrite and importlib

        # If there is an existing module object named 'name' in
        # sys.modules, the loader must use that existing module. (Otherwise,
        # the reload() builtin will not work correctly.)
        if name in sys.modules:
            return sys.modules[name]
        try:
            # we have already done the search, an gone through package layers
            # so we directly feed the latest module and correct path
            # to reuse the logic for choosing the proper loading behavior

            # TODO : double check maybe we do not need the loop here, already handled by finders in dir hierarchy
            # TODO : use exec_module (recent, more tested API) from here
            for name_idx, name_part in enumerate(name.split('.')):
                pkgname = ".".join(name.split('.')[:name_idx+1])
                if pkgname not in sys.modules:
                    if '.' in pkgname:
                        # parent has to be in sys.modules. make sure it is a package, else fails
                        if '__path__' in vars(sys.modules[pkgname.rpartition('.')[0]]):
                            path = sys.modules[pkgname.rpartition('.')[0]].__path__
                        else:
                            raise ImportError("{0} is not a package (no __path__ detected)".format(pkgname.rpartition('.')[0]))
                    else:  # using __file__ instead. should always be there.
                        path = os.path.dirname(sys.modules[pkgname].__file__)if pkgname in sys.modules else None
                    try:
                        file, pathname, description = imp.find_module(pkgname.rpartition('.')[-1], path)
                        sys.modules[pkgname] = imp.load_module(pkgname, file, pathname, description)
                    finally:
                        if file:
                            file.close()
        except:
            # dont pollute the interpreter environment if we dont know what we are doing
            if name in sys.modules:
                del sys.modules[name]
            raise
        return sys.modules[name]
1245639
def load_from_object(self, object_name):
        
        for key in dir(object_name):
            if key.isupper():
                self[key] = getattr(object_name, key)
781456
def load(self, ptr, name='', align=None):
        
        if not isinstance(ptr.type, types.PointerType):
            raise TypeError("cannot load from value of type %s (%r): not a pointer"
                            % (ptr.type, str(ptr)))
        ld = instructions.LoadInstr(self.block, ptr, name)
        ld.align = align
        self._insert(ld)
        return ld
436906
def _load_texture(file_name, resolver):
    
    file_data = resolver.get(file_name)
    image = PIL.Image.open(util.wrap_as_stream(file_data))
    return image
579511
def rm_rf(name):
  
  if not os.path.exists(name):
    return

  try:
    # Avoid using safe_rmtree so we can detect failures.
    shutil.rmtree(name)
  except OSError as e:
    if e.errno == errno.ENOTDIR:
      # 'Not a directory', but a file. Attempt to os.unlink the file, raising OSError on failure.
      safe_delete(name)
    elif e.errno != errno.ENOENT:
      # Pass on 'No such file or directory', otherwise re-raise OSError to surface perm issues etc.
      raise
976616
def _load_ngram(name):
    
    module = importlib.import_module('lantern.analysis.english_ngrams.{}'.format(name))
    return getattr(module, name)
647068
def pickle_load(name, extension='.pkl'):
    
    filename = name + extension
    infile = open(filename, 'rb')
    data = pickle.load(infile)
    infile.close()
    return data
595078
def load(self, name, parent_path=None):
        
        if name not in self.templates:
            self.templates[name] = self._create_template(name)
        return self.templates[name]
244130
def load(self, file_name):
        

        new_rundata = self.loader(file_name)
        new_rundata = self.inspect(new_rundata)
        return new_rundata
345970
def _loaddata_template(self, stringbuffer, index, name, opts):
        
        context = self._get_dump_item_context(index, name, opts)

        stringbuffer.write(self.loadder_item_template.format(**context))

        return stringbuffer
1298275
def load_by_name name
      path = self.locate_definition name
      raise TargetLoadError.new("Target definition file does not exist for #{name}") if path.nil?
      config = YAML::load_file(path)
      raise TargetLoadError.new("Target definition file #{path} is not valid YAML") if config.nil?
      config = config.deep_symbolize
      self.store_config config
      self.check_constructor name
      self.load_constructor
    end