kopia lustrzana https://github.com/glidernet/python-ogn-client
The comment is just optional
rodzic
a90f3ed1a9
commit
c98c8eca04
|
@ -1,7 +1,7 @@
|
||||||
import re
|
import re
|
||||||
|
|
||||||
|
|
||||||
PATTERN_APRS_POSITION = re.compile(r"^(?P<callsign>.+?)>(?P<dstcall>[A-Z0-9]+),.+,(?P<receiver>.+?):/(?P<time>\d{6})+h(?P<latitude>\d{4}\.\d{2})(?P<latitude_sign>N|S)(?P<symbol_table>.)(?P<longitude>\d{5}\.\d{2})(?P<longitude_sign>E|W)(?P<symbol>.)(?P<course_extension>(?P<course>\d{3})/(?P<ground_speed>\d{3}))?/A=(?P<altitude>\d{6})(?P<pos_extension>\s!W((?P<latitude_enhancement>\d)(?P<longitude_enhancement>\d))!)?\s(?P<comment>.*)$")
|
PATTERN_APRS_POSITION = re.compile(r"^(?P<callsign>.+?)>(?P<dstcall>[A-Z0-9]+),.+,(?P<receiver>.+?):/(?P<time>\d{6})+h(?P<latitude>\d{4}\.\d{2})(?P<latitude_sign>N|S)(?P<symbol_table>.)(?P<longitude>\d{5}\.\d{2})(?P<longitude_sign>E|W)(?P<symbol>.)(?P<course_extension>(?P<course>\d{3})/(?P<ground_speed>\d{3}))?/A=(?P<altitude>\d{6})(?P<pos_extension>\s!W((?P<latitude_enhancement>\d)(?P<longitude_enhancement>\d))!)?(?:\s(?P<comment>.*))?$")
|
||||||
PATTERN_APRS_STATUS = re.compile(r"(?P<callsign>.+?)>(?P<dstcall>[A-Z0-9]+),.+,(?P<receiver>.+?):>(?P<time>\d{6})+h\s(?P<comment>.*)$")
|
PATTERN_APRS_STATUS = re.compile(r"(?P<callsign>.+?)>(?P<dstcall>[A-Z0-9]+),.+,(?P<receiver>.+?):>(?P<time>\d{6})+h\s(?P<comment>.*)$")
|
||||||
|
|
||||||
# The following regexp patterns are part of the ruby ogn-client.
|
# The following regexp patterns are part of the ruby ogn-client.
|
||||||
|
|
|
@ -14,7 +14,8 @@ class TestStringMethods(unittest.TestCase):
|
||||||
for line in f:
|
for line in f:
|
||||||
if not line[0] == '#':
|
if not line[0] == '#':
|
||||||
aprs = parse_aprs(line, datetime(2015, 4, 10, 17, 0))
|
aprs = parse_aprs(line, datetime(2015, 4, 10, 17, 0))
|
||||||
parse_ogn_beacon(aprs['comment'])
|
if aprs['comment']:
|
||||||
|
parse_ogn_beacon(aprs['comment'])
|
||||||
|
|
||||||
def test_fail_none(self):
|
def test_fail_none(self):
|
||||||
with self.assertRaises(TypeError):
|
with self.assertRaises(TypeError):
|
||||||
|
|
Ładowanie…
Reference in New Issue