This is an automated email from the ASF dual-hosted git repository.
djwang pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/cloudberry.git
The following commit(s) were added to refs/heads/main by this push:
new 789957b0475 Fix invalid escape sequences in Python files
789957b0475 is described below
commit 789957b047535a8c4310cd049640972138786990
Author: Dianjin Wang <[email protected]>
AuthorDate: Mon Mar 2 12:09:27 2026 +0800
Fix invalid escape sequences in Python files
Fix SyntaxWarning caused by invalid escape sequences in mainUtils.py
and logfilter.py. These warnings appear on Python 3.12+ (e.g., Ubuntu
24.04) and will become SyntaxError in Python 3.14.
Changes:
- mainUtils.py: Use raw strings for shell commands containing '\$'
- logfilter.py: Use raw docstrings for functions containing regex examples
See: https://github.com/apache/cloudberry/issues/1587
---
gpMgmt/bin/gppylib/logfilter.py | 4 ++--
gpMgmt/bin/gppylib/mainUtils.py | 4 ++--
2 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/gpMgmt/bin/gppylib/logfilter.py b/gpMgmt/bin/gppylib/logfilter.py
index c427ac1a6cb..46c0b5e174a 100644
--- a/gpMgmt/bin/gppylib/logfilter.py
+++ b/gpMgmt/bin/gppylib/logfilter.py
@@ -67,7 +67,7 @@ def FilterLogEntries(iterable,
filters=[],
ibegin=0,
jend=None):
- """
+ r"""
Generator to consume the lines of a GPDB log file from iterable,
yield the lines which satisfy the given criteria, and skip the rest.
@@ -668,7 +668,7 @@ def MatchInFirstLine(iterable, regex):
def NoMatchInFirstLine(iterable, regex):
- """
+ r"""
Generator to filter a stream of groups. Skips those groups whose
first line contains a match for the given regex; yields all other
groups.
diff --git a/gpMgmt/bin/gppylib/mainUtils.py b/gpMgmt/bin/gppylib/mainUtils.py
index 553ca9d57c9..e947639591d 100644
--- a/gpMgmt/bin/gppylib/mainUtils.py
+++ b/gpMgmt/bin/gppylib/mainUtils.py
@@ -488,7 +488,7 @@ def parseStatusLine(line, isStart = False, isStop = False):
def check_fts(fts):
- fts_check_cmd= "ps -ef | awk '{print \$2, \$8}' | grep gpfts | grep -v
grep"
+ fts_check_cmd= r"ps -ef | awk '{print \$2, \$8}' | grep gpfts | grep -v
grep"
process_cmd = "gpssh -h %s -e \"%s\" | wc -l" % (fts, fts_check_cmd)
fts_process_res=int(subprocess.check_output(process_cmd,
shell=True).decode().strip())
return fts_process_res == 2
@@ -500,7 +500,7 @@ def check_etcd(etcd):
if etcd_process_res == 2:
return True
# for demo cluster
- etcd_check_cmd = "ps -ef | awk '{print \$2, \$8}' | grep etcd | grep -v
grep"
+ etcd_check_cmd = r"ps -ef | awk '{print \$2, \$8}' | grep etcd | grep -v
grep"
process_cmd = "gpssh -h %s -e \"%s\"| wc -l" % (etcd, etcd_check_cmd)
etcd_process_res = int(subprocess.check_output(process_cmd,
shell=True).decode().strip())
return etcd_process_res == 2
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]