Did I find the right examples for you? yes no      Crawl my project      Python Jobs

All Samples(8)  |  Call(6)  |  Derive(0)  |  Import(2)
It returns True if the fhand is seekable

        def fhand_is_seekable(fhand):
    'It returns True if the fhand is seekable'
    try:
        try:
            # The stdin stream in some instances has seek, has no seekable
            fhand.tell()
        except IOError:
            return False
        try:
            if fhand.seekable():
                return True
            else:
                return False
        except AttributeError:
            return True
    except AttributeError:
        return False
        


src/s/e/seq_crumbs-HEAD/crumbs/utils/file_formats.py   seq_crumbs(Download)
from crumbs.utils.optional_modules import FastqGeneralIterator
from crumbs.settings import get_setting
from crumbs.utils.file_utils import fhand_is_seekable, peek_chunk_from_file
from crumbs.exceptions import (UnknownFormatError, UndecidedFastqVersionError,
                               FileIsEmptyError)
    lengths = array('I')
    seqs_analyzed = 0
    if fhand_is_seekable(fhand) and not force_file_as_non_seek:
        fmt_fhand = fhand
        chunk = fmt_fhand.read(chunk_size)

src/s/e/seq_crumbs-HEAD/test/test_seq_utils.py   seq_crumbs(Download)
 
from crumbs.utils.bin_utils import BIN_DIR
from crumbs.utils.file_utils import fhand_is_seekable, wrap_in_buffered_reader
from crumbs.utils.seq_utils import (uppercase_length, ChangeCase,
                                    get_uppercase_segments)
        # StringIO
        fhand = StringIO('hola')
        assert fhand_is_seekable(fhand)
 
        # standard file
        fhand = NamedTemporaryFile()
        fhand.seek(0)
        assert fhand_is_seekable(fhand)
        # a wrapped BufferedReader
        fhand2 = wrap_in_buffered_reader(fhand)
        assert fhand_is_seekable(fhand2)
 
        # pylint: disable=R0903
            pass
 
        assert not fhand_is_seekable(NonSeekable())
 
        class NonSeekable2(object):