@@ -86,10 +86,8 @@ def sync(loop, func, *args, timeout=None, **kwargs):
8686 result = [None ]
8787 event = threading .Event ()
8888 asyncio .run_coroutine_threadsafe (_runner (event , coro , result , timeout ), loop )
89- while True :
90- # this loops allows thread to get interrupted
91- if event .wait (1 ):
92- break
89+ while not event .wait (1 ):
90+ # this loop allows thread to get interrupted
9391 if timeout is not None :
9492 timeout -= 1
9593 if timeout < 0 :
@@ -357,10 +355,11 @@ async def _copy(
357355 batch_size = None ,
358356 ** kwargs ,
359357 ):
360- if on_error is None and recursive :
361- on_error = "ignore"
362- elif on_error is None :
363- on_error = "raise"
358+ if on_error is None :
359+ if recursive :
360+ on_error = "ignore"
361+ else :
362+ on_error = "raise"
364363
365364 if isinstance (path1 , list ) and isinstance (path2 , list ):
366365 # No need to expand paths when both source and destination
@@ -715,7 +714,7 @@ async def _walk(self, path, maxdepth=None, on_error="omit", **kwargs):
715714 detail = kwargs .pop ("detail" , False )
716715 try :
717716 listing = await self ._ls (path , detail = True , ** kwargs )
718- except ( FileNotFoundError , OSError ) as e :
717+ except OSError as e :
719718 if on_error == "raise" :
720719 raise
721720 elif callable (on_error ):
@@ -767,7 +766,7 @@ async def _glob(self, path, maxdepth=None, **kwargs):
767766 ends_with_sep = path .endswith (seps ) # _strip_protocol strips trailing slash
768767 path = self ._strip_protocol (path )
769768 append_slash_to_dirname = ends_with_sep or path .endswith (
770- tuple (sep + " **" for sep in seps )
769+ tuple (f" { sep } **" for sep in seps )
771770 )
772771 idx_star = path .find ("*" ) if path .find ("*" ) >= 0 else len (path )
773772 idx_qmark = path .find ("?" ) if path .find ("?" ) >= 0 else len (path )
@@ -815,7 +814,7 @@ async def _glob(self, path, maxdepth=None, **kwargs):
815814 p : info
816815 for p , info in sorted (allpaths .items ())
817816 if pattern .match (
818- p + " /"
817+ f" { p } /"
819818 if append_slash_to_dirname and info ["type" ] == "directory"
820819 else p
821820 )
0 commit comments