@@ -52,7 +52,7 @@ def should_exclude(path, exclude_paths, dry_run=False, print_logs=True):
5252 # An exclude path may be a directory, strip trailing slash and add /*
5353 # if not already there.
5454 if not exclude_path .endswith ("/*" ) and fnmatch (
55- path , exclude_path .rstrip ("/" ) + "/*"
55+ path , exclude_path .rstrip ("/" ) + "/*"
5656 ):
5757 if print_logs :
5858 print (
@@ -119,16 +119,16 @@ def _folder_exists(folder_full_path, remote_folders_existing, follow_shortcuts):
119119
120120
121121def _upload_folder (
122- domain ,
123- vault ,
124- base_remote_path ,
125- base_local_path ,
126- local_start ,
127- exclude_paths = None ,
128- dry_run = False ,
129- num_processes = 1 ,
130- archive_folder = None ,
131- follow_shortcuts = False
122+ domain ,
123+ vault ,
124+ base_remote_path ,
125+ base_local_path ,
126+ local_start ,
127+ exclude_paths = None ,
128+ dry_run = False ,
129+ num_processes = 1 ,
130+ archive_folder = None ,
131+ follow_shortcuts = False
132132):
133133 all_folders = []
134134 all_files = []
@@ -247,7 +247,7 @@ def _create_file_job(args):
247247 client = SolveClient (* client_auth )
248248
249249 remote_parent = None
250- try :
250+ try :
251251 remote_parent = Object .get_by_full_path (
252252 remote_folder_full_path ,
253253 assert_type = "folder" ,
@@ -282,12 +282,13 @@ def _create_file_job(args):
282282 except Exception as e :
283283 return e
284284
285+
285286def _object_exists (remote_parent , local_path , _client ):
286287 if remote_parent is None :
287288 return False
288289 full_path , path_dict = Object .validate_full_path (
289- os .path .join ('{}:{}' .format (remote_parent .vault .full_path , remote_parent .path ),
290- os .path .basename (local_path )), client = _client )
290+ os .path .join ('{}:{}' .format (remote_parent .vault .full_path , remote_parent .path ),
291+ os .path .basename (local_path )), client = _client )
291292 try :
292293 obj = Object .get_by_full_path (full_path , client = _client )
293294 if not obj .is_file :
@@ -303,6 +304,7 @@ def _object_exists(remote_parent, local_path, _client):
303304 except NotFoundError :
304305 return False
305306
307+
306308def _create_template_from_file (template_file , dry_run = False ):
307309 mode = "r"
308310 fopen = open
@@ -661,15 +663,15 @@ def download(args):
661663
662664
663665def _download (
664- full_path ,
665- local_folder_path ,
666- dry_run = False ,
667- recursive = False ,
668- excludes = [],
669- includes = [],
670- delete = False ,
671- follow_shortcuts = False ,
672- num_processes = None ,
666+ full_path ,
667+ local_folder_path ,
668+ dry_run = False ,
669+ recursive = False ,
670+ excludes = [],
671+ includes = [],
672+ delete = False ,
673+ follow_shortcuts = False ,
674+ num_processes = None ,
673675):
674676 """
675677 Given a folder or file, download all the files contained
@@ -747,16 +749,15 @@ def _download(
747749
748750
749751def _download_recursive (
750- full_path ,
751- local_folder_path ,
752- dry_run = False ,
753- excludes = [],
754- includes = [],
755- delete = False ,
756- follow_shortcuts = False ,
757- num_processes = None ,
752+ full_path ,
753+ local_folder_path ,
754+ dry_run = False ,
755+ excludes = [],
756+ includes = [],
757+ delete = False ,
758+ follow_shortcuts = False ,
759+ num_processes = None ,
758760):
759-
760761 if "**" in full_path :
761762 raise Exception (
762763 "Paths containing ** are not compatible with the --recursive flag."
@@ -812,7 +813,7 @@ def _download_recursive(
812813
813814 # Skip over files that are excluded (not recovered by include)
814815 if should_exclude (
815- local_path , excludes , print_logs = False
816+ local_path , excludes , print_logs = False
816817 ) and not should_exclude (local_path , includes , print_logs = False ):
817818 continue
818819
@@ -883,7 +884,7 @@ def _download_worker(file_info):
883884
884885 if num_processes <= 0 :
885886 num_processes = os .cpu_count ()
886- print ("[Warning] num-processes cannot be less than 1. Defaulting to CPU count: ({})" . format (num_processes ))
887+ print ("[Warning] num-processes cannot be less than 1. Defaulting to CPU count: ({})" .format (num_processes ))
887888
888889 print ("Downloading in parallel with {} processes." .format (num_processes ))
889890
0 commit comments