rename src dir
This commit is contained in:
20
src/AbstractDataObject.py
Normal file
20
src/AbstractDataObject.py
Normal file
@ -0,0 +1,20 @@
|
||||
import re
|
||||
import json
|
||||
|
||||
class InvalidDataObjectException(Exception):
|
||||
def __init__(self, message):
|
||||
super().__init__(message)
|
||||
|
||||
class AbstractDataObject(object):
|
||||
invalidChars = re.compile("[#+\s]")
|
||||
|
||||
def __init__(self, topicPart):
|
||||
self.topicPart = topicPart
|
||||
|
||||
def getTopicPart(self):
|
||||
if AbstractDataObject.invalidChars.search(self.topicPart):
|
||||
raise InvalidDataObjectException(f"Topic contains invalid characters: {self.topicPart}")
|
||||
return self.topicPart
|
||||
|
||||
def getPayload(self):
|
||||
raise NotImplementedError()
|
Reference in New Issue
Block a user