gemini-code-assist[bot] commented on code in PR #39107:
URL: https://github.com/apache/beam/pull/39107#discussion_r3475513087
##########
sdks/python/apache_beam/io/gcp/bigquery_file_loads.py:
##########
@@ -170,6 +170,13 @@ def _bq_uuid(seed=None):
else:
return str(hashlib.md5(seed.encode('utf8')).hexdigest())
+def _bq_uuid_list(list):
+ checksum = hashlib.sha256()
+ for item in list:
+ checksum.update(item.encode('utf-8'))
+ # separator
+ checksum.update(b'\x00')
+ return checksum.hexdigest()
Review Comment:

Avoid using the built-in name `list` as a parameter name, as it shadows the
built-in `list` type. It is better to use a name like `items` or `lst` to
prevent potential bugs and maintain readability.
```suggestion
def _bq_uuid_list(items):
checksum = hashlib.sha256()
for item in items:
checksum.update(item.encode('utf-8'))
# separator
checksum.update(b'\x00')
return checksum.hexdigest()
```
<details>
<summary>References</summary>
1. Avoid shadowing built-in names like 'list' to prevent naming conflicts
and maintain code clarity.
<sup>([link](https://github.com/apache/beam/blob/master/.gemini/styleguide.md))</sup>
</details>
##########
sdks/python/apache_beam/io/gcp/bigquery_file_loads.py:
##########
@@ -589,9 +596,7 @@ def process(
write_disposition = 'WRITE_APPEND'
wait_for_job = False
- chunk_job_name = copy_job_name_base
- if len(chunks) > 1:
- chunk_job_name = f"{copy_job_name_base}_{i}"
+ chunk_job_name = '%s_%s' % (copy_job_name_base, _bq_uuid_list(chunk))
Review Comment:

Use f-strings instead of `%` formatting for consistency with the rest of the
codebase and modern Python standards (PEP 498).
```suggestion
chunk_job_name = f"{copy_job_name_base}_{_bq_uuid_list(chunk)}"
```
<details>
<summary>References</summary>
1. Use f-strings (PEP 498) for string formatting to maintain consistency and
readability.
<sup>([link](https://github.com/apache/beam/blob/master/.gemini/styleguide.md))</sup>
</details>
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]