fix for python 3.5

This commit is contained in:
Jakob Ketterl 2019-09-02 16:20:49 +01:00
parent 2dcdad3a49
commit aac618bfee

View File

@ -293,8 +293,8 @@ class AprsParser(object):
else: else:
matches = messageIdRegex.match(message) matches = messageIdRegex.match(message)
if matches: if matches:
result["messageid"] = int(matches[2]) result["messageid"] = int(matches.group(2))
message = matches[1] message = matches.group(1)
result["message"] = message result["message"] = message
return result return result
@ -302,13 +302,13 @@ class AprsParser(object):
matches = thirdpartyeRegex.match(information) matches = thirdpartyeRegex.match(information)
if matches: if matches:
logger.debug(matches) logger.debug(matches)
path = matches[2].split(",") path = matches.group(2).split(",")
destination = next((c.strip("*").upper() for c in path if c.endswith("*")), None) destination = next((c.strip("*").upper() for c in path if c.endswith("*")), None)
data = self.parseAprsData({ data = self.parseAprsData({
"source": matches[1].upper(), "source": matches.group(1).upper(),
"destination": destination, "destination": destination,
"path": path, "path": path,
"data": matches[6].encode(encoding) "data": matches.group(6).encode(encoding)
}) })
return { return {
"type": "thirdparty", "type": "thirdparty",
@ -416,8 +416,8 @@ class AprsParser(object):
matches = altitudeRegex.match(comment) matches = altitudeRegex.match(comment)
if matches: if matches:
aprsData["altitude"] = int(matches[2]) * feetToMeters aprsData["altitude"] = int(matches.group(2)) * feetToMeters
comment = matches[1] + matches[3] comment = matches.group(1) + matches.group(3)
aprsData["comment"] = comment aprsData["comment"] = comment