Skip to content

Commit

Permalink
Clean up the mess with TNLDG
Browse files Browse the repository at this point in the history
  • Loading branch information
kamiccolo committed Jan 26, 2024
1 parent e3843ee commit 2721f5f
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions pynmea2/types/proprietary/tnl.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,13 @@ def __new__(_cls, manufacturer, data):
'''
Return the correct sentence type based on the first field
'''
sentence_type = data[0] or data[1]
name = manufacturer + sentence_type
if name not in _cls.sentence_types:
# TNLDG does not have a sentence type

name_check = manufacturer + data[1]
if name_check not in _cls.sentence_types:
if TNLDG.match(data):
return super(TNL, TNLDG).__new__(TNLDG)
cls = _cls.sentence_types.get(name, _cls)

cls = _cls.sentence_types.get(name_check, _cls)
return super(TNL, cls).__new__(cls)

def __init__(self, manufacturer, data):
Expand Down Expand Up @@ -81,7 +81,7 @@ def match(data):

def __init__(self, *args, **kwargs):
self.subtype = 'TNL'
super(TNLDG, self).__init(*args, **kwargs)
super(TNLDG, self).__init__(*args, **kwargs)

fields = (
('Empty', '_'),
Expand Down

0 comments on commit 2721f5f

Please sign in to comment.