diff --git a/appengine/standard/noxfile-template.py b/appengine/standard/noxfile-template.py index df2580bdf43..811797111f8 100644 --- a/appengine/standard/noxfile-template.py +++ b/appengine/standard/noxfile-template.py @@ -228,7 +228,7 @@ def _get_repo_root(): raise Exception("Unable to detect repository root.") -GENERATED_READMES = sorted([x for x in Path(".").rglob("*.rst.in")]) +GENERATED_READMES = sorted(list(Path(".").rglob("*.rst.in"))) @nox.session diff --git a/dialogflow/participant_management.py b/dialogflow/participant_management.py index e2f9a486c1a..fa67f23218a 100644 --- a/dialogflow/participant_management.py +++ b/dialogflow/participant_management.py @@ -175,7 +175,7 @@ def request_generator(audio_config, audio_file_path): ) requests = request_generator(audio_config, audio_file_path) responses = client.streaming_analyze_content(requests=requests) - results = [response for response in responses] + results = list(responses) print("=" * 20) for result in results: print(f'Transcript: "{result.message.content}".') diff --git a/firestore/cloud-client/distributed_counters_test.py b/firestore/cloud-client/distributed_counters_test.py index 27a272c2b69..5f26b61cd4c 100644 --- a/firestore/cloud-client/distributed_counters_test.py +++ b/firestore/cloud-client/distributed_counters_test.py @@ -41,7 +41,7 @@ def test_distributed_counters(fs_client): counter.init_counter(doc_ref) shards = doc_ref.collection("shards").list_documents() - shards_list = [shard for shard in shards] + shards_list = list(shards) assert len(shards_list) == 2 counter.increment_counter(doc_ref) @@ -54,7 +54,7 @@ def test_distributed_counters_cleanup(fs_client): doc_ref = col.document("distributed_counter") shards = doc_ref.collection("shards").list_documents() - shards_list = [shard for shard in shards] + shards_list = list(shards) for shard in shards_list: shard.delete() diff --git a/noxfile-template.py b/noxfile-template.py index 61bb9a3f252..bd598bac466 100644 --- a/noxfile-template.py +++ b/noxfile-template.py @@ -286,7 +286,7 @@ def _get_repo_root() -> str | None: raise Exception("Unable to detect repository root.") -GENERATED_READMES = sorted([x for x in Path(".").rglob("*.rst.in")]) +GENERATED_READMES = sorted(list(Path(".").rglob("*.rst.in"))) @nox.session diff --git a/people-and-planet-ai/image-classification/predict.py b/people-and-planet-ai/image-classification/predict.py index 86cad8f9049..c0a9acb529d 100644 --- a/people-and-planet-ai/image-classification/predict.py +++ b/people-and-planet-ai/image-classification/predict.py @@ -65,12 +65,9 @@ def run( prediction = [dict(pred) for pred in response.predictions][0] return sorted( - [ - (category, confidence) - for category, confidence in zip( + list(zip( prediction["displayNames"], prediction["confidences"] - ) - ], + )), reverse=True, key=lambda x: x[1], )