Skip to content

Commit

Permalink
Use tupled isinstance
Browse files Browse the repository at this point in the history
  • Loading branch information
rhpvorderman committed Oct 11, 2021
1 parent 3811b15 commit ad773ca
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions src/xopen/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -745,8 +745,7 @@ def xopen(
# putting a buffer in between, the expensive write method is called much
# less. The effect is very noticeable when writing small units such as
# lines or FASTQ records.
if (isinstance(opened_file, gzip.GzipFile) or
isinstance(opened_file, bz2.BZ2File) or
isinstance(opened_file, lzma.LZMAFile)) and "w" in mode:
if (isinstance(opened_file, (gzip.GzipFile, bz2.BZ2File, lzma.LZMAFile))
and "w" in mode):
opened_file = io.BufferedWriter(opened_file) # type: ignore
return opened_file

0 comments on commit ad773ca

Please sign in to comment.