Fix a Pylint warning

This commit is contained in:
Robert Martin
2022-05-25 18:04:54 -06:00
parent 9ab89f92c0
commit 5d439c0f38
+9 -9
View File
@@ -128,7 +128,7 @@ class DockerContainer:
cwd=from_path, cwd=from_path,
) )
else: else:
docker = subprocess.Popen( with subprocess.Popen(
[ [
"docker", "docker",
"exec", "exec",
@@ -139,17 +139,17 @@ class DockerContainer:
f"cat > {shell_quote(to_path)}", f"cat > {shell_quote(to_path)}",
], ],
stdin=subprocess.PIPE, stdin=subprocess.PIPE,
) ) as docker:
docker.stdin = cast(IO[bytes], docker.stdin) docker.stdin = cast(IO[bytes], docker.stdin)
with open(from_path, "rb") as from_file: with open(from_path, "rb") as from_file:
shutil.copyfileobj(from_file, docker.stdin) shutil.copyfileobj(from_file, docker.stdin)
docker.stdin.close() docker.stdin.close()
docker.wait() docker.wait()
if docker.returncode: if docker.returncode:
raise subprocess.CalledProcessError(docker.returncode, docker.args, None, None) raise subprocess.CalledProcessError(docker.returncode, docker.args, None, None)
def copy_out(self, from_path: PurePath, to_path: Path) -> None: def copy_out(self, from_path: PurePath, to_path: Path) -> None:
# note: we assume from_path is a dir # note: we assume from_path is a dir