callinfo: recognize callsigns with digits in the suffix

This commit is contained in:
Tobias Wellnitz, DH1TW 2022-12-26 21:13:13 +01:00
parent 19f00eac5b
commit 01284a5ae8
4 changed files with 31 additions and 2 deletions

View file

@ -1,6 +1,14 @@
Changelog
---------
PyHamtools 0.8.5
================
26. December 2022
* refined regex for decoding callsigns. In particular to better recognize callsigns with one or more digits in the suffix (e.g. TI5N5BEK, DP44N44T)
PyHamtools 0.8.4
================

View file

@ -205,7 +205,7 @@ class Callinfo(object):
return self._iterate_prefix(callsign, timestamp)
# regular callsigns, without prefix or appendix
elif re.match('^[\\d]{0,1}[A-Z]{1,2}\\d([A-Z]{1,4}|\\d{3,3}|\\d{1,3}[A-Z])[A-Z]{0,5}$', callsign):
elif re.match('^[\\d]{0,1}[A-Z]{1,2}\\d{1,2}[A-Z]{1,2}([A-Z]{1,4}|\\d{1,3})[A-Z]{0,5}$', callsign):
return self._iterate_prefix(callsign, timestamp)
# callsigns with prefixes (xxx/callsign)

View file

@ -1,3 +1,3 @@
VERSION = (0, 8, 4)
VERSION = (0, 8, 5)
__release__ = ''.join(['-.'[type(x) == int]+str(x) for x in VERSION])[1:]
__version__ = '.'.join((str(VERSION[0]), str(VERSION[1])))

View file

@ -103,6 +103,24 @@ response_prefix_VK9GMW_clublog = {
u'longitude': 155.8
}
response_prefix_8J1H90T_clublog = {
u'adif': 339,
u'continent': u'AS',
u'country': u'JAPAN',
u'cqz': 25,
u'latitude': 35.7,
u'longitude': 139.8
}
response_prefix_TI5N5BEK_clublog = {
u'adif': 308,
u'continent': u'NA',
u'country': u'COSTA RICA',
u'cqz': 7,
u'latitude': 9.9,
u'longitude': -84.0
}
response_callsign_exceptions_7N1PRD_0_clublog = {
u'adif': 339,
u'continent': u'AS',
@ -231,12 +249,15 @@ class Test_callinfo_methods:
assert fix_callinfo._dismantle_callsign("DH1TW/M") == response_prefix_DH_clublog
assert fix_callinfo._dismantle_callsign("DH1TW/B")[const.BEACON]
assert fix_callinfo._dismantle_callsign("DH1TW") == response_prefix_DH_clublog
assert fix_callinfo._dismantle_callsign("DP44N44T") == response_prefix_DH_clublog
assert fix_callinfo._dismantle_callsign("DL/HC2AO") == response_prefix_DH_clublog
assert fix_callinfo._dismantle_callsign("9H5A/C6A") == response_prefix_C6A_clublog
assert fix_callinfo._dismantle_callsign("C6A/9H5A") == response_prefix_C6A_clublog
assert fix_callinfo._dismantle_callsign("DH1TW/UNI") == response_prefix_DH_clublog
assert fix_callinfo._dismantle_callsign("DH1TW/BUX") == response_prefix_DH_clublog
assert fix_callinfo._dismantle_callsign("DH1TW/NOT") == response_prefix_DH_clublog
assert fix_callinfo._dismantle_callsign("8J1H90T") == response_prefix_8J1H90T_clublog
assert fix_callinfo._dismantle_callsign("TI5N5BEK") == response_prefix_TI5N5BEK_clublog
assert fix_callinfo._dismantle_callsign("VK9DLX/NOT") == response_prefix_VK9DLX_clublog
assert fix_callinfo._dismantle_callsign("7QAA") == response_callsign_exceptions_7QAA_clublog
assert fix_callinfo._dismantle_callsign("7N1PRD/0") == response_callsign_exceptions_7N1PRD_0_clublog