Load nbt file from a file-like object.

        The `buff` argument can be either a standard `io.BufferedReader`
        for uncompressed nbt or a `gzip.GzipFile` for gzipped nbt data.
195760
def from_buffer(cls, buff, byteorder='big'):
        
        self = cls.parse(buff, byteorder)
        self.filename = getattr(buff, 'name', self.filename)
        self.gzipped = isinstance(buff, gzip.GzipFile)
        self.byteorder = byteorder
        return self
1173991
def serve_file(load, fnd):
    '''
    
    '''
    if 'env' in load:
        # "env" is not supported; Use "saltenv".
        load.pop('env')

    ret = {'data': '',
           'dest': ''}

    if 'path' not in load or 'loc' not in load or 'saltenv' not in load:
        return ret

    if 'path' not in fnd or 'bucket' not in fnd:
        return ret

    gzip = load.get('gzip', None)

    # get the saltenv/path file from the cache
    cached_file_path = _get_cached_file_name(
            fnd['bucket'],
            load['saltenv'],
            fnd['path'])

    ret['dest'] = _trim_env_off_path([fnd['path']], load['saltenv'])[0]

    with salt.utils.files.fopen(cached_file_path, 'rb') as fp_:
        fp_.seek(load['loc'])
        data = fp_.read(__opts__['file_buffer_size'])
        if data and six.PY3 and not salt.utils.files.is_binary(cached_file_path):
            data = data.decode(__salt_system_encoding__)
        if gzip and data:
            data = salt.utils.gzip_util.compress(data, gzip)
            ret['gzip'] = gzip
        ret['data'] = data
    return ret
1179455
def load(self, url, offset, length, no_record_parse=False):
        
        try:
            length = int(length)
        except:
            length = -1

        stream = self.loader.load(url, int(offset), length)
        decomp_type = 'gzip'

        # Create decompressing stream
        stream = DecompressingBufferedReader(stream=stream,
                                             decomp_type=decomp_type,
                                             block_size=self.block_size)

        return self.parse_record_stream(stream, no_record_parse=no_record_parse)
350516
def load_bytes(buf, num, pos):
    """"""
    end = pos + num
    if end > len(buf):
        raise BadRarFile('cannot load bytes')
    return buf[pos : end], end
179634
def loadb(chars, no_bytes=False, object_hook=None, object_pairs_hook=None, intern_object_keys=False):
    """"""
    with BytesIO(chars) as fp:
        return load(fp, no_bytes=no_bytes, object_hook=object_hook, object_pairs_hook=object_pairs_hook,
                    intern_object_keys=intern_object_keys)
600675
def from_data(cls, data):
        
        obj = cls()
        with contextlib.closing(BytesIO(data)) as file_handle:
            obj.load_file(file_handle)
        return obj
465404
def load_file(cls, package_name, root_dir, relative_dirs):
        
        extension = "[!.#~]*.md"

        file_matches = dbt.clients.system.find_matching(
            root_dir,
            relative_dirs,
            extension)

        for file_match in file_matches:
            file_contents = dbt.clients.system.load_file_contents(
                file_match.get('absolute_path'), strip=False)

            parts = dbt.utils.split_path(file_match.get('relative_path', ''))
            name, _ = os.path.splitext(parts[-1])

            path = file_match.get('relative_path')
            original_file_path = os.path.join(
                file_match.get('searched_path'),
                path)

            yield UnparsedDocumentationFile(
                root_path=root_dir,
                resource_type=NodeType.Documentation,
                path=path,
                original_file_path=original_file_path,
                package_name=package_name,
                file_contents=file_contents
            )
1211367
def from_file(self, fname):
        """"""
        f = open(fname, "rb")
        data = f.read()
        self.update(data)
        f.close()
877736
def load_byte(buf, pos):
    """"""
    end = pos + 1
    if end > len(buf):
        raise BadRarFile('cannot load byte')
    return S_BYTE.unpack_from(buf, pos)[0], end
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)
150726
def load(cls, path, base=None):
        ''''''
        obj = cls()
        obj.read(path, base)
        return obj
1325229
def load(self, filename=None, ignore_discard=False, ignore_expires=False):
        """"""
        if filename is None:
            if self.filename is not None: filename = self.filename
            else: raise ValueError(MISSING_FILENAME_TEXT)

        f = open(filename)
        try:
            self._really_load(f, filename, ignore_discard, ignore_expires)
        finally:
            f.close()
731992
def load(self, filething):
        

        fileobj = filething.fileobj

        try:
            self.info = self._Info(fileobj)
            self.tags = self._Tags(fileobj, self.info)
            self.info._post_tags(fileobj)
        except (error, IOError) as e:
            reraise(self._Error, e, sys.exc_info()[2])
        except EOFError:
            raise self._Error("no appropriate stream found")
271445
def readf(nb_file, fmt=None):
    """"""
    if nb_file == '-':
        text = sys.stdin.read()
        fmt = fmt or divine_format(text)
        return reads(text, fmt)

    _, ext = os.path.splitext(nb_file)
    fmt = copy(fmt or {})
    fmt.update({'extension': ext})
    with io.open(nb_file, encoding='utf-8') as stream:
        return read(stream, fmt, as_version=4)
433947
private void loadBytesAsNeeded() throws IOException {
        if (available() <= 0) {
            _isEof = true;
        }

        while ((!_isEof) && (bytesLeftInBuffer() <= 0)) {
            _currentBufferPosition = 0;
            NfsReadResponse response = _file.read(_offset, _bytes.length, _bytes, _currentBufferPosition);
            _bytesInBuffer = response.getBytesRead();
            _offset += _bytesInBuffer;
            _isEof = response.isEof();
        }
    }
50335
def from_file(cls, fn, *args, **kwargs):
        
        return AmiraHeader(get_parsed_data(fn, *args, **kwargs))
1373542
def load(self, filename="temp.pkl"):
    
    inputFile = open(filename, 'rb')
    self.tm = cPickle.load(inputFile)