We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 4b2d3ac commit bd95e6aCopy full SHA for bd95e6a
src/dnaio/singleend.py
@@ -126,13 +126,13 @@ def _detect_format_from_content(file: BinaryIO) -> Optional[str]:
126
"""
127
Return 'fasta', 'fastq' or None
128
129
- if file.seekable():
+ if hasattr(file, "peek"):
130
+ magic = file.peek(4)[0:4]
131
+ else:
132
+ # We cannot always use peek() because BytesIO objects do not suppert it
133
original_position = file.tell()
134
magic = file.read(4)
135
file.seek(original_position)
- else:
- # We cannot always use peek() because BytesIO objects do not suppert it
- magic = file.peek(4)[0:4] # type: ignore
136
if magic.startswith(b"@") or magic == b"":
137
# Pretend FASTQ for empty input
138
return "fastq"
0 commit comments