Loads data using util_io, but smartly constructs a filename
12596
def load_cache(dpath, fname, cfgstr, ext='.cPkl', verbose=None, enabled=True):
    
    if verbose is None:
        verbose = VERBOSE_CACHE
    if not USE_CACHE or not enabled:
        if verbose > 1:
            print('[util_cache] ... cache disabled: dpath=%s cfgstr=%r' %
                    (basename(dpath), cfgstr,))
        raise IOError(3, 'Cache Loading Is Disabled')
    fpath = _args2_fpath(dpath, fname, cfgstr, ext)
    if not exists(fpath):
        if verbose > 0:
            print('[util_cache] ... cache does not exist: dpath=%r fname=%r cfgstr=%r' % (
                basename(dpath), fname, cfgstr,))
        raise IOError(2, 'No such file or directory: %r' % (fpath,))
    else:
        if verbose > 2:
            print('[util_cache] ... cache exists: dpath=%r fname=%r cfgstr=%r' % (
                basename(dpath), fname, cfgstr,))
        import utool as ut
        nbytes = ut.get_file_nBytes(fpath)
        big_verbose = (nbytes > 1E6 and verbose > 2) or verbose > 2
        if big_verbose:
            print('[util_cache] About to read file of size %s' % (ut.byte_str2(nbytes),))
    try:
        with ut.Timer(fpath, verbose=big_verbose and verbose > 3):
            data = util_io.load_data(fpath, verbose=verbose > 2)
    except (EOFError, IOError, ImportError) as ex:
        print('CORRUPTED? fpath = %s' % (fpath,))
        if verbose > 1:
            print('[util_cache] ... cache miss dpath=%s cfgstr=%r' % (
                basename(dpath), cfgstr,))
        raise IOError(str(ex))
    except Exception:
        print('CORRUPTED? fpath = %s' % (fpath,))
        raise
    else:
        if verbose > 2:
            print('[util_cache] ... cache hit')
    return data
1306701
def load(filename, loader=None, implicit_tuple=True, env={}, schema=None):
  """"""
  with open(filename, 'r') as f:
    return loads(f.read(),
                 filename=filename,
                 loader=loader,
                 implicit_tuple=implicit_tuple,
                 env=env,
                 schema=schema)
944154
def load_data(fname, **kwargs):
    """"""
    fname = get_file(fname)
    if fname.suffix == ".lzma":
        return load_tar_lzma_data(fname)
    elif fname.suffix == ".zip":
        return load_zip_data(fname, **kwargs)
244130
def load(self, file_name):
        

        new_rundata = self.loader(file_name)
        new_rundata = self.inspect(new_rundata)
        return new_rundata
789789
def load_data(self, filename, *args, **kwargs):
        
        # header keys
        header_param = self.parameters.get('header')  # default is None
        # data keys
        data_param = self.parameters['data']  # raises KeyError if no 'data'
        dtype = data_param.get('dtype')  # default is None
        # if not None convert to tuple and normal ASCII
        _utf8_list_to_ascii_tuple(dtype) if dtype else None  # -> tuple of str
        delimiter = data_param.get('delimiter')  # default is None
        skip_header = data_param.get('skip_header')  # default is None
        usecols = data_param.get('usecols')  # default is None
        names = data_param.get('names')  # default is None
        names = [str(_) for _ in names] if names else None  # -> str
        excludelist = data_param.get('excludelist')  # default is None
        deletechars = data_param.get('deletechars')  # default is None
        data_units = data_param.get('units', {})  # default is an empty dict
        # either dtype or names must be specified
        if not (dtype or names):
            raise UnnamedDataError(filename)
        data = {}  # a dictionary for data
        # open file for reading
        with open(filename, 'r') as fid:
            # read header
            if header_param:
                data.update(_read_header(fid, header_param))
                fid.seek(0)  # move cursor back to beginning
            # data
            data_data = np.genfromtxt(fid, dtype, delimiter=delimiter,
                                      skip_header=skip_header, usecols=usecols,
                                      names=names, excludelist=excludelist,
                                      deletechars=deletechars)
        # apply units
        data.update(_apply_units(data_data, data_units, fid.name))
        return data
701955
def load_from_filename(self, file_name, sep='\n'):
        """"""
        fp = open(file_name, 'rb')
        n = self.load_from_file(fp, sep)
        fp.close()
        return n
430080
def load_data(self, filename, *args, **kwargs):
        
        # header keys
        header_param = self.parameters.get('header')  # default is None
        # data keys
        data_param = self.parameters['data']  # raises KeyError if no 'data'
        dtype = data_param['dtype']  # raises KeyError if no 'dtype'
        # convert to tuple and normal ASCII
        _utf8_list_to_ascii_tuple(dtype) if dtype else None  # -> tuple of str
        delimiter = data_param.get('delimiter')  # default is None
        skiprows = data_param.get('skiprows')  # default is None
        data_units = data_param.get('units', {})  # default is an empty dict
        data = {}  # a dictionary for data
        # open file for reading
        with open(filename, 'r') as fid:
            # read header
            if header_param:
                data.update(_read_header(fid, header_param))
                fid.seek(0)  # move cursor back to beginning
            # read data
            data_data = np.loadtxt(fid, dtype, delimiter=delimiter,
                                   skiprows=skiprows)
        # apply units
        data.update(_apply_units(data_data, data_units, fid.name))
        return data
830469
def include(self, filename):
        
        if filename != STDIN and filename in [x[0] for x in self.filestack]:  # Already included?
            self.warning(' Recursive inclusion')

        self.filestack.append([filename, 1, self.lex, self.input_data])
        self.lex = lex.lex(object=self)
        result = self.put_current_line()  # First #line start with \n (EOL)

        try:
            if filename == STDIN:
                self.input_data = sys.stdin.read()
            else:
                self.input_data = api.utils.read_txt_file(filename)

            if len(self.input_data) and self.input_data[-1] != EOL:
                self.input_data += EOL
        except IOError:
            self.input_data = EOL

        self.lex.input(self.input_data)
        return result
302212
def load_file_as_string(self, file_string, filename=''):
    '''
    
    '''
    load_data.load_file_as_string(self, file_string, filename=filename)
914817
def _fploadstr(ins):
    
    output = _pload(ins.quad[2], 2)
    if ins.quad[1][0] != '$':
        output.append('call __LOADSTR')
        REQUIRES.add('loadstr.asm')

    return output
469813
def load(input_filename):

    ''''''

    try:
        pil_img = Image.open(input_filename)
    except IOError:
        sys.stderr.write('warning: error opening {}\n'.format(
            input_filename))
        return None, None

    if pil_img.mode != 'RGB':
        pil_img = pil_img.convert('RGB')

    if 'dpi' in pil_img.info:
        dpi = pil_img.info['dpi']
    else:
        dpi = (300, 300)

    img = np.array(pil_img)

    return img, dpi
450481
function load( filename, fmt ) {
	var config,
		parse,
		file,
		ext;

	if ( arguments.length > 1 ) {
		ext = fmt;
		if ( !isString( ext ) ) {
			throw new TypeError( 'invalid input argument. Extension argument must be a primitive string. Value: `' + ext + '`.' );
		}
		if ( ext[ 0 ] !== '.' ) {
			ext = '.' + ext;
		}
	} else {
		ext = extname( filename );
	}
	ext = ext.toLowerCase();
	if ( ext === '.js' ) {
		file = path.resolve( cwd(), filename );
		return require( file );
	}
	parse = getParser( ext );
	if ( parse === null ) {
		throw new Error( 'invalid input argument. Input argument has an unrecognized/unsupported file extension: `' + ext + '`. Supported extensions: [' + ( exts().join( ',' ) ) + '].' );
	}
	file = path.resolve( cwd(), filename );
	file = fs.readFileSync( file, {
		'encoding': 'utf8'
	});
	config = parse( file );
	if ( config instanceof Error ) {
		throw config;
	}
	return config;
}
112542
def _readfname(fname):
    """"""
    try:
        if isinstance(fname, (file, StringIO)):
            astr = fname.read()
        else:
            astr = open(fname, 'rb').read()
    except NameError:
        if isinstance(fname, (FileIO, StringIO)):
            astr = fname.read()
        else:
            astr = mylib2.readfile(fname)
    return astr
222355
def load_data_file(filename, encoding='utf-8'):
    
    data = pkgutil.get_data(PACKAGE_NAME, os.path.join(DATA_DIR, filename))
    return data.decode(encoding).splitlines()
202792
def loadstring_and_call(s, bndng, filename, lineno)

      bottom = stack_top
      chunk = filename ? "#{filename}:#{lineno}" : 'line'

      err = Lib.luaL_loadbuffer(@pointer, s, s.bytesize, chunk)
      fail_if_error('eval:compile', err, bndng, filename, lineno)

      pcall(bottom, 0, bndng, filename, lineno) # arg_count is set to 0
    end
149824
def do_load(self, filename):
        """"""
        try:
            self.__session.load(filename)
        except IOError as e:
            self.logger.error(e.strerror)
704988
def load_file(self, cursor, target, fname, options):
        ""
        with open(fname) as fin:
            log.debug("opening {0} in {1} load_file".format(fname, __name__))
            encoding = options.get('encoding', 'utf-8')
            if target in self.processors:
                reader = self.processors[target](fin, encoding=encoding)
            else:
                reader = self.default_processor(fin, encoding=encoding)
            columns = getattr(reader, 'output_columns', None)
            for _ in xrange(int(options.get('skip-lines', 0))):
                fin.readline()
            cursor.copy_from(reader, self.qualified_names[target],
                             columns=columns)