Read the pseudopotential descriptor from file filename.

        Returns:
            Pseudopotential descriptor. None if filename is not a valid pseudopotential file.

        Raises:
            `PseudoParserError` if fileformat is not supported.
434268
def read_ppdesc(self, filename):
        
        if filename.endswith(".xml"):
            raise self.Error("XML pseudo not supported yet")

        else:
            # Assume file with the abinit header.
            lines = _read_nlines(filename, 80)

            for lineno, line in enumerate(lines):

                if lineno == 2:
                    try:
                        tokens = line.split()
                        pspcod, pspxc = map(int, tokens[:2])
                    except:
                        msg = "%s: Cannot parse pspcod, pspxc in line\n %s" % (filename, line)
                        logger.critical(msg)
                        return None

                    #if tokens[-1].strip().replace(" ","") not in ["pspcod,pspxc,lmax,lloc,mmax,r2well",
                    #                              "pspcod,pspxc,lmax,llocal,mmax,r2well"]:
                    #    raise self.Error("%s: Invalid line\n %s"  % (filename, line))
                    #    return None

                    if pspcod not in self._PSPCODES:
                        raise self.Error("%s: Don't know how to handle pspcod %s\n" % (filename, pspcod))

                    ppdesc = self._PSPCODES[pspcod]

                    if pspcod == 7:
                        # PAW -> need to know the format pspfmt
                        tokens = lines[lineno+1].split()
                        pspfmt, creatorID = tokens[:2]
                        #if tokens[-1].strip() != "pspfmt,creatorID":
                        #    raise self.Error("%s: Invalid line\n %s" % (filename, line))
                        #    return None

                        ppdesc = ppdesc._replace(format = pspfmt)

                    return ppdesc

            return None
769812
def from_file(self, filename):
        
        with gzip.open(filename, 'rb') as f:
            self.parse(f.read())
1238278
def parsefile(self, filename):
        
        with open(filename, 'rb') as fd:
            return self.parse(fd.read())
856597
def ReadFile(self, filename):
    
    with io.open(filename, 'r', encoding='utf-8') as file_object:
      for artifact_definition in self.ReadFileObject(file_object):
        yield artifact_definition
1167840
def read_file(filename):
    
    if os.path.isfile(filename):
        with open(filename, 'r') as f:
            return f.read()
983064
def read_relative_file(filename):
    """"""
    with open(join(dirname(abspath(__file__)), filename)) as f:
        return f.read()
141855
def read_file(filename: str, force_reload=False):
    

    if force_reload:
        _delete_cached_file(filename)

    reloaded = False
    mtime = os.path.getmtime(filename)
    cache_info = CACHE.setdefault(filename, {})

    if not cache_info or mtime > cache_info.get('mtime', 0):
        LOG.debug('Reloading cached file %s', filename)
        with open(filename) as fp:
            cache_info['data'] = fp.read()
        cache_info['mtime'] = mtime
        reloaded = True

    return reloaded, cache_info['data']
392639
def _ReadParserPresetsFromFile(self):
    
    self._presets_file = os.path.join(
        self._data_location, self._PRESETS_FILE_NAME)
    if not os.path.isfile(self._presets_file):
      raise errors.BadConfigOption(
          'No such parser presets file: {0:s}.'.format(self._presets_file))

    try:
      parsers_manager.ParsersManager.ReadPresetsFromFile(self._presets_file)
    except errors.MalformedPresetError as exception:
      raise errors.BadConfigOption(
          'Unable to read presets from file with error: {0!s}'.format(
              exception))
1368888
def read(self, filename):
        

        try:
            conf_file = open(filename, 'r')
            config = conf_file.read()
            config_keys = re.findall(r'\[.*\]', config)
            self.section_keys = [key[1:-1] for key in config_keys]
        except IOError as e:
            # Pass if file not found
            if e.errno != 2:
                raise

        return self.config_parser.read(filename)
28555
def read(self, filename):
        '''
        
        '''
        if not self.backend.exists(filename):
            raise FileNotFound(filename)
        return self.backend.read(filename)
1340242
def get_pp_name(self):
        ''''''
        ppnames = []
        # Find the number of atom types
        natomtypes = int(self._get_line('number of atomic types', self.outputf).split()[5])
        # Find the pseudopotential names
        with open(self.outputf) as fp:
            for line in fp:
                if "PseudoPot. #" in line:
                    ppnames.append(Scalar(value=next(fp).split('/')[-1].rstrip()))
                    if len(ppnames) == natomtypes:
                        return Value(scalars=ppnames)
            raise Exception('Could not find %i pseudopotential names'%natomtypes)
64314
def readin_volt(filename):
    
    with open(filename, 'r') as fid:
        content = np.loadtxt(fid, skiprows=1, usecols=[0, 1, 2])
        volt = content[:, 2]
        elecs = content[:, 0:2]
    return elecs, volt
106145
def _readfile(self, filename):
        
        f = open(filename)
        self.content = f.readlines()
        f.close()
878018
def _read_potentials(self, pot_dir):
        
        if self.assignments['potentials'] is not None:
            print('Potentials already imported. Will not overwrite!')
            return
        else:
            self.assignments['potentials'] = {}

        pot_files = sorted(glob(pot_dir + os.sep + 'pot*.dat'))
        for nr, filename in enumerate(pot_files):
            with open(filename, 'r') as fid:
                pot_data = np.loadtxt(fid)

                nids = self.nodeman.add_data(
                    pot_data[:, 2:4],
                )
                # store cids for later retrieval
                self.assignments['potentials'][nr] = nids
1101461
def read_file(self, filename):
        
        self.pack = {}
        with open(filename, "r") as f:
            for line in f:
                line = line.strip()
                if (len(line) == 0) or (line[0] == "#"):
                    continue
                try:
                    self._parse_modulus(line)
                except:
                    continue
436535
def from_file(filename_or_file_object):
    
    if isinstance(filename_or_file_object, basestring):
        file_ = open(filename_or_file_object, 'r')
        we_opened = True
    else:
        we_opened = False
        file_ = filename_or_file_object

    try:
        data = load(file_.read())
    finally:
        if we_opened:
            file_.close()

    return data
1018706
def read_from_file(filename):
        
        with open(filename) as f:
            result = CP2KInputFile()
            try:
                while True:
                    result.load_children(f)
            except EOFError:
                pass
        return result