Skip to content

Commit

Permalink
Pyupgrade linting
Browse files Browse the repository at this point in the history
  • Loading branch information
fauust committed Apr 26, 2024
1 parent 605a77b commit 4ef0fb0
Show file tree
Hide file tree
Showing 7 changed files with 20 additions and 20 deletions.
6 changes: 3 additions & 3 deletions common_factories.py
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,7 @@ def addTests(factory, test_type, mtrDbPool, mtrArgs):
"sh",
"-c",
util.Interpolate(
f"""
fr"""
cd mysql-test &&
exec perl mysql-test-run.pl {test_type_to_mtr_arg[test_type]} --verbose-restart --force --retry=3 --max-save-core=2 --max-save-datadir=10 --max-test-fail=20 --mem --parallel=$(expr %(kw:jobs)s \* 2) %(kw:mtr_additional_args)s
""",
Expand Down Expand Up @@ -272,7 +272,7 @@ def addGaleraTests(factory, mtrDbPool):
"sh",
"-c",
util.Interpolate(
"""
r"""
cd mysql-test &&
if [ -f "$WSREP_PROVIDER" ]; then exec perl mysql-test-run.pl --verbose-restart --force --retry=3 --max-save-core=2 --max-save-datadir=10 --max-test-fail=20 --mem --big-test --parallel=$(expr %(kw:jobs)s \* 2) %(kw:mtr_additional_args)s --suite=wsrep,galera,galera_3nodes,galera_3nodes_sr; fi
""",
Expand Down Expand Up @@ -325,7 +325,7 @@ def getTests(props):
tests_to_run = props.getProperty("tests_to_run", None)
if tests_to_run:
mtr_additional_args = re.sub(
"--suite=\S*", "--skip-not-found " + tests_to_run, mtr_additional_args
r"--suite=\S*", "--skip-not-found " + tests_to_run, mtr_additional_args
)

return mtr_additional_args
Expand Down
2 changes: 1 addition & 1 deletion constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,7 @@
# The following code is auto-generated based on the content of os_info.yaml.
# Edit with care

with open("/srv/buildbot/master/os_info.yaml", "r") as f:
with open("/srv/buildbot/master/os_info.yaml") as f:
os_info = yaml.safe_load(f)

# Generate install builders based on the os_info data
Expand Down
22 changes: 11 additions & 11 deletions cross-reference/crossreference/cr/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,25 +88,25 @@ def select_test_failures(filters, include_failures=True):
"branch": [
# Pattern: 10.?
{
"pattern": "^([0-9]{1,2}\.)(\?)$",
"pattern": r"^([0-9]{1,2}\.)(\?)$",
"filter": [("test_run_id__branch__startswith", "AND")],
"replace": True,
},
# Pattern: 10.1, 10.2, 5.5...
{
"pattern": "^([0-9]{1,2}\.)([0-9]{1,2})$",
"pattern": r"^([0-9]{1,2}\.)([0-9]{1,2})$",
"filter": [("test_run_id__branch__exact", "AND")],
"replace": False,
},
# Pattern: *10.1*, *10.2*...
{
"pattern": "^\*([0-9]{1,2}\.)([0-9]{1,2})\*$",
"pattern": r"^\*([0-9]{1,2}\.)([0-9]{1,2})\*$",
"filter": [("test_run_id__branch__icontains", "AND")],
"replace": True,
},
# Pattern *10.?*
{
"pattern": "^\*([0-9]{1,2}\.)(\?)\*$",
"pattern": r"^\*([0-9]{1,2}\.)(\?)\*$",
"filter": [
("test_run_id__branch__icontains", "AND"),
("test_run_id__branch__startswith", "OR"),
Expand All @@ -133,7 +133,7 @@ def select_test_failures(filters, include_failures=True):
"replace": False,
},
{
"pattern": "^\*[a-zA-Z0-9_.-]*\*$",
"pattern": r"^\*[a-zA-Z0-9_.-]*\*$",
"filter": [("test_run_id__platform__icontains", "AND")],
"replace": True,
},
Expand All @@ -145,7 +145,7 @@ def select_test_failures(filters, include_failures=True):
"replace": False,
},
{
"pattern": "^[a-zA-Z0-9]*\*$",
"pattern": r"^[a-zA-Z0-9]*\*$",
"filter": [("test_run_id__typ__startswith", "AND")],
"replace": True,
},
Expand All @@ -157,7 +157,7 @@ def select_test_failures(filters, include_failures=True):
"replace": False,
},
{
"pattern": "^[a-zA-Z0-9]*\*$",
"pattern": r"^[a-zA-Z0-9]*\*$",
"filter": [("test_run_id__info__startswith", "AND")],
"replace": True,
},
Expand All @@ -169,7 +169,7 @@ def select_test_failures(filters, include_failures=True):
"replace": False,
},
{
"pattern": "^\*\.[/a-zA-Z0-9_.-]*$",
"pattern": r"^\*\.[/a-zA-Z0-9_.-]*$",
"filter": [("test_name__icontains", "AND")],
"replace": True,
},
Expand All @@ -181,7 +181,7 @@ def select_test_failures(filters, include_failures=True):
"replace": False,
},
{
"pattern": "^\*[a-zA-Z0-9]*\*$",
"pattern": r"^\*[a-zA-Z0-9]*\*$",
"filter": [("test_variant__in", "AND")],
"replace": True,
},
Expand All @@ -193,7 +193,7 @@ def select_test_failures(filters, include_failures=True):
"replace": False,
},
{
"pattern": "^\*[a-zA-Z0-9]*\*$",
"pattern": r"^\*[a-zA-Z0-9]*\*$",
"filter": [("failure_text__icontains", "AND")],
"replace": True,
},
Expand All @@ -219,7 +219,7 @@ def select_test_failures(filters, include_failures=True):
# If the input contains ? or * then eliminate them
# This is the case for multiple Regex rules. Example: 10.?, *timeout* etc.
if expression["replace"]:
search_string = re.sub("(\?)|(\*)", "", search_string)
search_string = re.sub(r"(\?)|(\*)", "", search_string)

# Loop through all the filters of a pattern
# The filters are used for the database columns
Expand Down
4 changes: 2 additions & 2 deletions define_masters.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
config = {"private": {}}
exec(open("master-private.cfg").read(), config, {})

with open("os_info.yaml", mode="r", encoding="utf-8") as file:
with open("os_info.yaml", encoding="utf-8") as file:
os_info = yaml.safe_load(file)

platforms = {}
Expand Down Expand Up @@ -64,7 +64,7 @@
shutil.copyfile("master-private.cfg", dir_path + "/master-private.cfg")

buildbot_tac = (
open("buildbot.tac", mode="r", encoding="utf-8").read()
open("buildbot.tac", encoding="utf-8").read()
% master_config["log_name"]
)
with open(dir_path + "/buildbot.tac", mode="w", encoding="utf-8") as f:
Expand Down
2 changes: 1 addition & 1 deletion master-libvirt/get_ssh_cnx_num.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

import yaml

with open("../os_info.yaml", "r") as f:
with open("../os_info.yaml") as f:
os_info = yaml.safe_load(f)

SSH_CONNECTIONS = 0
Expand Down
2 changes: 1 addition & 1 deletion utilities.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ def checkoutUsingGitWorktree():
"bash",
"-xc",
util.Interpolate(
"""
r"""
d=/mnt/packages/
cd "$d"
revision="%(prop:revision)s"
Expand Down
2 changes: 1 addition & 1 deletion utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -705,5 +705,5 @@ def getMetric(hostname, metric):


def read_template(template_name):
with open(f"/srv/buildbot/master/script_templates/{template_name}.sh", "r") as f:
with open(f"/srv/buildbot/master/script_templates/{template_name}.sh") as f:
return f.read()

0 comments on commit 4ef0fb0

Please sign in to comment.