revert remove assertions from open

This commit is contained in:
Mr. Outis
2019-09-04 12:35:54 -05:00
parent 1f0a57d4af
commit 1ae9078fee
3 changed files with 4 additions and 2 deletions
+2
View File
@@ -143,6 +143,8 @@ class RemoteHDFS(RemoteBASE):
@contextmanager
def open(self, path_info, mode="r", encoding=None):
assert mode in {"r", "rt", "rb"}
try:
with self.hdfs(path_info) as hdfs, closing(
hdfs.open(path_info.path, mode="rb")
-2
View File
@@ -440,8 +440,6 @@ class Repo(object):
@contextmanager
def open(self, path, remote=None, mode="r", encoding=None):
"""Opens a specified resource as a file descriptor"""
assert mode in {"r", "rt", "rb"}
try:
with self._open(path, remote, mode, encoding) as fd:
yield fd
+2
View File
@@ -13,6 +13,8 @@ def open_url(url, mode="r", encoding=None):
Resumes on connection error.
Url could be a string or a callable returning a string.
"""
assert mode in {"r", "rt", "rb"}
with iter_url(url) as (response, it):
bytes_stream = IterStream(it)