:param f:
    :type f: file
    :return:
432971
def iter_lines(f):
    
    linenum = 1
    try:
        for text in f.readlines():
            # ignore lines that consist entirely of whitespace
            if text.isspace():
                continue
            indent,value = parse_line(text)
            yield linenum,indent,value
            linenum += 1
    except:
        raise ParserError(linenum, 0, '', 'failed to parse line')
929846
def parse_ftype(input_file):
    
    if input_file.endswith(".bam"):
        return "bam"
    elif input_file.endswith(".fastq") or \
            input_file.endswith(".fq") or \
            input_file.endswith(".fq.gz") or \
            input_file.endswith(".fastq.gz"):
        return "fastq"
    else:
        raise TypeError("Type of input file ends in neither '.bam' "
                        "nor '.fastq' [file: '" + input_file + "']")
875277
def getHashForFile(f):
    
    hashVal = hashlib.sha1()
    while True:
        r = f.read(1024)
        if not r:
            break
        hashVal.update(r)
    f.seek(0)

    return hashVal.hexdigest()
1201215
def fd(self):
        """"""
        if isinstance(self._rlist.path_or_fd(), string_types()):
            raise ValueError("File descriptor queried although mapping was generated from path")
        # END handle type
        return self._rlist.path_or_fd()
1211367
def from_file(self, fname):
        """"""
        f = open(fname, "rb")
        data = f.read()
        self.update(data)
        f.close()
1040306
def _augment_file(self, f):
        

        def get_url(target):
            if target.file_size is None:
                return None
            if target.file_name is not None:
                return self.base_url + '/files/content/{0}/{1}'.format(target.file_id.hex, target.file_name)
            else:
                return self.base_url + '/files/content/{0}'.format(target.file_id.hex, )

        f.get_url = types.MethodType(get_url, f)

        def download_to(target, file_name):
            url = target.get_url()
            r = requests.get(url, stream=True)
            with open(file_name, 'wb') as file_to_write:
                for chunk in r.iter_content(chunk_size=1024):
                    if chunk:  # filter out keep-alive new chunks
                        file_to_write.write(chunk)
                        file_to_write.flush()
            return file_name

        f.download_to = types.MethodType(download_to, f)
        return f
846414
def map(self, f):
        
        return self._replace(recver=self.recver.map(f))
217838
def open_file_like(f, mode):
    """"""
    new_fd = isinstance(f, (str, pathlib.Path))
    if new_fd:
        f = open(f, mode)
    try:
        yield f
    finally:
        if new_fd:
            f.close()
1105030
def get_fd(file_or_fd, default=None):
    """"""
    fd = file_or_fd
    if fd is None:
        fd = default
    if hasattr(fd, "fileno"):
        fd = fd.fileno()
    return fd
229924
def from_file(cls, f):
        
        element = ElementIterator.from_file(f)
        assert element.tag == "mediawiki"
        return cls.from_element(element)
819050
def fh_to_record(self, f):
        """"""

        fn_path = self.file_name
        fr = self.record
        fr.path = fn_path

        fr.update_contents(f.read(), 'text/plain')

        fr.source_hash = self.fs_hash
        fr.synced_fs = self.fs_modtime
        fr.modified = self.fs_modtime
519710
def get_filesize(self, f):
        
        try:
            filesize = float(f.get_size())
            return float("%.2f" % (filesize / 1024))
        except (POSKeyError, TypeError, AttributeError):
            return 0.0
478960
public static Instance readInstance(File f) {
        try (Reader in = makeIn(f)) {
            return readInstance(in);
        } catch (IOException e) {
            throw new IllegalArgumentException(e);
        }
    }
574208
function getFilepath(fun, file) {
  		if(typeof(fun) == "function"){
  			return fun(file);
  		}
  
  		return common.tokenizePath(fun, {
  			filepath: file.subpath,
  			filename: file.filename,
  			hash: file.getHash()
  		});
  	}
840758
def in_file(self, fn: str) -> Iterator[Statement]:
        
        yield from self.__file_to_statements.get(fn, [])
159141
def load_from_file_object(cls, fd, format=None):
        
        format = 'pickle' if format is None else format
        load = getattr(cls, "load_%s" % format, None)
        if load is None:
            raise ValueError("Unknown format '%s'." % format)
        return load(fd)
1272292
def get_file(f, decoder, read):
    """"""
    with f as f:
        if decoder is None:
            return list(f)
        else:
            d = f.read() if read else f
            out = decoder(d)
            if isinstance(out, (tuple, list)):
                return out
            else:
                return [out]