mirror of
https://gitlab.alpinelinux.org/alpine/aports.git
synced 2025-08-05 21:37:15 +02:00
72 lines
2.6 KiB
Diff
72 lines
2.6 KiB
Diff
From 1889b1c2e2ff877168f1beb6f5c1d0207a0107b4 Mon Sep 17 00:00:00 2001
|
|
From: Jamie Strandboge <jdstrand@ubuntu.com>
|
|
Date: Thu, 1 Feb 2024 08:08:12 -0600
|
|
Subject: [PATCH 1/3] fix: update 're' invocations for 3.12 syntax warnings
|
|
|
|
---
|
|
src/common.py | 2 +-
|
|
src/parser.py | 4 ++--
|
|
src/util.py | 4 ++--
|
|
3 files changed, 5 insertions(+), 5 deletions(-)
|
|
|
|
diff --git a/src/common.py b/src/common.py
|
|
index 9e8417c..b97cf00 100644
|
|
--- a/src/common.py
|
|
+++ b/src/common.py
|
|
@@ -221,7 +221,7 @@ class UFWRule:
|
|
raise UFWError(err_msg)
|
|
if int(ran[0]) >= int(ran[1]):
|
|
raise UFWError(err_msg)
|
|
- elif re.match('^\d+$', p):
|
|
+ elif re.match(r'^\d+$', p):
|
|
if int(p) < 1 or int(p) > 65535:
|
|
raise UFWError(err_msg)
|
|
elif re.match(r'^\w[\w\-]+', p):
|
|
diff --git a/src/parser.py b/src/parser.py
|
|
index b979da2..e2e018f 100644
|
|
--- a/src/parser.py
|
|
+++ b/src/parser.py
|
|
@@ -228,7 +228,7 @@ class UFWCommandRule(UFWCommand):
|
|
except ValueError as e:
|
|
raise UFWError(e)
|
|
|
|
- if not re.match('^\d([0-9,:]*\d+)*$', port):
|
|
+ if not re.match(r'^\d([0-9,:]*\d+)*$', port):
|
|
if ',' in port or ':' in port:
|
|
err_msg = _("Port ranges must be numeric")
|
|
raise UFWError(err_msg)
|
|
@@ -354,7 +354,7 @@ class UFWCommandRule(UFWCommand):
|
|
rule.sapp = tmp
|
|
else:
|
|
rule.dapp = tmp
|
|
- elif not re.match('^\d([0-9,:]*\d+)*$', tmp):
|
|
+ elif not re.match(r'^\d([0-9,:]*\d+)*$', tmp):
|
|
if ',' in tmp or ':' in tmp:
|
|
err_msg = _("Port ranges must be numeric")
|
|
raise UFWError(err_msg)
|
|
diff --git a/src/util.py b/src/util.py
|
|
index 98e3c70..a02ddfb 100644
|
|
--- a/src/util.py
|
|
+++ b/src/util.py
|
|
@@ -480,7 +480,7 @@ def _valid_dotted_quads(nm, v6):
|
|
return False
|
|
else:
|
|
if re.match(r'^[0-9]+\.[0-9\.]+$', nm):
|
|
- quads = re.split('\.', nm)
|
|
+ quads = nm.split('.')
|
|
if len(quads) != 4:
|
|
return False
|
|
for q in quads:
|
|
@@ -742,7 +742,7 @@ def get_iptables_version(exe=None):
|
|
(rc, out) = cmd([exe, '-V'])
|
|
if rc != 0:
|
|
raise OSError(errno.ENOENT, "Error running '%s'" % (exe))
|
|
- tmp = re.split('\s', out)
|
|
+ tmp = out.split()
|
|
return re.sub('^v', '', tmp[1])
|
|
|
|
|
|
--
|
|
2.45.2
|
|
|