Skip to content

Commit 235ade7

Browse files
authored
fix list initialization and redundant parentheses (#412)
* update_time defined twice hence removing once. * removed redundant parentheses from some test cases * removed multi-step list initialization * Removed unused import * Revert "Removed unused import" This reverts commit d1e6012. * fix black issue
1 parent a3c963b commit 235ade7

File tree

4 files changed

+6
-7
lines changed

4 files changed

+6
-7
lines changed

google/generativeai/notebook/sheets_utils.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -102,8 +102,7 @@ def __init__(self, sid: sheets_id.SheetsIdentifier):
102102
def write_outputs(self, outputs: llmfn_outputs.LLMFnOutputsBase) -> None:
103103
# Transpose `outputs` into a list of rows.
104104
outputs_dict = outputs.as_dict()
105-
outputs_rows: list[Sequence[Any]] = []
106-
outputs_rows.append(list(outputs_dict.keys()))
105+
outputs_rows: list[Sequence[Any]] = [list(outputs_dict.keys())]
107106
outputs_rows.extend([list(x) for x in zip(*outputs_dict.values())])
108107

109108
gspread_client.get_client().write_records(

tests/notebook/test_cmd_line_parser.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ def _set_output_sink(text_result: str, sink: llmfn_outputs.LLMFnOutputsSink) ->
5151
llmfn_output_row.LLMFnOutputRow(
5252
data={
5353
llmfn_outputs.ColumnNames.RESULT_NUM: 0,
54-
llmfn_outputs.ColumnNames.TEXT_RESULT: (text_result),
54+
llmfn_outputs.ColumnNames.TEXT_RESULT: text_result,
5555
},
5656
result_type=str,
5757
)

tests/notebook/test_sheets_sanitize_url.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ def test_domain_must_be_docs_google_com(self):
3838
"""Domain must be docs.google.com."""
3939
with self.assertRaisesRegex(
4040
ValueError,
41-
('Domain for Sheets url must be "docs.google.com", got' ' "sheets.google.com"'),
41+
'Domain for Sheets url must be "docs.google.com", got' ' "sheets.google.com"',
4242
):
4343
sanitize_sheets_url("https://sheets.google.com")
4444

tests/test_generation.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ def test_join_contents(self):
116116
result = generation_types._join_contents(contents)
117117
expected = {
118118
"parts": [
119-
{"text": ("Tell me a story about a magic backpack that looks like" " this: ")},
119+
{"text": "Tell me a story about a magic backpack that looks like" " this: "},
120120
{"inline_data": {"mime_type": "image/png", "data": "REFUQSE="}},
121121
],
122122
"role": "assistant",
@@ -254,7 +254,7 @@ def test_join_candidates(self):
254254
expected = {
255255
"content": {
256256
"parts": [
257-
{"text": ("Tell me a story about a magic backpack that looks like" " this: ")},
257+
{"text": "Tell me a story about a magic backpack that looks like" " this: "},
258258
{"text": ""},
259259
],
260260
"role": "assistant",
@@ -438,7 +438,7 @@ def test_join_prompt_feedbacks(self):
438438
{
439439
"content": {
440440
"parts": [
441-
{"text": ("Tell me a story about a magic backpack" " that looks like this: ")},
441+
{"text": "Tell me a story about a magic backpack" " that looks like this: "},
442442
{
443443
"inline_data": {
444444
"mime_type": "image/png",

0 commit comments

Comments
 (0)