diff --git a/csdr/module/m17.py b/csdr/module/m17.py index 5bcf5449..ff17739f 100644 --- a/csdr/module/m17.py +++ b/csdr/module/m17.py @@ -9,7 +9,7 @@ import pickle class M17Module(PopenModule): - lsfRegex = re.compile("SRC: ([a-zA-Z0-9]+), DEST: ([a-zA-Z0-9]+)") + lsfRegex = re.compile(r"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 17fd5bb2..29ef2561 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("^([0-9A-Z]{2}|[A-Z]{3})0*([0-9]+[A-Z]*)$") - self.reDots = re.compile("^\.*([^\.].*?)\.*$") - self.reIATA = re.compile("^..[0-9]+$") + 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]+$") super().__init__(filePrefix=filePrefix, service=service) def parse(self, msg: bytes): diff --git a/owrx/aprs/__init__.py b/owrx/aprs/__init__.py index e59909f5..cb564003 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("(^.*)\\/A=([0-9]{6})(.*$)") +altitudeRegex = re.compile(r"(^.*)\\/A=([0-9]{6})(.*$)") # regex for parsing third-party headers -thirdpartyeRegex = re.compile("^([a-zA-Z0-9-]+)>((([a-zA-Z0-9-]+\\*?,)*)([a-zA-Z0-9-]+\\*?)):(.*)$") +thirdpartyeRegex = re.compile(r"^([a-zA-Z0-9-]+)>((([a-zA-Z0-9-]+\\*?,)*)([a-zA-Z0-9-]+\\*?)):(.*)$") # regex for getting the message id out of message -messageIdRegex = re.compile("^(.*){([0-9]{1,5})$") +messageIdRegex = re.compile(r"^(.*){([0-9]{1,5})$") # regex to filter aliases from the path -noHopPattern = re.compile("^(WIDE[0-9]?(-[0-9])?|ECHO|RELAY|TRACE|GATE)\\*?$") +noHopPattern = re.compile(r"^(WIDE[0-9]?(-[0-9])?|ECHO|RELAY|TRACE|GATE)\\*?$") def decodeBase91(input): diff --git a/owrx/client.py b/owrx/client.py index 6ee0c5b2..1c5bab1a 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("\W+", "", name) + name = re.sub(r"\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 05551da9..abc9d242 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(".*\\.([a-z]{3,})$") + pattern = re.compile(r".*\\.([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 5cf73001..f91b37bf 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("^[a-z0-9]+$"))) + super().__init__(BoolValidator(), RegexValidator(re.compile(r"^[a-z0-9]+$"))) class DspManager(SdrSourceEventClient, ClientDemodulatorSecondaryDspEventClient): diff --git a/owrx/feature.py b/owrx/feature.py index 97248419..a807de13 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("^{} version (.*)$".format(re.escape(command))) + owrx_connector_version_regex = re.compile(r"^{} version (.*)$".format(re.escape(command))) try: process = subprocess.Popen([command, "--version"], stdout=subprocess.PIPE) @@ -309,7 +309,7 @@ class FeatureDetector(object): def _has_soapy_driver(self, driver): try: process = subprocess.Popen(["SoapySDRUtil", "--info"], stdout=subprocess.PIPE, stderr=subprocess.DEVNULL) - factory_regex = re.compile("^Available factories\\.\\.\\. ?(.*)$") + factory_regex = re.compile(r"^Available factories\\.\\.\\. ?(.*)$") drivers = [] for line in process.stdout: @@ -458,7 +458,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("^WSJT-X (.*)$") + wsjt_version_regex = re.compile(r"^WSJT-X (.*)$") try: process = subprocess.Popen(["wsjtx_app_version", "--version"], stdout=subprocess.PIPE) @@ -530,9 +530,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 412a94cc..97e96968 100644 --- a/owrx/js8.py +++ b/owrx/js8.py @@ -83,7 +83,7 @@ class Js8TurboProfile(Js8Profile): class Js8Parser(AudioChopperParser): - decoderRegex = re.compile(" ?") + decoderRegex = re.compile(r" ?") def parse(self, profile: AudioChopperProfile, freq: int, raw_msg: bytes): try: diff --git a/owrx/markers.py b/owrx/markers.py index fc82307c..0befd2b5 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("^\s*//.*", "", data, flags=re.MULTILINE)) + data = json.loads(re.sub(r"^\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 baa12208..182faff4 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("^([A-Z0-9]+)(\\s.*)?$") + talkerAliasRegex = re.compile(r"^([A-Z0-9]+)(\\s.*)?$") def __init__(self, parser): super().__init__("dmr", parser) diff --git a/owrx/receiverid.py b/owrx/receiverid.py index e21760af..b95e9125 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("^([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 (.*)$") +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 (.*)$") class KeyException(Exception): diff --git a/owrx/storage.py b/owrx/storage.py index 265b8ad9..c4a1ec4f 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('\.bmp$', '.png', inFile) + outFile = re.sub(r'\.bmp$', '.png', inFile) if outFile==inFile: return try: diff --git a/owrx/wsjt.py b/owrx/wsjt.py index 32f54d70..7f07a355 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(".*\\s([A-Z0-9/]{2,})(\\sR)?\\s([A-R]{2}[0-9]{2})$") + locator_pattern = re.compile(r".*\\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("([A-Z0-9/]*)\\s([A-R]{2}[0-9]{2})\\s([0-9]+)") + wspr_splitter_pattern = re.compile(r"([A-Z0-9/]*)\\s([A-R]{2}[0-9]{2})\\s([0-9]+)") def parse(self, msg): m = BeaconMessageParser.wspr_splitter_pattern.match(msg)