This is an automated email from the ASF dual-hosted git repository.
uranusjr pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/airflow.git
The following commit(s) were added to refs/heads/main by this push:
new 22de77e295 Refactor: use stdlib's textwrap.shorten (#34125)
22de77e295 is described below
commit 22de77e295a8f1c24ac617a38b571f9bd9e47159
Author: Miroslav Šedivý <[email protected]>
AuthorDate: Thu Sep 7 06:53:03 2023 +0000
Refactor: use stdlib's textwrap.shorten (#34125)
---
dev/perf/sql_queries.py | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/dev/perf/sql_queries.py b/dev/perf/sql_queries.py
index 31eee247d5..6303d5b6fc 100644
--- a/dev/perf/sql_queries.py
+++ b/dev/perf/sql_queries.py
@@ -18,6 +18,7 @@ from __future__ import annotations
import os
import statistics
+import textwrap
from time import monotonic, sleep
from typing import NamedTuple
@@ -85,8 +86,7 @@ class Query(NamedTuple):
time: float
def __str__(self):
- sql = self.sql if len(self.sql) < 110 else f"{self.sql[:111]}..."
- return f"{self.function} in {self.file}:{self.location}: {sql}"
+ return f"{self.function} in {self.file}:{self.location}:
{textwrap.shorten(self.sql, 110)}"
def __eq__(self, other):
"""