Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def dnaio_open(self, *args, **kwargs):
logger.debug("Opening file '%s', mode '%s' with dnaio", args[0], kwargs['mode'])
kwargs["opener"] = self.xopen
return dnaio.open(*args, **kwargs)
def open(self):
return dnaio.open(self.file1, file2=self.file2,
interleaved=self.interleaved, mode="r")
def _open_writer(
self,
file: BinaryIO,
file2: Optional[BinaryIO] = None,
force_fasta: Optional[bool] = None,
):
# file and file2 must already be file-like objects because we don’t want to
# take care of threads and compression levels here.
for f in (file, file2):
assert not isinstance(f, (str, bytes, Path))
return dnaio.open(
file,
file2=file2,
mode="w",
qualities=self.uses_qualities,
fileformat="fasta" if force_fasta else None,
interleaved=file2 is None,
)
def _open_writer(
self,
file: BinaryIO,
file2: Optional[BinaryIO] = None,
force_fasta: Optional[bool] = None,
):
assert file2 is None
assert not isinstance(file, (str, bytes, Path))
return dnaio.open(
file, mode="w", qualities=self.uses_qualities, fileformat="fasta" if force_fasta else None)