INNER CODE UNIT · Python
__reduce__
PyCQA/isort · isort/main.py:51
def __reduce__(self) -> tuple[type[SortAttempt], tuple[bool, bool, bool]]:
# Defined explicitly as mypyc's removal of `__dict__` breaks pickling this class, which is
# necessary when using multiple jobs.
return (self.__class__, (self.incorrectly_sorted, self.skipped, self.supported_encoding))
def _stream_with_preserved_newlines(
stream: TextIO, *, mode: Literal["r", "w"]
) -> AbstractContextManager[TextIO]:
if stream is not sys.stdin and stream is not sys.stdout:
return nullcontext(stream)
try:
stream_fileno = stream.fileno()
except OSError:
return nullcontext(stream)
return open(
stream_fileno,