@@ -54,14 +54,12 @@ def _use_v4():
5454 use_v4 = db_config .get_value ('use_android_build_api_v4' ) or False
5555 logs .info (
5656 'AndroidBuildAPI feature flag status read.' ,
57- use_android_build_api_v4 = use_v4
58- )
57+ use_android_build_api_v4 = use_v4 )
5958 return use_v4
6059 except Exception as e :
6160 logs .error (
6261 'AndroidBuildAPI error reading feature flag use_android_build_api_v4. Defaulting to False.' ,
63- error = str (e )
64- )
62+ error = str (e ))
6563 return False
6664
6765
@@ -85,7 +83,7 @@ def download_artifact(client, bid, target, attempt_id, name, output_directory,
8583 logs .info ('artifact to download: %s' % name )
8684 logs .info ('output_directory: %s' % output_directory )
8785 logs .info ('output_filename: %s' % output_filename )
88-
86+
8987 version_tag = 'V4' if _use_v4 () else 'V3'
9088 logs .info (
9189 'AndroidBuildAPI download_artifact started.' ,
@@ -94,9 +92,8 @@ def download_artifact(client, bid, target, attempt_id, name, output_directory,
9492 build_id = bid ,
9593 target = target ,
9694 attempt_id = attempt_id ,
97- artifact_name = name
98- )
99-
95+ artifact_name = name )
96+
10097 if _use_v4 ():
10198 artifact_query = client .buildartifacts ().get (
10299 buildId = bid , target = target , attemptId = attempt_id , resourceId = name )
@@ -113,8 +110,7 @@ def download_artifact(client, bid, target, attempt_id, name, output_directory,
113110 target = target ,
114111 attempt_id = attempt_id ,
115112 artifact_name = name ,
116- status = 'failed'
117- )
113+ status = 'failed' )
118114 return None
119115
120116 # Lucky us, we always have the size.
@@ -127,8 +123,7 @@ def download_artifact(client, bid, target, attempt_id, name, output_directory,
127123 target = target ,
128124 attempt_id = attempt_id ,
129125 artifact_name = name ,
130- size = size
131- )
126+ size = size )
132127
133128 chunksize = - 1
134129 if size >= DEFAULT_CHUNK_SIZE :
@@ -142,8 +137,7 @@ def download_artifact(client, bid, target, attempt_id, name, output_directory,
142137 build_id = bid ,
143138 target = target ,
144139 attempt_id = attempt_id ,
145- artifact_name = name
146- )
140+ artifact_name = name )
147141 if _use_v4 ():
148142 dl_request = client .buildartifacts ().get_media (
149143 buildId = bid , target = target , attemptId = attempt_id , resourceId = name )
@@ -168,8 +162,7 @@ def download_artifact(client, bid, target, attempt_id, name, output_directory,
168162 attempt_id = attempt_id ,
169163 artifact_name = name ,
170164 output_path = output_path ,
171- status = 'skipped_exists'
172- )
165+ status = 'skipped_exists' )
173166 return output_path
174167
175168 logs .info ('Downloading artifact %s.' % name )
@@ -201,8 +194,7 @@ def download_artifact(client, bid, target, attempt_id, name, output_directory,
201194 attempt_id = attempt_id ,
202195 artifact_name = name ,
203196 output_path = output_path ,
204- status = 'success'
205- )
197+ status = 'success' )
206198 return output_path
207199
208200
@@ -220,9 +212,8 @@ def get_artifacts_for_build(client,
220212 build_id = bid ,
221213 target = target ,
222214 attempt_id = attempt_id ,
223- regexp = regexp
224- )
225-
215+ regexp = regexp )
216+
226217 if _use_v4 ():
227218 if not regexp :
228219 request = client .buildartifacts ().list (
@@ -273,8 +264,7 @@ def get_artifacts_for_build(client,
273264 attempt_id = attempt_id ,
274265 regexp = regexp ,
275266 artifacts_count = len (artifacts ),
276- status = 'success' if artifacts else 'empty'
277- )
267+ status = 'success' if artifacts else 'empty' )
278268
279269 if not artifacts :
280270 logs .error (f'No artifact found for target { target } , build id { bid } .\n '
@@ -299,20 +289,17 @@ def get_client():
299289 scopes = 'https://www.googleapis.com/auth/androidbuild.internal' )
300290 if _use_v4 ():
301291 logs .info (
302- 'AndroidBuildAPI client initialization started.' ,
303- api_version = 'V4'
304- )
292+ 'AndroidBuildAPI client initialization started.' , api_version = 'V4' )
305293 client = apiclient .discovery .build (
306294 'androidbuildinternal' ,
307295 'v4' ,
308- discoveryServiceUrl = 'https://androidbuild-pa.googleapis.com/$discovery/rest?version=v4' ,
296+ discoveryServiceUrl =
297+ 'https://androidbuild-pa.googleapis.com/$discovery/rest?version=v4' ,
309298 credentials = credentials ,
310299 static_discovery = False )
311300 else :
312301 logs .info (
313- 'AndroidBuildAPI client initialization started.' ,
314- api_version = 'V3'
315- )
302+ 'AndroidBuildAPI client initialization started.' , api_version = 'V3' )
316303 client = apiclient .discovery .build (
317304 'androidbuildinternal' ,
318305 'v3' ,
@@ -364,8 +351,7 @@ def get_latest_artifact_info(branch, target, signed=False, stable_build=False):
364351 operation = 'get_latest_artifact_info' ,
365352 branch = branch ,
366353 target = target ,
367- signed = signed
368- )
354+ signed = signed )
369355 if _use_v4 ():
370356 request = client .builds ().list ( # pylint: disable=no-member
371357 buildType = 'submitted' ,
@@ -394,14 +380,13 @@ def get_latest_artifact_info(branch, target, signed=False, stable_build=False):
394380 branch = branch ,
395381 target = target ,
396382 signed = signed ,
397- status = 'failed'
398- )
383+ status = 'failed' )
399384 return None
400385
401386 build = builds ['builds' ][0 ]
402387 bid = build ['buildId' ]
403388 target = build ['target' ]['name' ]
404-
389+
405390 logs .info (
406391 'AndroidBuildAPI get_latest_artifact_info completed.' ,
407392 api_version = version_tag ,
@@ -410,8 +395,7 @@ def get_latest_artifact_info(branch, target, signed=False, stable_build=False):
410395 target = target ,
411396 signed = signed ,
412397 build_id = bid ,
413- status = 'success'
414- )
398+ status = 'success' )
415399 return {'bid' : bid , 'branch' : branch , 'target' : target }
416400
417401
0 commit comments