Browse Source

move the compile to a class var, so that it doesn't

get recompiled everytime..
pyserial_fix
John-Mark Gurney 7 years ago
parent
commit
1d4904ebf2
1 changed files with 2 additions and 2 deletions
  1. +2
    -2
      alarmdecoder/messages.py

+ 2
- 2
alarmdecoder/messages.py View File

@@ -118,6 +118,8 @@ class Message(BaseMessage):
panel_data = None panel_data = None
"""The panel data field associated with this message.""" """The panel data field associated with this message."""


_regex = re.compile('^(!KPM:){0,1}(\[[a-fA-F0-9\-]+\]),([a-fA-F0-9]+),(\[[a-fA-F0-9]+\]),(".+")$')

def __init__(self, data=None): def __init__(self, data=None):
""" """
Constructor Constructor
@@ -127,8 +129,6 @@ class Message(BaseMessage):
""" """
BaseMessage.__init__(self) BaseMessage.__init__(self)


self._regex = re.compile('^(!KPM:){0,1}(\[[a-fA-F0-9\-]+\]),([a-fA-F0-9]+),(\[[a-fA-F0-9]+\]),(".+")$')

if data is not None: if data is not None:
self._parse_message(data) self._parse_message(data)




Loading…
Cancel
Save