From 1d4904ebf29d286f1859f0180a75093f74ba337a Mon Sep 17 00:00:00 2001 From: John-Mark Gurney Date: Wed, 6 Sep 2017 15:49:20 -0700 Subject: [PATCH] move the compile to a class var, so that it doesn't get recompiled everytime.. --- alarmdecoder/messages.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/alarmdecoder/messages.py b/alarmdecoder/messages.py index d1bd0e1..e78592c 100644 --- a/alarmdecoder/messages.py +++ b/alarmdecoder/messages.py @@ -118,6 +118,8 @@ class Message(BaseMessage): panel_data = None """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): """ Constructor @@ -127,8 +129,6 @@ class Message(BaseMessage): """ 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: self._parse_message(data)