Rolling back some regex changes.
This commit is contained in:
parent
f24034b3ae
commit
dbbf20aa0e
|
|
@ -9,7 +9,7 @@ import pickle
|
||||||
|
|
||||||
|
|
||||||
class M17Module(PopenModule):
|
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):
|
def __init__(self):
|
||||||
super().__init__()
|
super().__init__()
|
||||||
|
|
|
||||||
|
|
@ -307,9 +307,9 @@ class AircraftManager(object):
|
||||||
#
|
#
|
||||||
class AircraftParser(TextParser):
|
class AircraftParser(TextParser):
|
||||||
def __init__(self, filePrefix: str = None, service: bool = False):
|
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.reFlight = re.compile("^([0-9A-Z]{2}|[A-Z]{3})0*([0-9]+[A-Z]*)$")
|
||||||
self.reDots = re.compile(r"^\.*([^\.].*?)\.*$")
|
self.reDots = re.compile("^\.*([^\.].*?)\.*$")
|
||||||
self.reIATA = re.compile(r"^..[0-9]+$")
|
self.reIATA = re.compile("^..[0-9]+$")
|
||||||
super().__init__(filePrefix=filePrefix, service=service)
|
super().__init__(filePrefix=filePrefix, service=service)
|
||||||
|
|
||||||
def parse(self, msg: bytes):
|
def parse(self, msg: bytes):
|
||||||
|
|
|
||||||
|
|
@ -24,16 +24,16 @@ def fahrenheitToCelsius(f):
|
||||||
encoding = "utf-8"
|
encoding = "utf-8"
|
||||||
|
|
||||||
# regex for altitute in comment field
|
# 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
|
# 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
|
# 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
|
# 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):
|
def decodeBase91(input):
|
||||||
|
|
|
||||||
|
|
@ -80,7 +80,7 @@ class ClientRegistry(object):
|
||||||
with self.chatLock:
|
with self.chatLock:
|
||||||
if name is not None:
|
if name is not None:
|
||||||
# Names can only include alphanumerics
|
# Names can only include alphanumerics
|
||||||
name = re.sub(r"\W+", "", name)
|
name = re.sub("\W+", "", name)
|
||||||
# Cannot have duplicate names
|
# Cannot have duplicate names
|
||||||
if client not in self.chat or name != self.chat[client]["name"]:
|
if client not in self.chat or name != self.chat[client]["name"]:
|
||||||
for c in self.chat:
|
for c in self.chat:
|
||||||
|
|
|
||||||
|
|
@ -302,7 +302,7 @@ class GeneralSettingsController(SettingsFormController):
|
||||||
else:
|
else:
|
||||||
# get file extension (at least 3 characters)
|
# get file extension (at least 3 characters)
|
||||||
# should be all lowercase since they are set by the upload script
|
# 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])
|
matches = pattern.match(data[image_id])
|
||||||
if matches is None:
|
if matches is None:
|
||||||
logger.warning("could not determine file extension for %s", image_id)
|
logger.warning("could not determine file extension for %s", image_id)
|
||||||
|
|
|
||||||
|
|
@ -421,7 +421,7 @@ class ModulationValidator(OrValidator):
|
||||||
"""
|
"""
|
||||||
|
|
||||||
def __init__(self):
|
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):
|
class DspManager(SdrSourceEventClient, ClientDemodulatorSecondaryDspEventClient):
|
||||||
|
|
|
||||||
|
|
@ -263,7 +263,7 @@ class FeatureDetector(object):
|
||||||
return False
|
return False
|
||||||
|
|
||||||
def _check_connector(self, command, required_version):
|
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:
|
try:
|
||||||
process = subprocess.Popen([command, "--version"], stdout=subprocess.PIPE)
|
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)
|
return reduce(and_, map(self.command_is_runnable, ["jt9", "wsprd"]), True)
|
||||||
|
|
||||||
def _has_wsjtx_version(self, required_version):
|
def _has_wsjtx_version(self, required_version):
|
||||||
wsjt_version_regex = re.compile(r"^WSJT-X (.*)$")
|
wsjt_version_regex = re.compile("^WSJT-X (.*)$")
|
||||||
|
|
||||||
try:
|
try:
|
||||||
process = subprocess.Popen(["wsjtx_app_version", "--version"], stdout=subprocess.PIPE)
|
process = subprocess.Popen(["wsjtx_app_version", "--version"], stdout=subprocess.PIPE)
|
||||||
|
|
@ -526,9 +526,9 @@ class FeatureDetector(object):
|
||||||
|
|
||||||
def has_freedv_rx(self):
|
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.
|
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
|
Detailed installation instructions are available on the
|
||||||
[OpenWebRX wiki](https://github.com/jketterl/openwebrx/wiki/FreeDV-demodulator-notes).
|
[OpenWebRX wiki](https://github.com/jketterl/openwebrx/wiki/FreeDV-demodulator-notes).
|
||||||
|
|
|
||||||
|
|
@ -83,7 +83,7 @@ class Js8TurboProfile(Js8Profile):
|
||||||
|
|
||||||
|
|
||||||
class Js8Parser(AudioChopperParser):
|
class Js8Parser(AudioChopperParser):
|
||||||
decoderRegex = re.compile(r" ?<Decode(Started|Debug|Finished)>")
|
decoderRegex = re.compile(" ?<Decode(Started|Debug|Finished)>")
|
||||||
|
|
||||||
def parse(self, profile: AudioChopperProfile, freq: int, raw_msg: bytes):
|
def parse(self, profile: AudioChopperProfile, freq: int, raw_msg: bytes):
|
||||||
try:
|
try:
|
||||||
|
|
|
||||||
|
|
@ -388,7 +388,7 @@ class Markers(object):
|
||||||
result = {}
|
result = {}
|
||||||
try:
|
try:
|
||||||
data = urllib.request.urlopen(url).read().decode('utf-8')
|
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:
|
for entry in data:
|
||||||
if "lat" in entry and "lon" in entry and "url" in entry:
|
if "lat" in entry and "lon" in entry and "url" in entry:
|
||||||
|
|
|
||||||
|
|
@ -140,7 +140,7 @@ class DigihamEnricher(Enricher, metaclass=ABCMeta):
|
||||||
class DmrEnricher(DigihamEnricher, RadioIDEnricher):
|
class DmrEnricher(DigihamEnricher, RadioIDEnricher):
|
||||||
# callsign must be uppercase alphanumeric and at the beginning
|
# callsign must be uppercase alphanumeric and at the beginning
|
||||||
# if there's anything after the callsign, it must be separated by a whitespace
|
# 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):
|
def __init__(self, parser):
|
||||||
super().__init__("dmr", parser)
|
super().__init__("dmr", parser)
|
||||||
|
|
|
||||||
|
|
@ -8,9 +8,9 @@ from owrx.config import Config
|
||||||
logger = logging.getLogger(__name__)
|
logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|
||||||
keyRegex = re.compile(r"^([a-zA-Z]+)-([0-9a-f]{32})-([0-9a-f]{64})$")
|
keyRegex = re.compile("^([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})$")
|
keyChallengeRegex = re.compile("^([a-zA-Z]+)-([0-9a-f]{32})-([0-9a-f]{32})$")
|
||||||
headerRegex = re.compile(r"^ReceiverId (.*)$")
|
headerRegex = re.compile("^ReceiverId (.*)$")
|
||||||
|
|
||||||
|
|
||||||
class KeyException(Exception):
|
class KeyException(Exception):
|
||||||
|
|
|
||||||
|
|
@ -107,7 +107,7 @@ class Storage(object):
|
||||||
if not inFile.startswith('/'):
|
if not inFile.startswith('/'):
|
||||||
inFile = self.getFilePath(inFile)
|
inFile = self.getFilePath(inFile)
|
||||||
# Only converting BMP files for now
|
# Only converting BMP files for now
|
||||||
outFile = re.sub(r'\.bmp$', '.png', inFile)
|
outFile = re.sub('\.bmp$', '.png', inFile)
|
||||||
if outFile==inFile:
|
if outFile==inFile:
|
||||||
return
|
return
|
||||||
try:
|
try:
|
||||||
|
|
|
||||||
|
|
@ -344,7 +344,7 @@ class MessageParser(ABC):
|
||||||
|
|
||||||
# Used in QSO-style modes (FT8, FT4, FST4)
|
# Used in QSO-style modes (FT8, FT4, FST4)
|
||||||
class QsoMessageParser(MessageParser):
|
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):
|
def parse(self, msg):
|
||||||
m = QsoMessageParser.locator_pattern.match(msg)
|
m = QsoMessageParser.locator_pattern.match(msg)
|
||||||
|
|
@ -359,7 +359,7 @@ class QsoMessageParser(MessageParser):
|
||||||
|
|
||||||
# Used in propagation reporting / beacon modes (WSPR / FST4W)
|
# Used in propagation reporting / beacon modes (WSPR / FST4W)
|
||||||
class BeaconMessageParser(MessageParser):
|
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):
|
def parse(self, msg):
|
||||||
m = BeaconMessageParser.wspr_splitter_pattern.match(msg)
|
m = BeaconMessageParser.wspr_splitter_pattern.match(msg)
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue