From a6fa28b65d2f89ae8e818cd2e27cc3917bedfe75 Mon Sep 17 00:00:00 2001 From: Michael Tremer Date: Thu, 24 Jul 2025 17:33:37 +0000 Subject: [PATCH] importer: Fix SyntaxWarning about regular expressions /usr/bin/location-importer:1654: SyntaxWarning: invalid escape sequence '\s' route = re.compile(b"^\s(.+?)\s+.+?\[(?:AS(.*?))?.\]$") /usr/bin/location-importer:1724: SyntaxWarning: invalid escape sequence '\s' m = re.match(b"\s+BGP\.as_path:.* (\d+) {\d+}$", line) Signed-off-by: Michael Tremer --- src/scripts/location-importer.in | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/scripts/location-importer.in b/src/scripts/location-importer.in index 641aec2..4072784 100644 --- a/src/scripts/location-importer.in +++ b/src/scripts/location-importer.in @@ -1651,7 +1651,7 @@ class CLI(object): async def _handle_update_announcements_from_bird(self, server): # Pre-compile the regular expression for faster searching - route = re.compile(b"^\s(.+?)\s+.+?\[(?:AS(.*?))?.\]$") + route = re.compile(br"^\s(.+?)\s+.+?\[(?:AS(.*?))?.\]$") log.info("Requesting routing table from Bird (%s)" % server) @@ -1721,7 +1721,7 @@ class CLI(object): # Run "show route all" for each network for line in self._bird_cmd(server, "show route %s all" % network): # Try finding the path - m = re.match(b"\s+BGP\.as_path:.* (\d+) {\d+}$", line) + m = re.match(br"\s+BGP\.as_path:.* (\d+) {\d+}$", line) if m: # Select the last AS number in the path autnum = m.group(1).decode() -- 2.47.2