Fetch the target and pass through to pandas.read_fwf.

        Don't provide the first argument of read_fwf(); it is supplied internally.
185656
def read_fwf(self, *args, **kwargs):
        
        import pandas

        t = self.resolved_url.get_resource().get_target()

        return pandas.read_fwf(t.fspath, *args, **kwargs)
1215396
def load_target_class(input_dir):
  """"""
  with tf.gfile.Open(os.path.join(input_dir, 'target_class.csv')) as f:
    return {row[0]: int(row[1]) for row in csv.reader(f) if len(row) >= 2}
652535
def read_file(fname, *args, **kwargs):
    
    if not isstr(fname):
        raise ValueError('reading multiple files not supported, '
                         'please use `pyam.IamDataFrame.append()`')
    logger().info('Reading `{}`'.format(fname))
    format_kwargs = {}
    # extract kwargs that are intended for `format_data`
    for c in [i for i in IAMC_IDX + ['year', 'time', 'value'] if i in kwargs]:
        format_kwargs[c] = kwargs.pop(c)
    return format_data(read_pandas(fname, *args, **kwargs), **format_kwargs)
198857
def get_df(self, data_file):
        

        crawler = QAHistoryFinancialCrawler()

        with open(data_file, 'rb') as df:
            data = crawler.parse(download_file=df)

        return crawler.to_df(data)
1307559
def load_SUEWS_Forcing_met_df_pattern(path_input, forcingfile_met_pattern):
    

    # list of met forcing files
    path_input = path_input.resolve()
    # forcingfile_met_pattern = os.path.abspath(forcingfile_met_pattern)
    list_file_MetForcing = sorted([
        f for f in path_input.glob(forcingfile_met_pattern)
        if 'ESTM' not in f.name])

    # print(forcingfile_met_pattern)
    # print(list_file_MetForcing)
    # load raw data
    # read in forcing with dask.dataframe in parallel
    dd_forcing_met = dd.read_csv(
        list_file_MetForcing,
        delim_whitespace=True,
        comment='!',
        error_bad_lines=True
    )
    # convert to normal pandas dataframe
    df_forcing_met = dd_forcing_met.compute()
    # `drop_duplicates` in case some duplicates mixed
    df_forcing_met = df_forcing_met.drop_duplicates()
    col_suews_met_forcing = [
        'iy', 'id', 'it', 'imin',
        'qn', 'qh', 'qe', 'qs', 'qf',
        'U', 'RH', 'Tair', 'pres', 'rain', 'kdown',
        'snow', 'ldown', 'fcld',
        'Wuh', 'xsmd', 'lai', 'kdiff', 'kdir', 'wdir'
    ]
    # rename these columns to match variables via the driver interface
    df_forcing_met.columns = col_suews_met_forcing

    # convert unit from kPa to hPa
    df_forcing_met['pres'] *= 10

    # add `isec` for WRF-SUEWS interface
    df_forcing_met['isec'] = 0

    # set correct data types
    df_forcing_met[['iy', 'id', 'it', 'imin', 'isec']] = df_forcing_met[[
        'iy', 'id', 'it', 'imin', 'isec']].astype(np.int64)

    # set timestamp as index
    idx_dt = pd.date_range(
        *df_forcing_met.iloc[[0, -1], :4].astype(int).astype(str).apply(
            lambda ser: ser.str.cat(sep=' '), axis=1).map(
            lambda dt: pd.Timestamp.strptime(dt, '%Y %j %H %M')),
        periods=df_forcing_met.shape[0])

    df_forcing_met = df_forcing_met.set_index(idx_dt)

    return df_forcing_met
893435
async def _load(self):
        

        key = self._kwargs['key']
        pos = self._kwargs['pos']
        neg = self._kwargs['neg']

        with open(self._file_path, newline='', encoding='utf-8') as f:
            reader = csv.reader(f)
            data = {}

            for row in reader:
                try:
                    data[row[key]] = data.get(row[key], []) + [
                        tuple(extract_ranges(row, [pos] + neg))
                    ]
                except IndexError:
                    pass

        self._update({self._locale: data})
931658
def _read_frame(self):
        """"""
        # optionally skip the equilibration
        if self.skip_equi_period:
            while True:
                step, line = self.goto_next_frame()
                self._counter += 1
                if step >= self.equi_period:
                    break
            self.skip_equi_period = False
        else:
            step, line = self.goto_next_frame()

        # read the three lines
        try:
            row = [step]
            for i in range(9):
                row.append(float(line[10+i*12:10+(i+1)*12]))
            line = next(self._f)[:-1]
            row.append(float(line[:10]))
            for i in range(9):
                row.append(float(line[10+i*12:10+(i+1)*12]))
            line = next(self._f)[:-1]
            row.append(float(line[:10]))
            for i in range(9):
                row.append(float(line[10+i*12:10+(i+1)*12]))
        except ValueError:
            raise FileFormatError("Some numbers in the output file could not be read. (expecting floating point numbers)")

        # convert all the numbers to atomic units
        for i in range(30):
            row[i] *= self._conv[i]

        # done
        return row
570050
def eatfd(self, fd):
        '''
        

        '''
        fd.seek(0)
        byts = fd.read(10000000)
        while byts:
            self.update(byts)
            byts = fd.read(10000000)

        return self.guid()
739104
def fetch(self):
        
        if not self.local_path:
            self.make_local_path()
        fetcher = BookFetcher(self)
        fetcher.fetch()
217810
def _read_frame(self):
        """"""

        size = self.read_size()
        title = self._f.readline()[:-1]
        if self.symbols is None:
            symbols = []
        coordinates = np.zeros((size, 3), float)
        for counter in range(size):
            line = self._f.readline()
            if len(line) == 0:
                raise StopIteration
            words = line.split()
            if len(words) < 4:
                raise StopIteration
            if self.symbols is None:
                symbols.append(words[0])
            try:
                coordinates[counter, 0] = float(words[1])
                coordinates[counter, 1] = float(words[2])
                coordinates[counter, 2] = float(words[3])
            except ValueError:
                raise StopIteration
        coordinates *= self.file_unit
        if self.symbols is None:
            self.symbols = symbols
        return title, coordinates
449060
def datagetter(cls):
        
        with open('myfile', 'rt') as f:
            rows = [r for r in csv.reader(f)]
        dothing = lambda _: [i for i, v in enumerate(_)]
        rows = [dothing(_) for _ in rows]
        raise NotImplementedError('You need to implement this yourlself!')
        return rows
31697
def read_meta(self, f):
        
        if not isinstance(f, BacktrackableFile):
            f = BacktrackableFile(f)

        try:
            (name, value) = self.read_meta_line(f)
            while name:
                name = (name == 'nominal_offset' and 'timestamp_rounding' or
                        name)
                name = (name == 'actual_offset' and 'timestamp_offset' or name)
                method_name = 'get_{}'.format(name)
                method = getattr(self, method_name, None)
                if method:
                    method(name, value)
                name, value = self.read_meta_line(f)
                if not name and not value:
                    break
        except ParsingError as e:
            e.args = e.args + (f.line_number,)
            raise
989208
def _wavGetInfo(f:Union[IO, str]) -> Tuple[SndInfo, Dict[str, Any]]:
    
    if isinstance(f, (str, bytes)):
        f = open(f, 'rb')
        needsclosing = True
    else:
        needsclosing = False
    fsize, bigendian = _wavReadRiff(f)
    fmt = ">i" if bigendian else "<i"
    while (f.tell() < fsize):
        chunk_id = f.read(4)
        if chunk_id == b'fmt ':
            chunksize, sampfmt, chans, sr, byterate, align, bits = _wavReadFmt(f, bigendian)
        elif chunk_id == b'data':
            datasize = _struct.unpack(fmt, f.read(4))[0]
            nframes = int(datasize / (chans * (bits / 8)))
            break
        else:
            _warnings.warn("chunk not understood: %s" % chunk_id)
            data = f.read(4)
            size = _struct.unpack(fmt, data)[0]
            f.seek(size, 1)
    encoding = _encoding(sampfmt, bits)
    if needsclosing:
        f.close()
    info = SndInfo(sr, nframes, chans, encoding, "wav")
    return info, {'fsize': fsize, 'bigendian': bigendian, 'datasize': datasize}
161672
def read_csv(self, dtype=False, parse_dates=True, *args, **kwargs):
        

        import pandas

        t = self.resolved_url.get_resource().get_target()

        kwargs = self._update_pandas_kwargs(dtype, parse_dates, kwargs)

        return pandas.read_csv(t.fspath, *args, **kwargs)
942835
def get_reader_factory_for(self, name, *, format=None):
        
        return self.get_factory_for(READER, name, format=format)
1084408
def _load_fofn(cls, fofn):
        ''''''
        filenames = {}
        f = pyfastaq.utils.open_file_read(fofn)
        for line in f:
            fields = line.rstrip().split()
            if len(fields) == 1:
                filenames[fields[0]] = None
            elif len(fields) == 2:
                filenames[fields[0]] = fields[1]
            else:
                raise Error('Error at the following line of file ' + fofn + '. Expected at most 2 fields.\n' + line)

        pyfastaq.utils.close(f)
        return filenames
742552
def read(self):
        # type: () -> Optional[str]
        
        with open(self.version_file) as fp:
            version = fp.read().strip()

            if is_valid(version):
                return version

            return None