@@ -85,10 +85,8 @@ def sync(loop, func, *args, timeout=None, **kwargs):
85
85
result = [None ]
86
86
event = threading .Event ()
87
87
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
92
90
if timeout is not None :
93
91
timeout -= 1
94
92
if timeout < 0 :
@@ -356,10 +354,11 @@ async def _copy(
356
354
batch_size = None ,
357
355
** kwargs ,
358
356
):
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"
363
362
364
363
if isinstance (path1 , list ) and isinstance (path2 , list ):
365
364
# 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):
714
713
detail = kwargs .pop ("detail" , False )
715
714
try :
716
715
listing = await self ._ls (path , detail = True , ** kwargs )
717
- except ( FileNotFoundError , OSError ) as e :
716
+ except OSError as e :
718
717
if on_error == "raise" :
719
718
raise
720
719
elif callable (on_error ):
@@ -766,7 +765,7 @@ async def _glob(self, path, maxdepth=None, **kwargs):
766
765
ends_with_sep = path .endswith (seps ) # _strip_protocol strips trailing slash
767
766
path = self ._strip_protocol (path )
768
767
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 )
770
769
)
771
770
idx_star = path .find ("*" ) if path .find ("*" ) >= 0 else len (path )
772
771
idx_qmark = path .find ("?" ) if path .find ("?" ) >= 0 else len (path )
@@ -814,7 +813,7 @@ async def _glob(self, path, maxdepth=None, **kwargs):
814
813
p : info
815
814
for p , info in sorted (allpaths .items ())
816
815
if pattern .match (
817
- p + " /"
816
+ f" { p } /"
818
817
if append_slash_to_dirname and info ["type" ] == "directory"
819
818
else p
820
819
)
0 commit comments