def __enter__(self): if not self.output: path = self._output_path() if PY2 and self.format == self.tsv_format: self.output = binary_file_writer(path) else: self.output = file_writer(path, newline=self.line_separator) return self
def _get_writer(self, inpath, outpath): if PY2 and self._is_tsv(inpath): return binary_file_writer(outpath) return file_writer(outpath, newline=self._options['line_separator'])