File tree Expand file tree Collapse file tree 1 file changed +9
-6
lines changed Expand file tree Collapse file tree 1 file changed +9
-6
lines changed Original file line number Diff line number Diff line change @@ -65,7 +65,12 @@ def __init__(
6565
6666 self .root = sha
6767 self .ls ("" )
68- self .kwargs = kwargs
68+ try :
69+ from .http import HTTPFileSystem
70+
71+ self .http_fs = HTTPFileSystem (** kwargs )
72+ except ImportError :
73+ self .http_fs = None
6974
7075 @property
7176 def kw (self ):
@@ -248,14 +253,12 @@ def _open(
248253 # we land here if the content was not present in the first response
249254 # (regular file over 1MB or git-lfs tracked file)
250255 # in this case, we get let the HTTPFileSystem handle the download
251- try :
252- from .http import HTTPFileSystem
253- except ImportError as e :
256+ if self .http_fs is None :
254257 raise ImportError (
255258 "Please install fsspec[http] to acccess github files >1 MB "
256259 "or git-lfs tracked files."
257- ) from e
258- return HTTPFileSystem ( ** self .kwargs ) .open (
260+ )
261+ return self .http_fs .open (
259262 content_json ["download_url" ],
260263 mode = mode ,
261264 block_size = block_size ,
You can’t perform that action at this time.
0 commit comments