@@ -561,9 +561,10 @@ def is_prepared(self) -> bool:
561
561
def download_and_prepare (
562
562
self ,
563
563
* ,
564
- download_dir : Optional [epath .PathLike ] = None ,
565
- download_config : Optional [download .DownloadConfig ] = None ,
566
- file_format : Optional [Union [str , file_adapters .FileFormat ]] = None ,
564
+ download_dir : epath .PathLike | None = None ,
565
+ download_config : download .DownloadConfig | None = None ,
566
+ file_format : str | file_adapters .FileFormat | None = None ,
567
+ permissions : file_utils .Permissions | None = None ,
567
568
) -> None :
568
569
"""Downloads and prepares dataset for reading.
569
570
@@ -574,6 +575,8 @@ def download_and_prepare(
574
575
downloading and preparing dataset.
575
576
file_format: optional `str` or `file_adapters.FileFormat`, format of the
576
577
record files in which the dataset will be written.
578
+ permissions: optional permissions to set on the generated folder and
579
+ files.
577
580
578
581
Raises:
579
582
IOError: if there is not enough disk space available.
@@ -694,7 +697,9 @@ def download_and_prepare(
694
697
self .info .set_file_format (file_format , override = True )
695
698
696
699
# Create a tmp dir and rename to self.data_dir on successful exit.
697
- with utils .incomplete_dir (self .data_dir ) as tmp_data_dir :
700
+ with utils .incomplete_dir (
701
+ dirname = self .data_dir , permissions = permissions
702
+ ) as tmp_data_dir :
698
703
# Temporarily assign _data_dir to tmp_data_dir to avoid having to forward
699
704
# it to every sub function.
700
705
with utils .temporary_assignment (self , "_data_dir" , tmp_data_dir ):
0 commit comments