@@ -44,6 +44,15 @@ def ensure_local(index_url, file_path, local_cache_path,
4444 return localfiles .localpath_download (* file_path , callback = progress_advance )
4545
4646
47+ def list_remote (server : str ) -> Dict [Tuple [str , ...], dict ]:
48+ client = ServerFiles (server )
49+ return client .allinfo ()
50+
51+
52+ def list_local (path : str ) -> Dict [Tuple [str , ...], dict ]:
53+ return LocalFiles (path ).allinfo ()
54+
55+
4756def format_exception (error ):
4857 # type: (BaseException) -> str
4958 return "\n " .join (traceback .format_exception_only (type (error ), error ))
@@ -256,7 +265,7 @@ def __init__(self):
256265 self .setStatusMessage ("Initializing" )
257266
258267 self ._executor = ThreadPoolExecutor (max_workers = 1 )
259- f = self ._executor .submit (self .list_remote )
268+ f = self ._executor .submit (list_remote , self .INDEX_URL )
260269 w = FutureWatcher (f , parent = self )
261270 w .done .connect (self .__set_index )
262271
@@ -349,7 +358,7 @@ def __set_index(self, f):
349358 assert f .done ()
350359 self .setBlocking (False )
351360 self .setStatusMessage ("" )
352- self .allinfo_local = self . list_local ()
361+ self .allinfo_local = list_local (self . local_cache_path )
353362
354363 try :
355364 self .allinfo_remote = f .result ()
@@ -385,7 +394,7 @@ def __set_index(self, f):
385394
386395 def __update_cached_state (self ):
387396 model = self .view .model ().sourceModel ()
388- localinfo = self . list_local ()
397+ localinfo = list_local (self . local_cache_path )
389398 assert isinstance (model , QStandardItemModel )
390399 allinfo = []
391400 for i in range (model .rowCount ()):
@@ -552,15 +561,6 @@ def load_and_output(self, path):
552561 def load_data (path ):
553562 return Orange .data .Table (path )
554563
555- def list_remote (self ):
556- # type: () -> Dict[Tuple[str, ...], dict]
557- client = ServerFiles (server = self .INDEX_URL )
558- return client .allinfo ()
559-
560- def list_local (self ):
561- # type: () -> Dict[Tuple[str, ...], dict]
562- return LocalFiles (self .local_cache_path ).allinfo ()
563-
564564
565565class FutureWatcher (QObject ):
566566 done = Signal (object )
0 commit comments