From 581793e08391f58abcf85cf2424156737dcbf3b3 Mon Sep 17 00:00:00 2001 From: Nitin Garg Date: Mon, 7 Oct 2024 10:26:27 +0000 Subject: [PATCH] address a self-review comment --- perfmetrics/scripts/testing_on_gke/examples/utils/gsheet.py | 6 +++--- .../scripts/testing_on_gke/examples/utils/gsheet_test.py | 4 ---- perfmetrics/scripts/testing_on_gke/examples/utils/utils.py | 2 +- 3 files changed, 4 insertions(+), 8 deletions(-) diff --git a/perfmetrics/scripts/testing_on_gke/examples/utils/gsheet.py b/perfmetrics/scripts/testing_on_gke/examples/utils/gsheet.py index d527a44903..bd0ba6099f 100644 --- a/perfmetrics/scripts/testing_on_gke/examples/utils/gsheet.py +++ b/perfmetrics/scripts/testing_on_gke/examples/utils/gsheet.py @@ -68,15 +68,14 @@ def append_data_to_gsheet( ) -> None: """Calls the API to append the given data at the end of the given worksheet in the given gsheet. - If the passed header matches the first row of the file, then the - header is not inserted again. Args: serviceAccountKeyFile: Path of a service-account key-file for authentication read/write from/to the given gsheet. This can be a local filepath or a GCS path starting with `gs:` worksheet: string, name of the worksheet to be edited appended by a "!" data: Dictionary of {'header': tuple, 'values': list(tuples)}, to be added - to the worksheet. + to the worksheet. If the passed header matches the first row of the + worksheet, then the header row is not inserted again. gsheet_id: Unique ID to identify a gsheet. Raises: @@ -138,4 +137,5 @@ def _write_at_address(cell_address: str, data): def url(gsheet_id: str) -> str: + """Returns the url corresponding to the given google sheet ID.""" return f'https://docs.google.com/spreadsheets/d/{gsheet_id}' diff --git a/perfmetrics/scripts/testing_on_gke/examples/utils/gsheet_test.py b/perfmetrics/scripts/testing_on_gke/examples/utils/gsheet_test.py index 0f82f18168..f3a65b9702 100644 --- a/perfmetrics/scripts/testing_on_gke/examples/utils/gsheet_test.py +++ b/perfmetrics/scripts/testing_on_gke/examples/utils/gsheet_test.py @@ -27,10 +27,6 @@ class GsheetTest(unittest.TestCase): - # @classmethod - # def setUpClass(self): - # self.project_id = 'gcs-fuse-test' - def test_append_data_to_gsheet(self): _DEFAULT_GSHEET_ID = '1s9DCis6XZ_oHRIFTy0F8yVN93EGA2Koks_pzpCqAIS4' diff --git a/perfmetrics/scripts/testing_on_gke/examples/utils/utils.py b/perfmetrics/scripts/testing_on_gke/examples/utils/utils.py index 140096b689..01215040ee 100644 --- a/perfmetrics/scripts/testing_on_gke/examples/utils/utils.py +++ b/perfmetrics/scripts/testing_on_gke/examples/utils/utils.py @@ -370,7 +370,7 @@ def run_command(command: str) -> int: Returns exit-code which would be non-zero for error. """ result = subprocess.run( - [word for word in command.split(" ") if (word and not str.isspace(word))], + [word for word in command.split(" ") if (word and word.strip())], capture_output=True, text=True, )