Skip to content

Commit

Permalink
Do not import subprocess attributes in global namespace
Browse files Browse the repository at this point in the history
  • Loading branch information
rhpvorderman committed Jan 22, 2024
1 parent f219a34 commit 3d39854
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions src/xopen/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
import tempfile
import time
import typing
from subprocess import Popen, PIPE
from typing import (
Optional,
Dict,
Expand Down Expand Up @@ -227,7 +226,7 @@ def __init__( # noqa: C901
self.process = subprocess.Popen(
self._program_args,
stderr=self._stderr,
stdout=PIPE,
stdout=subprocess.PIPE,
close_fds=close_fds,
) # type: ignore
self._file: BinaryIO = self.process.stdout # type: ignore
Expand All @@ -238,10 +237,10 @@ def __init__( # noqa: C901
self._program_args += ["-" + str(compresslevel)]
self.outfile = open(path, mode[0] + "b")
try:
self.process = Popen(
self.process = subprocess.Popen(
self._program_args,
stderr=self._stderr,
stdin=PIPE,
stdin=subprocess.PIPE,
stdout=self.outfile,
close_fds=close_fds,
) # type: ignore
Expand Down

0 comments on commit 3d39854

Please sign in to comment.