From dbbf20aa0eb753abbdaae2f3af64d7b073703e7b Mon Sep 17 00:00:00 2001 From: Marat Fayzullin Date: Wed, 31 Jan 2024 21:33:44 -0500 Subject: [PATCH] Rolling back some regex changes. --- csdr/module/m17.py | 2 +- owrx/aircraft.py | 6 +++--- owrx/aprs/__init__.py | 8 ++++---- owrx/client.py | 2 +- owrx/controllers/settings/general.py | 2 +- owrx/dsp.py | 2 +- owrx/feature.py | 8 ++++---- owrx/js8.py | 2 +- owrx/markers.py | 2 +- owrx/meta.py | 2 +- owrx/receiverid.py | 6 +++--- owrx/storage.py | 2 +- owrx/wsjt.py | 4 ++-- 13 files changed, 24 insertions(+), 24 deletions(-) diff --git a/csdr/module/m17.py b/csdr/module/m17.py index ff17739f..5bcf5449 100644 --- a/csdr/module/m17.py +++ b/csdr/module/m17.py @@ -9,7 +9,7 @@ import pickle class M17Module(PopenModule): - lsfRegex = re.compile(r"SRC: ([a-zA-Z0-9]+), DEST: ([a-zA-Z0-9]+)") + lsfRegex = re.compile("SRC: ([a-zA-Z0-9]+), DEST: ([a-zA-Z0-9]+)") def __init__(self): super().__init__() diff --git a/owrx/aircraft.py b/owrx/aircraft.py index 29ef2561..17fd5bb2 100644 --- a/owrx/aircraft.py +++ b/owrx/aircraft.py @@ -307,9 +307,9 @@ class AircraftManager(object): # class AircraftParser(TextParser): def __init__(self, filePrefix: str = None, service: bool = False): - self.reFlight = re.compile(r"^([0-9A-Z]{2}|[A-Z]{3})0*([0-9]+[A-Z]*)$") - self.reDots = re.compile(r"^\.*([^\.].*?)\.*$") - self.reIATA = re.compile(r"^..[0-9]+$") + self.reFlight = re.compile("^([0-9A-Z]{2}|[A-Z]{3})0*([0-9]+[A-Z]*)$") + self.reDots = re.compile("^\.*([^\.].*?)\.*$") + self.reIATA = re.compile("^..[0-9]+$") super().__init__(filePrefix=filePrefix, service=service) def parse(self, msg: bytes): diff --git a/owrx/aprs/__init__.py b/owrx/aprs/__init__.py index cb564003..e59909f5 100644 --- a/owrx/aprs/__init__.py +++ b/owrx/aprs/__init__.py @@ -24,16 +24,16 @@ def fahrenheitToCelsius(f): encoding = "utf-8" # regex for altitute in comment field -altitudeRegex = re.compile(r"(^.*)\\/A=([0-9]{6})(.*$)") +altitudeRegex = re.compile("(^.*)\\/A=([0-9]{6})(.*$)") # regex for parsing third-party headers -thirdpartyeRegex = re.compile(r"^([a-zA-Z0-9-]+)>((([a-zA-Z0-9-]+\\*?,)*)([a-zA-Z0-9-]+\\*?)):(.*)$") +thirdpartyeRegex = re.compile("^([a-zA-Z0-9-]+)>((([a-zA-Z0-9-]+\\*?,)*)([a-zA-Z0-9-]+\\*?)):(.*)$") # regex for getting the message id out of message -messageIdRegex = re.compile(r"^(.*){([0-9]{1,5})$") +messageIdRegex = re.compile("^(.*){([0-9]{1,5})$") # regex to filter aliases from the path -noHopPattern = re.compile(r"^(WIDE[0-9]?(-[0-9])?|ECHO|RELAY|TRACE|GATE)\\*?$") +noHopPattern = re.compile("^(WIDE[0-9]?(-[0-9])?|ECHO|RELAY|TRACE|GATE)\\*?$") def decodeBase91(input): diff --git a/owrx/client.py b/owrx/client.py index 1c5bab1a..6ee0c5b2 100644 --- a/owrx/client.py +++ b/owrx/client.py @@ -80,7 +80,7 @@ class ClientRegistry(object): with self.chatLock: if name is not None: # Names can only include alphanumerics - name = re.sub(r"\W+", "", name) + name = re.sub("\W+", "", name) # Cannot have duplicate names if client not in self.chat or name != self.chat[client]["name"]: for c in self.chat: diff --git a/owrx/controllers/settings/general.py b/owrx/controllers/settings/general.py index abc9d242..05551da9 100644 --- a/owrx/controllers/settings/general.py +++ b/owrx/controllers/settings/general.py @@ -302,7 +302,7 @@ class GeneralSettingsController(SettingsFormController): else: # get file extension (at least 3 characters) # should be all lowercase since they are set by the upload script - pattern = re.compile(r".*\\.([a-z]{3,})$") + pattern = re.compile(".*\\.([a-z]{3,})$") matches = pattern.match(data[image_id]) if matches is None: logger.warning("could not determine file extension for %s", image_id) diff --git a/owrx/dsp.py b/owrx/dsp.py index f91b37bf..5cf73001 100644 --- a/owrx/dsp.py +++ b/owrx/dsp.py @@ -421,7 +421,7 @@ class ModulationValidator(OrValidator): """ def __init__(self): - super().__init__(BoolValidator(), RegexValidator(re.compile(r"^[a-z0-9]+$"))) + super().__init__(BoolValidator(), RegexValidator(re.compile("^[a-z0-9]+$"))) class DspManager(SdrSourceEventClient, ClientDemodulatorSecondaryDspEventClient): diff --git a/owrx/feature.py b/owrx/feature.py index 78fefd77..f2b52d14 100644 --- a/owrx/feature.py +++ b/owrx/feature.py @@ -263,7 +263,7 @@ class FeatureDetector(object): return False def _check_connector(self, command, required_version): - owrx_connector_version_regex = re.compile(r"^{} version (.*)$".format(re.escape(command))) + owrx_connector_version_regex = re.compile("^{} version (.*)$".format(re.escape(command))) try: process = subprocess.Popen([command, "--version"], stdout=subprocess.PIPE) @@ -454,7 +454,7 @@ class FeatureDetector(object): return reduce(and_, map(self.command_is_runnable, ["jt9", "wsprd"]), True) def _has_wsjtx_version(self, required_version): - wsjt_version_regex = re.compile(r"^WSJT-X (.*)$") + wsjt_version_regex = re.compile("^WSJT-X (.*)$") try: process = subprocess.Popen(["wsjtx_app_version", "--version"], stdout=subprocess.PIPE) @@ -526,9 +526,9 @@ class FeatureDetector(object): def has_freedv_rx(self): """ - The "freedv_rx" executable is required to demodulate FreeDV digital transmissions. It comes together with the + The "freedv\_rx" executable is required to demodulate FreeDV digital transmissions. It comes together with the codec2 library, but it's only a supplemental part and not installed by default or contained in its packages. - To install it, you will need to compile codec2 from source and manually install freedv_rx. + To install it, you will need to compile codec2 from source and manually install freedv\_rx. Detailed installation instructions are available on the [OpenWebRX wiki](https://github.com/jketterl/openwebrx/wiki/FreeDV-demodulator-notes). diff --git a/owrx/js8.py b/owrx/js8.py index 97e96968..412a94cc 100644 --- a/owrx/js8.py +++ b/owrx/js8.py @@ -83,7 +83,7 @@ class Js8TurboProfile(Js8Profile): class Js8Parser(AudioChopperParser): - decoderRegex = re.compile(r" ?") + decoderRegex = re.compile(" ?") def parse(self, profile: AudioChopperProfile, freq: int, raw_msg: bytes): try: diff --git a/owrx/markers.py b/owrx/markers.py index 0befd2b5..fc82307c 100644 --- a/owrx/markers.py +++ b/owrx/markers.py @@ -388,7 +388,7 @@ class Markers(object): result = {} try: data = urllib.request.urlopen(url).read().decode('utf-8') - data = json.loads(re.sub(r"^\s*//.*", "", data, flags=re.MULTILINE)) + data = json.loads(re.sub("^\s*//.*", "", data, flags=re.MULTILINE)) for entry in data: if "lat" in entry and "lon" in entry and "url" in entry: diff --git a/owrx/meta.py b/owrx/meta.py index 182faff4..baa12208 100644 --- a/owrx/meta.py +++ b/owrx/meta.py @@ -140,7 +140,7 @@ class DigihamEnricher(Enricher, metaclass=ABCMeta): class DmrEnricher(DigihamEnricher, RadioIDEnricher): # callsign must be uppercase alphanumeric and at the beginning # if there's anything after the callsign, it must be separated by a whitespace - talkerAliasRegex = re.compile(r"^([A-Z0-9]+)(\\s.*)?$") + talkerAliasRegex = re.compile("^([A-Z0-9]+)(\\s.*)?$") def __init__(self, parser): super().__init__("dmr", parser) diff --git a/owrx/receiverid.py b/owrx/receiverid.py index b95e9125..e21760af 100644 --- a/owrx/receiverid.py +++ b/owrx/receiverid.py @@ -8,9 +8,9 @@ from owrx.config import Config logger = logging.getLogger(__name__) -keyRegex = re.compile(r"^([a-zA-Z]+)-([0-9a-f]{32})-([0-9a-f]{64})$") -keyChallengeRegex = re.compile(r"^([a-zA-Z]+)-([0-9a-f]{32})-([0-9a-f]{32})$") -headerRegex = re.compile(r"^ReceiverId (.*)$") +keyRegex = re.compile("^([a-zA-Z]+)-([0-9a-f]{32})-([0-9a-f]{64})$") +keyChallengeRegex = re.compile("^([a-zA-Z]+)-([0-9a-f]{32})-([0-9a-f]{32})$") +headerRegex = re.compile("^ReceiverId (.*)$") class KeyException(Exception): diff --git a/owrx/storage.py b/owrx/storage.py index c4a1ec4f..265b8ad9 100644 --- a/owrx/storage.py +++ b/owrx/storage.py @@ -107,7 +107,7 @@ class Storage(object): if not inFile.startswith('/'): inFile = self.getFilePath(inFile) # Only converting BMP files for now - outFile = re.sub(r'\.bmp$', '.png', inFile) + outFile = re.sub('\.bmp$', '.png', inFile) if outFile==inFile: return try: diff --git a/owrx/wsjt.py b/owrx/wsjt.py index 7f07a355..32f54d70 100644 --- a/owrx/wsjt.py +++ b/owrx/wsjt.py @@ -344,7 +344,7 @@ class MessageParser(ABC): # Used in QSO-style modes (FT8, FT4, FST4) class QsoMessageParser(MessageParser): - locator_pattern = re.compile(r".*\\s([A-Z0-9/]{2,})(\\sR)?\\s([A-R]{2}[0-9]{2})$") + locator_pattern = re.compile(".*\\s([A-Z0-9/]{2,})(\\sR)?\\s([A-R]{2}[0-9]{2})$") def parse(self, msg): m = QsoMessageParser.locator_pattern.match(msg) @@ -359,7 +359,7 @@ class QsoMessageParser(MessageParser): # Used in propagation reporting / beacon modes (WSPR / FST4W) class BeaconMessageParser(MessageParser): - wspr_splitter_pattern = re.compile(r"([A-Z0-9/]*)\\s([A-R]{2}[0-9]{2})\\s([0-9]+)") + wspr_splitter_pattern = re.compile("([A-Z0-9/]*)\\s([A-R]{2}[0-9]{2})\\s([0-9]+)") def parse(self, msg): m = BeaconMessageParser.wspr_splitter_pattern.match(msg)