Try and load an index file from the various places it might exist.

    If the legacy file cannot be found or cannot be parsed, return None.

    This method should only be called on a robot.
347683
def _legacy_index() -> Union[None, Dict[str, str]]:
    
    for index in _LEGACY_INDICES:
        if index.exists():
            try:
                return json.load(open(index))
            except (OSError, json.JSONDecodeError):
                return None
    return None
1247277
def load(file)
      if file.nil? || !File.exist?(file)
        raise "Can't open #{file}."
      end
      loader = ReVIEW::YAMLLoader.new
      merge_config(@config.deep_merge(loader.load_file(file)))
    end
281386
def resolve(self, current_file, rel_path):
    """"""
    search_path = [path.dirname(current_file)] + self.search_path

    target_path = None
    for search in search_path:
      if self.exists(path.join(search, rel_path)):
        target_path = path.normpath(path.join(search, rel_path))
        break

    if not target_path:
      raise exceptions.EvaluationError('No such file: %r, searched %s' %
                            (rel_path, ':'.join(search_path)))

    return target_path, path.abspath(target_path)
931976
def version_from_file
      if File.exist?(Rails.root.join("REVISION"))
        File.read(Rails.root.join("REVISION")).chomp
      end
    end
569823
def load(self, instance, xblock):
        

        # TODO: Get xblock from context, once the plumbing is piped through
        if djpyfs:
            return djpyfs.get_filesystem(scope_key(instance, xblock))
        else:
            # The reference implementation relies on djpyfs
            # https://github.com/edx/django-pyfs
            # For Django runtimes, you may use this reference
            # implementation. Otherwise, you will need to
            # patch pyfilesystem yourself to implement get_url.
            raise NotImplementedError("djpyfs not available")
764051
def read_index_iter(self):
        

        with fopen(self.vpk_path, 'rb') as f:
            f.seek(self.header_length)

            while True:
                if self.version > 0 and f.tell() > self.tree_length + self.header_length:
                    raise ValueError("Error parsing index (out of bounds)")

                ext = _read_cstring(f)
                if ext == '':
                    break

                while True:
                    path = _read_cstring(f)
                    if path == '':
                        break
                    if path != ' ':
                        path = os.path.join(path, '')
                    else:
                        path = ''

                    while True:
                        name = _read_cstring(f)
                        if name == '':
                            break

                        (crc32,
                         preload_length,
                         archive_index,
                         archive_offset,
                         file_length,
                         suffix,
                         ) = metadata = list(struct.unpack("IHHIIH", f.read(18)))

                        if suffix != 0xffff:
                            raise ValueError("Error while parsing index")

                        if archive_index == 0x7fff:
                            metadata[3] = self.header_length + self.tree_length + archive_offset

                        metadata = (f.read(preload_length),) + tuple(metadata[:-1])

                        yield path + name + '.' + ext, metadata
502532
def load(cls, directory):
    
    read_file = maybe_read_file(cls._path(directory))
    if read_file:
      fingerprint, length = read_file.split(':')
      return Digest(fingerprint, int(length))
    else:
      return None
584752
def _load_file(self, filename):
        
        filename = os.path.abspath(os.path.expanduser(filename))
        # test if file exists
        if not os.path.isfile(filename):
            raise Exception('File %s does not exist' % filename)

        # Get extension
        ext = vtki.get_ext(filename)
        # Extensions: .vtm and .vtmb

        # Select reader
        if ext in ['.vtm', '.vtmb']:
            reader = vtk.vtkXMLMultiBlockDataReader()
        else:
            raise IOError('File extension must be either "vtm" or "vtmb"')

        # Load file
        reader.SetFileName(filename)
        reader.Update()
        self.ShallowCopy(reader.GetOutput())
611845
def load_datafile(name, search_path=('.'), codecs=get_codecs(), **kwargs):
    
    mod = find_datafile(name, search_path, codecs)
    if not mod:
        if 'default' in kwargs:
            return kwargs['default']
        raise IOError("file %s not found in search path %s" %(name, str(search_path)))

    (codec, datafile) = mod[0]
    return codec().load(open(datafile))
1114874
def load(self, filename):
        
        try:
            self._xroot = ElementTree.parse(filename).getroot()
            self._xstack = [self._xroot]
        except ExpatError:
            self.clear()
        
        return self._xroot is not None
81137
def load(root_file, use_proxy=True, key=None):
    
    if isinstance(root_file, string_types):
        root_file = root_open(root_file)
        own_file = True
    else:
        own_file = False
    obj = Unpickler(root_file, use_proxy).load(key)
    if own_file:
        root_file.Close()
    return obj
921634
private R load(int n, Index editInPlace) {
        assert Thread.holdsLock(this);
        assert dir != null;
        R v = load(new File(dir, String.valueOf(n)), editInPlace);
        if (v==null && editInPlace!=null) {
            // remember the failure.
            // if editInPlace==null, we can create a new copy for this, but not sure if it's worth doing,
            // TODO should we also update numberOnDisk?
            editInPlace.byNumber.put(n, null);
        }
        return v;
    }
990024
def _load_first(self, target_uris, load_method, **kwargs):
        
        if isinstance(target_uris, string_types):
            target_uris = [target_uris]

        # TODO: Move the list logic into the extension, otherwise a
        # load will always try all missing files first.
        # TODO: How would multiple protocols work, should the registry hold
        # persist copies?
        for target_uri in target_uris:
            target = urlsplit(target_uri, scheme=self.default_protocol)

            extension = self.get_extension(target.scheme)
            query = extension.conform_query(target.query)
            try:
                yaml_dict = extension.load_target(
                    target.scheme,
                    target.path,
                    target.fragment,
                    target.username,
                    target.password,
                    target.hostname,
                    target.port,
                    query,
                    load_method,
                    **kwargs
                )
                return yaml_dict
            except extension.not_found_exception:
                pass

        raise IOError("unable to load: {0}".format(target_uris))
777371
def _load_from_file(self, filename):
    """"""
    if not tf.gfile.Exists(filename):
      raise ValueError("File %s not found" % filename)
    with tf.gfile.Open(filename) as f:
      self._load_from_file_object(f)
1065638
def load(self):
        
        try:
            with open(self.file_root + '.pkl', "rb") as f:
                return pickle.load(f)
        except IOError:
            raise CacheMissing(self.file_root)
1166443
def search_for_file(path_suffix)
      path_suffix = path_suffix + '.rb' unless path_suffix.ends_with? '.rb'
      load_paths.each do |root|
        path = File.join(root, path_suffix)
        return path if File.file? path
      end
      nil # Gee, I sure wish we had first_match ;-)
    end
868885
def load(self, patterns, dirs, ignore=None):
        
        for path in self.find_files(patterns=patterns, dirs=dirs, ignore=ignore):
            data = self.read_file(path=path)
            if data:
                self.paths[path] = data