From 739236eab014a5e85c46466d2a94b3ba237ab438 Mon Sep 17 00:00:00 2001 From: "Mr. Outis" Date: Fri, 6 Sep 2019 08:48:22 -0500 Subject: [PATCH] ssh: accept only wb mode for open --- dvc/remote/ssh/__init__.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/dvc/remote/ssh/__init__.py b/dvc/remote/ssh/__init__.py index 4cc76d972..27dd81c0a 100644 --- a/dvc/remote/ssh/__init__.py +++ b/dvc/remote/ssh/__init__.py @@ -250,6 +250,8 @@ class RemoteSSH(RemoteBASE): @contextmanager def open(self, path_info, mode="r", encoding=None): + assert mode in {"r", "rt", "rb", "wb"} + with self.ssh(path_info) as ssh, closing( ssh.sftp.open(path_info.path, mode) ) as fd: