22
22
)
23
23
24
24
from fsspec .asyn import get_loop
25
- from funcy import cached_property , once_per_args
25
+ from funcy import once_per_args
26
+
27
+ from dvc_objects .utils import cached_property
26
28
27
29
from ..executors import ThreadPoolExecutor , batch_coros
28
30
from .callbacks import DEFAULT_CALLBACK , Callback
@@ -230,7 +232,7 @@ def read_block(
230
232
path : AnyFSPath ,
231
233
offset : int ,
232
234
length : int ,
233
- delimiter : bytes = None ,
235
+ delimiter : Optional [ bytes ] = None ,
234
236
) -> bytes :
235
237
return self .fs .read_block (path , offset , length , delimiter = delimiter )
236
238
@@ -248,16 +250,16 @@ def cat_ranges(
248
250
paths : List [AnyFSPath ],
249
251
starts : List [int ],
250
252
ends : List [int ],
251
- max_gap : int = None ,
253
+ max_gap : Optional [ int ] = None ,
252
254
** kwargs ,
253
255
) -> List [bytes ]:
254
256
return self .fs .cat_ranges (paths , starts , ends , max_gap = max_gap , ** kwargs )
255
257
256
258
def cat_file (
257
259
self ,
258
260
path : AnyFSPath ,
259
- start : int = None ,
260
- end : int = None ,
261
+ start : Optional [ int ] = None ,
262
+ end : Optional [ int ] = None ,
261
263
** kwargs : Any ,
262
264
) -> bytes :
263
265
return self .fs .cat_file (path , start = start , end = end , ** kwargs )
@@ -277,9 +279,9 @@ def pipe_file(self, path: AnyFSPath, value: bytes, **kwargs: Any) -> None:
277
279
def read_text (
278
280
self ,
279
281
path : AnyFSPath ,
280
- encoding : str = None ,
281
- errors : str = None ,
282
- newline : str = None ,
282
+ encoding : Optional [ str ] = None ,
283
+ errors : Optional [ str ] = None ,
284
+ newline : Optional [ str ] = None ,
283
285
** kwargs : Any ,
284
286
) -> str :
285
287
return self .fs .read_text (
@@ -290,9 +292,9 @@ def write_text(
290
292
self ,
291
293
path : AnyFSPath ,
292
294
value : str ,
293
- encoding : str = None ,
294
- errors : str = None ,
295
- newline : str = None ,
295
+ encoding : Optional [ str ] = None ,
296
+ errors : Optional [ str ] = None ,
297
+ newline : Optional [ str ] = None ,
296
298
** kwargs : Any ,
297
299
) -> None :
298
300
self .fs .write_text (
@@ -531,7 +533,7 @@ def put_file(
531
533
from_file : Union [AnyFSPath , "BinaryIO" ],
532
534
to_info : AnyFSPath ,
533
535
callback : Callback = DEFAULT_CALLBACK ,
534
- size : int = None ,
536
+ size : Optional [ int ] = None ,
535
537
** kwargs ,
536
538
) -> None :
537
539
if size :
@@ -578,7 +580,7 @@ def du(
578
580
self ,
579
581
path : AnyFSPath ,
580
582
total : bool = True ,
581
- maxdepth : int = None ,
583
+ maxdepth : Optional [ int ] = None ,
582
584
** kwargs : Any ,
583
585
) -> Union [int , Dict [AnyFSPath , int ]]:
584
586
return self .fs .du (path , total = total , maxdepth = maxdepth , ** kwargs )
@@ -589,7 +591,7 @@ def put(
589
591
to_info : Union [AnyFSPath , List [AnyFSPath ]],
590
592
callback : "Callback" = DEFAULT_CALLBACK ,
591
593
recursive : bool = False , # pylint: disable=unused-argument
592
- batch_size : int = None ,
594
+ batch_size : Optional [ int ] = None ,
593
595
):
594
596
jobs = batch_size or self .jobs
595
597
if self .fs .async_impl :
@@ -617,7 +619,7 @@ def get(
617
619
to_info : Union [AnyFSPath , List [AnyFSPath ]],
618
620
callback : "Callback" = DEFAULT_CALLBACK ,
619
621
recursive : bool = False , # pylint: disable=unused-argument
620
- batch_size : int = None ,
622
+ batch_size : Optional [ int ] = None ,
621
623
) -> None :
622
624
# Currently, the implementation is non-recursive if the paths are
623
625
# provided as a list, and recursive if it's a single path.
0 commit comments