Fix invalid escape sequence warnings

Signed-off-by: Azat Khuzhin <a.khuzhin@semrush.com>
This commit is contained in:
Azat Khuzhin 2024-06-05 09:50:39 +02:00
parent a474816fc7
commit b2535d7f50
14 changed files with 36 additions and 36 deletions

View File

@ -8,7 +8,7 @@ sys.path.insert(0, os.path.join(CURDIR))
from . import uexpect
prompt = ":\) "
prompt = ":\\) "
end_of_block = r".*\r\n.*\r\n"
@ -21,7 +21,7 @@ class client(object):
self.client.eol("\r")
self.client.logger(log, prefix=name)
self.client.timeout(20)
self.client.expect("[#\$] ", timeout=2)
self.client.expect("[#\\$] ", timeout=2)
self.client.send(command)
def __enter__(self):

View File

@ -28,7 +28,7 @@ def parse_response_line(line):
if line.startswith("#"):
return {}
match = re.match("^([a-zA-Z_:][a-zA-Z0-9_:]+)(\{.*\})? -?(\d)", line)
match = re.match(r"^([a-zA-Z_:][a-zA-Z0-9_:]+)(\{.*\})? -?(\d)", line)
assert match, line
name, _, val = match.groups()
return {name: int(val)}

View File

@ -49,16 +49,16 @@ with client(name="client1>", log=log) as client1, client(
client1.send("WATCH 01056_window_view_proc_hop_watch.wv")
client1.expect("Query id" + end_of_block)
client1.expect("Progress: 0.00 rows.*\)")
client1.expect("Progress: 0.00 rows.*\\)")
client2.send(
"INSERT INTO 01056_window_view_proc_hop_watch.mt VALUES (1, now('US/Samoa') + 3)"
)
client1.expect("1" + end_of_block)
client1.expect("Progress: 1.00 rows.*\)")
client1.expect("Progress: 1.00 rows.*\\)")
# send Ctrl-C
client1.send("\x03", eol="")
match = client1.expect("(%s)|([#\$] )" % prompt)
match = client1.expect("(%s)|([#\\$] )" % prompt)
if match.groups()[1]:
client1.send(client1.command)
client1.expect(prompt)

View File

@ -47,7 +47,7 @@ with client(name="client1>", log=log) as client1, client(
client1.send("WATCH db_01059_event_hop_watch_strict_asc.wv")
client1.expect("Query id" + end_of_block)
client1.expect("Progress: 0.00 rows.*\)")
client1.expect("Progress: 0.00 rows.*\\)")
client2.send(
"INSERT INTO db_01059_event_hop_watch_strict_asc.mt VALUES (1, toDateTime('1990/01/01 12:00:00', 'US/Samoa'));"
)
@ -57,7 +57,7 @@ with client(name="client1>", log=log) as client1, client(
)
client2.expect("Ok.")
client1.expect("1*1990-01-01 12:00:02" + end_of_block)
client1.expect("Progress: 1.00 rows.*\)")
client1.expect("Progress: 1.00 rows.*\\)")
client2.send(
"INSERT INTO db_01059_event_hop_watch_strict_asc.mt VALUES (1, toDateTime('1990/01/01 12:00:10', 'US/Samoa'));"
@ -65,11 +65,11 @@ with client(name="client1>", log=log) as client1, client(
client2.expect("Ok.")
client1.expect("1*1990-01-01 12:00:06" + end_of_block)
client1.expect("1*1990-01-01 12:00:08" + end_of_block)
client1.expect("Progress: 3.00 rows.*\)")
client1.expect("Progress: 3.00 rows.*\\)")
# send Ctrl-C
client1.send("\x03", eol="")
match = client1.expect("(%s)|([#\$] )" % prompt)
match = client1.expect("(%s)|([#\\$] )" % prompt)
if match.groups()[1]:
client1.send(client1.command)
client1.expect(prompt)

View File

@ -49,7 +49,7 @@ with client(name="client1>", log=log) as client1, client(
client1.send("WATCH 01062_window_view_event_hop_watch_asc.wv")
client1.expect("Query id" + end_of_block)
client1.expect("Progress: 0.00 rows.*\)")
client1.expect("Progress: 0.00 rows.*\\)")
client2.send(
"INSERT INTO 01062_window_view_event_hop_watch_asc.mt VALUES (1, toDateTime('1990/01/01 12:00:00', 'US/Samoa'));"
)
@ -69,11 +69,11 @@ with client(name="client1>", log=log) as client1, client(
client2.expect(prompt)
client1.expect("1" + end_of_block)
client1.expect("2" + end_of_block)
client1.expect("Progress: 3.00 rows.*\)")
client1.expect("Progress: 3.00 rows.*\\)")
# send Ctrl-C
client1.send("\x03", eol="")
match = client1.expect("(%s)|([#\$] )" % prompt)
match = client1.expect("(%s)|([#\\$] )" % prompt)
if match.groups()[1]:
client1.send(client1.command)
client1.expect(prompt)

View File

@ -50,7 +50,7 @@ with client(name="client1>", log=log) as client1, client(
client1.send("WATCH 01065_window_view_event_hop_watch_bounded.wv")
client1.expect("Query id" + end_of_block)
client1.expect("Progress: 0.00 rows.*\)")
client1.expect("Progress: 0.00 rows.*\\)")
client2.send(
"INSERT INTO 01065_window_view_event_hop_watch_bounded.mt VALUES (1, '1990/01/01 12:00:00');"
)
@ -72,7 +72,7 @@ with client(name="client1>", log=log) as client1, client(
# send Ctrl-C
client1.send("\x03", eol="")
match = client1.expect("(%s)|([#\$] )" % prompt)
match = client1.expect("(%s)|([#\\$] )" % prompt)
if match.groups()[1]:
client1.send(client1.command)
client1.expect(prompt)

View File

@ -49,23 +49,23 @@ with client(name="client1>", log=log) as client1, client(
client1.send("WATCH 01069_window_view_proc_tumble_watch.wv")
client1.expect("Query id" + end_of_block)
client1.expect("Progress: 0.00 rows.*\)")
client1.expect("Progress: 0.00 rows.*\\)")
client2.send(
"INSERT INTO 01069_window_view_proc_tumble_watch.mt VALUES (1, now('US/Samoa') + 3)"
)
client2.expect("Ok.")
client1.expect("1" + end_of_block)
client1.expect("Progress: 1.00 rows.*\)")
client1.expect("Progress: 1.00 rows.*\\)")
client2.send(
"INSERT INTO 01069_window_view_proc_tumble_watch.mt VALUES (1, now('US/Samoa') + 3)"
)
client2.expect("Ok.")
client1.expect("1" + end_of_block)
client1.expect("Progress: 2.00 rows.*\)")
client1.expect("Progress: 2.00 rows.*\\)")
# send Ctrl-C
client1.send("\x03", eol="")
match = client1.expect("(%s)|([#\$] )" % prompt)
match = client1.expect("(%s)|([#\\$] )" % prompt)
if match.groups()[1]:
client1.send(client1.command)
client1.expect(prompt)

View File

@ -49,7 +49,7 @@ with client(name="client1>", log=log) as client1, client(
client1.send("WATCH 01070_window_view_watch_events.wv EVENTS")
client1.expect("Query id" + end_of_block)
client1.expect("Progress: 0.00 rows.*\)")
client1.expect("Progress: 0.00 rows.*\\)")
client2.send(
"INSERT INTO 01070_window_view_watch_events.mt VALUES (1, toDateTime('1990/01/01 12:00:00', 'US/Samoa'));"
)
@ -59,11 +59,11 @@ with client(name="client1>", log=log) as client1, client(
)
client2.expect("Ok.")
client1.expect("1990-01-01 12:00:05" + end_of_block)
client1.expect("Progress: 1.00 rows.*\)")
client1.expect("Progress: 1.00 rows.*\\)")
# send Ctrl-C
client1.send("\x03", eol="")
match = client1.expect("(%s)|([#\$] )" % prompt)
match = client1.expect("(%s)|([#\\$] )" % prompt)
if match.groups()[1]:
client1.send(client1.command)
client1.expect(prompt)

View File

@ -55,7 +55,7 @@ with client(name="client1>", log=log) as client1, client(
client1.send("WATCH 01078_window_view_alter_query_watch.wv")
client1.expect("Query id" + end_of_block)
client1.expect("Progress: 0.00 rows.*\)")
client1.expect("Progress: 0.00 rows.*\\)")
client2.send(
"INSERT INTO 01078_window_view_alter_query_watch.mt VALUES (1, toDateTime('1990/01/01 12:00:00', 'US/Samoa'));"
)
@ -65,7 +65,7 @@ with client(name="client1>", log=log) as client1, client(
)
client2.expect("Ok.")
client1.expect("1" + end_of_block)
client1.expect("Progress: 1.00 rows.*\)")
client1.expect("Progress: 1.00 rows.*\\)")
client2.send(
"ALTER TABLE 01078_window_view_alter_query_watch.wv MODIFY QUERY SELECT count(a) * 2 AS count, hopEnd(wid) AS w_end FROM 01078_window_view_alter_query_watch.mt GROUP BY hop(timestamp, INTERVAL '2' SECOND, INTERVAL '3' SECOND, 'US/Samoa') AS wid"
)
@ -75,7 +75,7 @@ with client(name="client1>", log=log) as client1, client(
client1.expect(prompt)
client3.send("WATCH 01078_window_view_alter_query_watch.wv")
client3.expect("Query id" + end_of_block)
client3.expect("Progress: 0.00 rows.*\)")
client3.expect("Progress: 0.00 rows.*\\)")
client2.send(
"INSERT INTO 01078_window_view_alter_query_watch.mt VALUES (1, toDateTime('1990/01/01 12:00:06', 'US/Samoa'));"
)
@ -85,11 +85,11 @@ with client(name="client1>", log=log) as client1, client(
)
client2.expect("Ok.")
client3.expect("2" + end_of_block)
client3.expect("Progress: 1.00 rows.*\)")
client3.expect("Progress: 1.00 rows.*\\)")
# send Ctrl-C
client3.send("\x03", eol="")
match = client3.expect("(%s)|([#\$] )" % prompt)
match = client3.expect("(%s)|([#\\$] )" % prompt)
if match.groups()[1]:
client3.send(client3.command)
client3.expect(prompt)

View File

@ -49,7 +49,7 @@ with client(name="client1>", log=log) as client1, client(
client1.send("WATCH 01082_window_view_watch_limit.wv LIMIT 1")
client1.expect("Query id" + end_of_block)
client1.expect("Progress: 0.00 rows.*\)")
client1.expect("Progress: 0.00 rows.*\\)")
client2.send(
"INSERT INTO 01082_window_view_watch_limit.mt VALUES (1, '1990/01/01 12:00:00');"
)
@ -59,7 +59,7 @@ with client(name="client1>", log=log) as client1, client(
)
client2.expect("Ok.")
client1.expect("1" + end_of_block)
client1.expect("Progress: 1.00 rows.*\)")
client1.expect("Progress: 1.00 rows.*\\)")
client1.expect("1 row" + end_of_block)
client1.expect(prompt)

View File

@ -15,6 +15,6 @@ log = None
with client(name="client1>", log=log) as client1:
client1.expect(prompt)
client1.send("SELECT number FROM numbers(1000) FORMAT Null")
client1.expect("Progress: 1\.00 thousand rows, 8\.00 KB .*" + end_of_block)
client1.expect("0 rows in set. Elapsed: [\\w]{1}\.[\\w]{3} sec.")
client1.expect("Progress: 1\\.00 thousand rows, 8\\.00 KB .*" + end_of_block)
client1.expect("0 rows in set. Elapsed: [\\w]{1}\\.[\\w]{3} sec.")
client1.expect("Peak memory usage: .*B" + end_of_block)

View File

@ -32,12 +32,12 @@ with client(
)
client1.expect(prompt)
client1.send(f"INSERT INTO test.infile_progress FROM INFILE '{filename}'")
client1.expect("Progress: 5.00 rows, 10.00 B.*\)")
client1.expect("Progress: 5.00 rows, 10.00 B.*\\)")
client1.expect(prompt)
# send Ctrl-C
client1.send("\x03", eol="")
match = client1.expect("(%s)|([#\$] )" % prompt)
match = client1.expect("(%s)|([#\\$] )" % prompt)
if match.groups()[1]:
client1.send(client1.command)
client1.expect(prompt)

View File

@ -8,7 +8,7 @@ sys.path.insert(0, os.path.join(CURDIR))
import uexpect
prompt = ":\) "
prompt = ":\\) "
end_of_block = r".*\r\n.*\r\n"
@ -21,7 +21,7 @@ class client(object):
self.client.eol("\r")
self.client.logger(log, prefix=name)
self.client.timeout(120)
self.client.expect("[#\$] ", timeout=60)
self.client.expect("[#\\$] ", timeout=60)
self.client.send(command)
def __enter__(self):

View File

@ -10,7 +10,7 @@ import uexpect
class shell(object):
def __init__(self, command=None, name="", log=None, prompt="[#\$] "):
def __init__(self, command=None, name="", log=None, prompt="[#\\$] "):
if command is None:
command = ["/bin/bash", "--noediting"]
self.prompt = prompt