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