@@ -447,14 +447,14 @@ def evaluate_numeric(self, seq: str) -> str:
447447 self .__cur_qso__ ['FREQ' ] = self .__freq__
448448 else :
449449 self .__freq__ = ''
450- self .__cur_qso__ .pop ('FREQ' )
450+ self .__cur_qso__ .pop ('FREQ' , '' )
451451 elif seq .endswith ('p' ):
452452 if seq [:- 1 ] != '0' :
453453 self .__pwr__ = seq [:- 1 ]
454454 self .__cur_qso__ ['TX_POWER' ] = self .__pwr__
455455 else :
456456 self .__pwr__ = ''
457- self .__cur_qso__ .pop ('TX_POWER' )
457+ self .__cur_qso__ .pop ('TX_POWER' , '' )
458458 else :
459459 return 'Error: Unknown number format'
460460 return ''
@@ -502,20 +502,30 @@ def evaluate_extended(self, seq: str) -> str:
502502 self .__my_call__ = seq [2 :].upper ()
503503 self .__cur_qso__ ['STATION_CALLSIGN' ] = self .__my_call__
504504 elif seq .startswith ('-l' ):
505+ if seq == '-l' :
506+ self .__cur_qso__ .pop ('MY_GRIDSQUARE' , '' )
507+ self .__cur_qso__ .pop ('MY_CITY' , '' )
508+ self .__my_loc__ = ''
509+ self .__my_qth__ = ''
510+ return ''
505511 if not self .check_format (self .REGEX_LOCATOR , seq [2 :]) and not self .check_qth (seq [2 :]):
506512 return 'Error: Wrong QTH/maidenhead format'
507513 if self .check_format (self .REGEX_LOCATOR , seq [2 :]):
508514 self .__my_loc__ = seq [2 :4 ].upper () + seq [4 :]
509515 self .__cur_qso__ ['MY_GRIDSQUARE' ] = self .__my_loc__
510516 if 'MY_CITY' in self .__cur_qso__ :
511- self .__cur_qso__ .pop ('MY_CITY' )
517+ self .__cur_qso__ .pop ('MY_CITY' , '' )
512518 self .__my_qth__ = ''
513519 else :
514520 self .__my_qth__ , self .__my_loc__ = self .check_qth (seq [2 :])
515521 self .__my_qth__ = self .__my_qth__ .replace ('_' , ' ' )
516522 self .__cur_qso__ ['MY_GRIDSQUARE' ] = self .__my_loc__
517523 self .__cur_qso__ ['MY_CITY' ] = self .__my_qth__
518524 elif seq .startswith ('-n' ):
525+ if seq == '-n' :
526+ self .__cur_qso__ .pop ('MY_NAME' , '' )
527+ self .__my_name__ = ''
528+ return ''
519529 self .__my_name__ = seq [2 :].replace ('_' , ' ' )
520530 self .__cur_qso__ ['MY_NAME' ] = self .__my_name__
521531 elif seq .startswith ('-N' ): # Start contest qso ID
@@ -530,12 +540,16 @@ def evaluate_extended(self, seq: str) -> str:
530540 return ''
531541
532542 def evaluate_locator (self , seq : str ) -> str :
543+ if seq == '' :
544+ self .__cur_qso__ .pop ('GRIDSQUARE' , '' )
545+ self .__cur_qso__ .pop ('QTH' , '' )
546+ return ''
547+
533548 if not self .check_format (self .REGEX_LOCATOR , seq ) and not self .check_qth (seq ):
534549 return 'Error: Wrong QTH/maidenhead format'
535550 if self .check_format (self .REGEX_LOCATOR , seq ):
536551 self .__cur_qso__ ['GRIDSQUARE' ] = seq [:2 ].upper () + seq [2 :]
537- if 'QTH' in self .__cur_qso__ :
538- self .__cur_qso__ .pop ('QTH' )
552+ self .__cur_qso__ .pop ('QTH' , '' )
539553 else :
540554 qth , loc = self .check_qth (seq )
541555 self .__cur_qso__ ['GRIDSQUARE' ] = loc [:2 ].upper () + loc [2 :]
@@ -584,8 +598,14 @@ def evaluate(self, seq: str) -> str:
584598 self .__cur_qso__ ['MODE' ] = self .__mode__
585599 self .set_rst_default (self .__mode__ )
586600 elif seq .startswith ('#' ): # Comment
601+ if seq == '#' :
602+ self .__cur_qso__ .pop ('COMMENT' , '' )
603+ return ''
587604 self .__cur_qso__ ['COMMENT' ] = seq [1 :].replace ('_' , ' ' )
588605 elif seq .startswith ('\' ' ): # Name
606+ if seq == '\' ' :
607+ self .__cur_qso__ .pop ('NAME' , '' )
608+ return ''
589609 self .__cur_qso__ ['NAME' ] = seq [1 :].replace ('_' , ' ' )
590610 elif seq .startswith ('@' ): # Locator
591611 return self .evaluate_locator (seq [1 :])
@@ -639,5 +659,5 @@ def evaluate_own_event_ref(self, seq):
639659 self .__cur_qso__ ['STX_STRING' ] = f'{ self .__event_ref__ :03d} '
640660 except ValueError :
641661 self .__event_ref__ = seq [2 :].upper ()
642- self .__cur_qso__ .pop ('STX' )
662+ self .__cur_qso__ .pop ('STX' , '' )
643663 self .__cur_qso__ ['STX_STRING' ] = self .__event_ref__
0 commit comments