@@ -32,11 +32,13 @@ def create_repo_bundle(self, bundle_path):
3232
3333 @DeepCodeErrorHandler .backend_error_decorator
3434 def create_server_remote_bundle (self , path_dict_to_remote_bundle ):
35- remote_bundle = self .http .post (DEEPCODE_API_ROUTES ['create_bundle' ], {
36- 'data' :
37- {key : path_dict_to_remote_bundle [key ]
38- for key in path_dict_to_remote_bundle if path_dict_to_remote_bundle [key ] is not None },
39- })
35+ data = {
36+ key : path_dict_to_remote_bundle [key ]
37+ for key in path_dict_to_remote_bundle
38+ if path_dict_to_remote_bundle [key ] is not None
39+ }
40+ # print('create_server_remote_bundle http post with data --> ', data)
41+ remote_bundle = self .http .post (DEEPCODE_API_ROUTES ['create_bundle' ], {'data' : data })
4042 if not validate_remote_bundle_response (remote_bundle ):
4143 DeepCodeErrorHandler .raise_backend_error ('invalid_bundle_response' ,
4244 err_details = DeepCodeErrorHandler .construct_backend_error_for_report (
@@ -60,23 +62,27 @@ def create_files_bundle(self, bundle_path, show_progressbar=True):
6062 # create hashes bundle
6163 self .hashes_bundles [abs_path ] = self .create_hashes_bundle (
6264 abs_path , show_progressbar = show_progressbar )
65+ # print('hashes_bundles --> ', self.hashes_bundles)
6366 # create remote bundle on server
6467 server_start_bundle = self .create_files_server_bundle (
6568 self .hashes_bundles [abs_path ])
69+ # print('server_start_bundle --> ', server_start_bundle)
6670 # check for missing files and upload missing files
6771 self .server_bundles [abs_path ] = self .handle_server_bundle_missing_files (
6872 server_start_bundle ,
6973 self .hashes_bundles [abs_path ],
70- abs_path , show_progressbar = show_progressbar )
74+ show_progressbar = show_progressbar )
75+ # print('server_bundles --> ', self.server_bundles)
7176 return self .server_bundles [abs_path ]
7277
7378 @DeepCodeErrorHandler .backend_error_decorator
7479 def create_files_filters_from_server (self ):
75- return self .http .get (DEEPCODE_API_ROUTES ['files_filters' ])
80+ res = self .http .get (DEEPCODE_API_ROUTES ['files_filters' ])
81+ return res
7682
7783 @DeepCodeErrorHandler .bundle_path_error_decorator
7884 def create_abs_bundle_path (self , bundle_path ):
79- is_current_path = bundle_path is CURRENT_FOLDER_PATH
85+ # is_current_path = bundle_path is CURRENT_FOLDER_PATH
8086 result_path = os .path .join (os .path .sep , os .path .realpath (bundle_path ))
8187 if not os .path .exists (result_path ):
8288 DeepCodeErrorHandler .raise_path_error ('no_path' )
@@ -90,16 +96,19 @@ def create_hashes_bundle(self, bundle_path, show_progressbar=True):
9096 self .files_filters ,
9197 show_progressbar = show_progressbar ,
9298 progress_iterator = progress_iterator (
93- prefix = BUNDLE_HELPERS ['creating' ]( bundle_path ) )
99+ prefix = BUNDLE_HELPERS ['creating' ])
94100 )
95101 if not len (hashes_bundle ):
96102 DeepCodeErrorHandler .raise_files_bundle_error ('empty_bundle' )
97103 return hashes_bundle
98104
99105 @DeepCodeErrorHandler .backend_error_decorator
100106 def create_files_server_bundle (self , hashes_bundle ):
101- server_bundle = self .http .post (DEEPCODE_API_ROUTES ['create_bundle' ], {
102- 'data' : {'files' : hashes_bundle }})
107+ # print('create_files_server_bundle. hashes_bundle --> ', hashes_bundle)
108+ server_bundle = self .http .post (
109+ DEEPCODE_API_ROUTES ['create_bundle' ],
110+ {'data' : {'files' : hashes_bundle }}
111+ )
103112 if not validate_remote_bundle_response (server_bundle ):
104113 DeepCodeErrorHandler .raise_backend_error ('invalid_bundle_response' ,
105114 err_details = DeepCodeErrorHandler .construct_backend_error_for_report (
@@ -111,7 +120,7 @@ def check_server_bundle_on_server(self, bundle_id):
111120 return self .http .get (DEEPCODE_API_ROUTES ['check_bundle' ](bundle_id ))
112121
113122 @DeepCodeErrorHandler .backend_error_decorator
114- def handle_server_bundle_missing_files (self , server_bundle , hashes_bundle , bundle_path , show_progressbar = True ):
123+ def handle_server_bundle_missing_files (self , server_bundle , hashes_bundle , show_progressbar = True ):
115124 def _iterate_func (progress_bar = None ):
116125 bundle_to_check = server_bundle
117126 # deepcode ignore replace~range~list: Iterator in for-loop is considered good
@@ -124,14 +133,13 @@ def _iterate_func(progress_bar=None):
124133 if progress_bar :
125134 progress_bar .update (MAX_PROGRESS_VALUE )
126135 break
127- self .upload_missing_files (
128- bundle_to_check , hashes_bundle , bundle_path , show_progressbar )
136+ self .upload_missing_files (bundle_to_check , hashes_bundle , show_progressbar )
129137 bundle_to_check = self .check_server_bundle_on_server (
130138 bundle_to_check ['bundleId' ])
131139 return bundle_to_check
132140
133141 if show_progressbar :
134- with construct_progress (prefix = BUNDLE_HELPERS ['uploading' ]( bundle_path ) ) as progress :
142+ with construct_progress (prefix = BUNDLE_HELPERS ['uploading' ]) as progress :
135143 return _iterate_func (progress_bar = progress )
136144 else :
137145 return _iterate_func ()
@@ -141,8 +149,8 @@ def missing_files_in_server_bundle(self, bundle):
141149 return missingFiles in bundle and len (bundle [missingFiles ])
142150
143151 @DeepCodeErrorHandler .backend_error_decorator
144- def upload_missing_files (self , server_bundle , hashes_bundle , bundle_path , show_progressbar ):
145-
152+ def upload_missing_files (self , server_bundle , hashes_bundle , show_progressbar ):
153+ # print('!!! started upload_missing_files !!!')
146154 def _upload_missing_to_server (batch ):
147155 bundle_id = server_bundle ['bundleId' ]
148156 return self .http .post (DEEPCODE_API_ROUTES ['upload_files' ](bundle_id ), {
@@ -151,16 +159,15 @@ def _upload_missing_to_server(batch):
151159 }, response_to_json = False )
152160
153161 missing_files_batch = self .create_missing_files_batch (
154- server_bundle ['missingFiles' ], hashes_bundle , bundle_path )
155-
162+ server_bundle ['missingFiles' ], hashes_bundle )
156163 # split into smaller batches if necessary
157164 separate_batches = self .split_missing_files_into_batches (
158165 missing_files_batch )
159166 i = 1
160167
161168 multi_bundle_progress_bar = None
162169 if show_progressbar :
163- multi_bundle_progress_bar = construct_progress (prefix = BUNDLE_HELPERS ['uploading' ]( "split" ) , min_value = 0 , max_value = len (separate_batches ))
170+ multi_bundle_progress_bar = construct_progress (prefix = BUNDLE_HELPERS ['uploading' ], min_value = 0 , max_value = len (separate_batches ))
164171
165172
166173 for batch in separate_batches :
@@ -183,13 +190,13 @@ def compute_files_batch_list_size(self, batch):
183190 return total_size
184191
185192 @DeepCodeErrorHandler .files_bundle_error_decorator
186- def create_missing_files_batch (self , missing_files , hashes_bundle , abs_bundle_path ):
193+ def create_missing_files_batch (self , missing_files , hashes_bundle ):
187194 missing_files_batch = []
188195 for file_path in missing_files :
189- p = file_path [1 :] if file_path [0 ] == '/' else file_path
196+ # p = file_path[1:] if file_path[0] == '/' else file_path
197+ p = file_path
190198 file_hash = hashes_bundle [p ]
191- file_content = file_contents_as_string (
192- os .path .join (abs_bundle_path , p ))
199+ file_content = file_contents_as_string (p )
193200 if file_content is not None :
194201 missing_files_batch .append (
195202 {'fileHash' : file_hash , 'fileContent' : file_content })
0 commit comments