|
2 | 2 |
|
3 | 3 | import requests |
4 | 4 |
|
5 | | -from ..asyn import get_loop, sync |
6 | 5 | from ..spec import AbstractFileSystem |
7 | 6 | from ..utils import infer_storage_options |
8 | | -from .http import HTTPFile, HTTPFileSystem |
| 7 | +from .http import HTTPFileSystem |
9 | 8 | from .memory import MemoryFile |
10 | 9 |
|
11 | 10 | # TODO: add GIST backend, would be very similar |
@@ -65,11 +64,7 @@ def __init__( |
65 | 64 |
|
66 | 65 | self.root = sha |
67 | 66 | self.ls("") |
68 | | - |
69 | | - # prepare elements needed to return HTTPFile |
70 | 67 | self.http_fs = HTTPFileSystem(**kwargs) |
71 | | - self.loop = get_loop() |
72 | | - self.session = sync(self.loop, self.http_fs.set_session) |
73 | 68 |
|
74 | 69 | @property |
75 | 70 | def kw(self): |
@@ -219,7 +214,6 @@ def _open( |
219 | 214 | path, |
220 | 215 | mode="rb", |
221 | 216 | block_size=None, |
222 | | - autocommit=True, |
223 | 217 | cache_options=None, |
224 | 218 | sha=None, |
225 | 219 | **kwargs, |
@@ -252,16 +246,11 @@ def _open( |
252 | 246 |
|
253 | 247 | # we land here if the content was not present in the first response |
254 | 248 | # (regular file over 1MB or git-lfs tracked file) |
255 | | - # in this case, we get return an HTTPFile object wrapping the |
256 | | - # download_url |
257 | | - return HTTPFile( |
258 | | - self.http_fs, |
| 249 | + # in this case, we get let the HTTPFileSystem handle the download |
| 250 | + return self.http_fs.open( |
259 | 251 | content_json["download_url"], |
260 | | - session=self.session, |
| 252 | + mode=mode, |
261 | 253 | block_size=block_size, |
262 | | - autocommit=autocommit, |
263 | 254 | cache_options=cache_options, |
264 | | - size=content_json["size"], |
265 | | - loop=self.loop, |
266 | 255 | **kwargs, |
267 | 256 | ) |
0 commit comments