Avoid "DeprecationWarning: invalid escape sequence"

Without this change, many warnings like this will be generated while running pytest:
```
test/test_template.py:3
  /build/source/test/test_template.py:3: DeprecationWarning: invalid escape sequence '\/'
    """!
```
This can also be seen when manually running python with warnings enabled.

This happens because the comment uses a multiline string and Python interprets the backslash in the logo as an escape character and complains that \/ is not a valid escape sequence. To fix this, prepend the string with the letter r to indicate that the backslash should be treated as a literal character, see https://docs.python.org/3/reference/lexical_analysis.html#index-20.
I also applied this change to all the comment strings since that shouldn't break anything and to establish it as a pattern for the future so this problem hopefully never happens again.

This is what I did specifically:
- Change the comment at the top of bw_client.py and bw_server.py to start with `"""!` since that seems to be the pattern here
- Search-and-Replace all occurances of `"""!` with `r"""!`
- Manually change the strings in `logoToLog()` in boswatch/utils/header.py
This commit is contained in:
Luflosi 2023-09-19 16:13:23 +02:00
parent 1b95474bc2
commit d4dcc75711
No known key found for this signature in database
GPG key ID: 4E41E29EDCC345D0
50 changed files with 327 additions and 327 deletions

View file

@ -1,6 +1,6 @@
#!/usr/bin/python #!/usr/bin/python
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
"""! r"""!
____ ____ ______ __ __ __ _____ ____ ____ ______ __ __ __ _____
/ __ )/ __ \/ ___/ | / /___ _/ /______/ /_ |__ / / __ )/ __ \/ ___/ | / /___ _/ /______/ /_ |__ /
/ __ / / / /\__ \| | /| / / __ `/ __/ ___/ __ \ /_ < / __ / / / /\__ \| | /| / / __ `/ __/ ___/ __ \ /_ <
@ -22,8 +22,8 @@ logging.debug("- %s loaded", __name__)
class ClassName: class ClassName:
"""!General class comment""" r"""!General class comment"""
def __init__(self): def __init__(self):
"""!init comment""" r"""!init comment"""
pass pass

View file

@ -1,6 +1,6 @@
#!/usr/bin/python #!/usr/bin/python
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
"""! r"""!
____ ____ ______ __ __ __ _____ ____ ____ ______ __ __ __ _____
/ __ )/ __ \/ ___/ | / /___ _/ /______/ /_ |__ / / __ )/ __ \/ ___/ | / /___ _/ /______/ /_ |__ /
/ __ / / / /\__ \| | /| / / __ `/ __/ ___/ __ \ /_ < / __ / / / /\__ \| | /| / / __ `/ __/ ___/ __ \ /_ <
@ -34,15 +34,15 @@ class ConfigYAML:
yield item yield item
def __len__(self): def __len__(self):
"""!returns the length of an config element""" r"""!returns the length of an config element"""
return len(self._config) return len(self._config)
def __str__(self): def __str__(self):
"""!Returns the string representation of the internal config dict""" r"""!Returns the string representation of the internal config dict"""
return str(self._config) return str(self._config)
def loadConfigFile(self, configPath): def loadConfigFile(self, configPath):
"""!loads a given configuration file r"""!loads a given configuration file
@param configPath: Path to the config file @param configPath: Path to the config file
@return True or False""" @return True or False"""
@ -59,7 +59,7 @@ class ConfigYAML:
return False return False
def get(self, *args, default=None): def get(self, *args, default=None):
"""!Get a single value from the config r"""!Get a single value from the config
or a value set in a new configYAML class instance or a value set in a new configYAML class instance
@param *args: Config section (one ore more strings) @param *args: Config section (one ore more strings)

View file

@ -1,6 +1,6 @@
#!/usr/bin/python #!/usr/bin/python
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
"""! r"""!
____ ____ ______ __ __ __ _____ ____ ____ ______ __ __ __ _____
/ __ )/ __ \/ ___/ | / /___ _/ /______/ /_ |__ / / __ )/ __ \/ ___/ | / /___ _/ /______/ /_ |__ /
/ __ / / / /\__ \| | /| / / __ `/ __/ ___/ __ \ /_ < / __ / / / /\__ \| | /| / / __ `/ __/ ___/ __ \ /_ <
@ -27,7 +27,7 @@ class Decoder:
@staticmethod @staticmethod
def decode(data): def decode(data):
"""!Choose the right decoder and return a bwPacket instance r"""!Choose the right decoder and return a bwPacket instance
@param data: data to decode @param data: data to decode
@return bwPacket instance""" @return bwPacket instance"""

View file

@ -1,6 +1,6 @@
#!/usr/bin/python #!/usr/bin/python
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
"""! r"""!
____ ____ ______ __ __ __ _____ ____ ____ ______ __ __ __ _____
/ __ )/ __ \/ ___/ | / /___ _/ /______/ /_ |__ / / __ )/ __ \/ ___/ | / /___ _/ /______/ /_ |__ /
/ __ / / / /\__ \| | /| / / __ `/ __/ ___/ __ \ /_ < / __ / / / /\__ \| | /| / / __ `/ __/ ___/ __ \ /_ <
@ -24,7 +24,7 @@ logging.debug("- %s loaded", __name__)
class FmsDecoder: class FmsDecoder:
"""!FMS decoder class r"""!FMS decoder class
This class decodes FMS data. This class decodes FMS data.
First step is to validate the data and _check if the format is correct. First step is to validate the data and _check if the format is correct.
@ -32,7 +32,7 @@ class FmsDecoder:
@staticmethod @staticmethod
def decode(data): def decode(data):
"""!Decodes FMS r"""!Decodes FMS
@param data: FMS for decoding @param data: FMS for decoding
@return BOSWatch FMS packet or None""" @return BOSWatch FMS packet or None"""

View file

@ -1,6 +1,6 @@
#!/usr/bin/python #!/usr/bin/python
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
"""! r"""!
____ ____ ______ __ __ __ _____ ____ ____ ______ __ __ __ _____
/ __ )/ __ \/ ___/ | / /___ _/ /______/ /_ |__ / / __ )/ __ \/ ___/ | / /___ _/ /______/ /_ |__ /
/ __ / / / /\__ \| | /| / / __ `/ __/ ___/ __ \ /_ < / __ / / / /\__ \| | /| / / __ `/ __/ ___/ __ \ /_ <
@ -24,7 +24,7 @@ logging.debug("- %s loaded", __name__)
class PocsagDecoder: class PocsagDecoder:
"""!POCSAG decoder class r"""!POCSAG decoder class
This class decodes POCSAG data. This class decodes POCSAG data.
First step is to validate the data and _check if the format is correct. First step is to validate the data and _check if the format is correct.
@ -32,7 +32,7 @@ class PocsagDecoder:
@staticmethod @staticmethod
def decode(data): def decode(data):
"""!Decodes POCSAG r"""!Decodes POCSAG
@param data: POCSAG for decoding @param data: POCSAG for decoding
@return BOSWatch POCSAG packet or None""" @return BOSWatch POCSAG packet or None"""
@ -63,7 +63,7 @@ class PocsagDecoder:
@staticmethod @staticmethod
def _getBitrateRicSubric(data): def _getBitrateRicSubric(data):
"""!Gets the Bitrate, Ric and Subric from data r"""!Gets the Bitrate, Ric and Subric from data
@param data: POCSAG data string @param data: POCSAG data string
@return bitrate @return bitrate

View file

@ -1,6 +1,6 @@
#!/usr/bin/python #!/usr/bin/python
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
"""! r"""!
____ ____ ______ __ __ __ _____ ____ ____ ______ __ __ __ _____
/ __ )/ __ \/ ___/ | / /___ _/ /______/ /_ |__ / / __ )/ __ \/ ___/ | / /___ _/ /______/ /_ |__ /
/ __ / / / /\__ \| | /| / / __ `/ __/ ___/ __ \ /_ < / __ / / / /\__ \| | /| / / __ `/ __/ ___/ __ \ /_ <
@ -24,7 +24,7 @@ logging.debug("- %s loaded", __name__)
class ZveiDecoder: class ZveiDecoder:
"""!ZVEI decoder class r"""!ZVEI decoder class
This class decodes ZVEI data. This class decodes ZVEI data.
First step is to validate the data and _check if the format is correct. First step is to validate the data and _check if the format is correct.
@ -33,7 +33,7 @@ class ZveiDecoder:
@staticmethod @staticmethod
def decode(data): def decode(data):
"""!Decodes ZVEI r"""!Decodes ZVEI
@param data: ZVEI for decoding @param data: ZVEI for decoding
@return BOSWatch ZVEI packet or None""" @return BOSWatch ZVEI packet or None"""
@ -51,7 +51,7 @@ class ZveiDecoder:
@staticmethod @staticmethod
def _solveDoubleTone(data): def _solveDoubleTone(data):
"""!Remove the doubleTone sign (here its the 'E') r"""!Remove the doubleTone sign (here its the 'E')
@param data: ZVEI for double tone sign replacement @param data: ZVEI for double tone sign replacement
@return Double Tone replaced ZVEI""" @return Double Tone replaced ZVEI"""

View file

@ -1,6 +1,6 @@
#!/usr/bin/python #!/usr/bin/python
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
"""! r"""!
____ ____ ______ __ __ __ _____ ____ ____ ______ __ __ __ _____
/ __ )/ __ \/ ___/ | / /___ _/ /______/ /_ |__ / / __ )/ __ \/ ___/ | / /___ _/ /______/ /_ |__ /
/ __ / / / /\__ \| | /| / / __ `/ __/ ___/ __ \ /_ < / __ / / / /\__ \| | /| / / __ `/ __/ ___/ __ \ /_ <
@ -26,10 +26,10 @@ logging.debug("- %s loaded", __name__)
class InputBase(ABC): class InputBase(ABC):
"""!Base class for handling inout sources""" r"""!Base class for handling inout sources"""
def __init__(self, inputQueue, inputConfig, decoderConfig): def __init__(self, inputQueue, inputConfig, decoderConfig):
"""!Build a new InputSource class r"""!Build a new InputSource class
@param inputQueue: Python queue object to store input data @param inputQueue: Python queue object to store input data
@param inputConfig: ConfigYaml object with the inoutSource config @param inputConfig: ConfigYaml object with the inoutSource config
@ -41,7 +41,7 @@ class InputBase(ABC):
self._decoderConfig = decoderConfig self._decoderConfig = decoderConfig
def start(self): def start(self):
"""!Start the input source thread""" r"""!Start the input source thread"""
logging.debug("starting input thread") logging.debug("starting input thread")
self._isRunning = True self._isRunning = True
self._inputThread = threading.Thread(target=self._runThread, name="inputThread", self._inputThread = threading.Thread(target=self._runThread, name="inputThread",
@ -51,10 +51,10 @@ class InputBase(ABC):
@abstractmethod @abstractmethod
def _runThread(self, dataQueue, sdrConfig, decoderConfig): def _runThread(self, dataQueue, sdrConfig, decoderConfig):
"""!Thread routine of the input source has to be inherit""" r"""!Thread routine of the input source has to be inherit"""
def shutdown(self): def shutdown(self):
"""!Stop the input source thread""" r"""!Stop the input source thread"""
if self._isRunning: if self._isRunning:
logging.debug("wait for stopping the input thread") logging.debug("wait for stopping the input thread")
self._isRunning = False self._isRunning = False
@ -62,7 +62,7 @@ class InputBase(ABC):
logging.debug("input thread stopped") logging.debug("input thread stopped")
def addToQueue(self, data): def addToQueue(self, data):
"""!Decode and add alarm data to the queue for further processing during boswatch client""" r"""!Decode and add alarm data to the queue for further processing during boswatch client"""
bwPacket = Decoder.decode(data) bwPacket = Decoder.decode(data)
if bwPacket is not None: if bwPacket is not None:
self._inputQueue.put_nowait((bwPacket, time.time())) self._inputQueue.put_nowait((bwPacket, time.time()))

View file

@ -1,6 +1,6 @@
#!/usr/bin/python #!/usr/bin/python
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
"""! r"""!
____ ____ ______ __ __ __ _____ ____ ____ ______ __ __ __ _____
/ __ )/ __ \/ ___/ | / /___ _/ /______/ /_ |__ / / __ )/ __ \/ ___/ | / /___ _/ /______/ /_ |__ /
/ __ / / / /\__ \| | /| / / __ `/ __/ ___/ __ \ /_ < / __ / / / /\__ \| | /| / / __ `/ __/ ___/ __ \ /_ <
@ -23,7 +23,7 @@ logging.debug("- %s loaded", __name__)
class LineInInput(InputBase): class LineInInput(InputBase):
"""!Class for the line-in input source""" r"""!Class for the line-in input source"""
def _runThread(self, dataQueue, lineInConfig, decoderConfig): def _runThread(self, dataQueue, lineInConfig, decoderConfig):
lineInProc = None lineInProc = None

View file

@ -1,6 +1,6 @@
#!/usr/bin/python #!/usr/bin/python
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
"""! r"""!
____ ____ ______ __ __ __ _____ ____ ____ ______ __ __ __ _____
/ __ )/ __ \/ ___/ | / /___ _/ /______/ /_ |__ / / __ )/ __ \/ ___/ | / /___ _/ /______/ /_ |__ /
/ __ / / / /\__ \| | /| / / __ `/ __/ ___/ __ \ /_ < / __ / / / /\__ \| | /| / / __ `/ __/ ___/ __ \ /_ <
@ -23,7 +23,7 @@ logging.debug("- %s loaded", __name__)
class PulseAudioInput(InputBase): class PulseAudioInput(InputBase):
"""!Class for the PulseAudio input source""" r"""!Class for the PulseAudio input source"""
def _runThread(self, dataQueue, PulseAudioConfig, decoderConfig): def _runThread(self, dataQueue, PulseAudioConfig, decoderConfig):
PulseAudioProc = None PulseAudioProc = None

View file

@ -1,6 +1,6 @@
#!/usr/bin/python #!/usr/bin/python
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
"""! r"""!
____ ____ ______ __ __ __ _____ ____ ____ ______ __ __ __ _____
/ __ )/ __ \/ ___/ | / /___ _/ /______/ /_ |__ / / __ )/ __ \/ ___/ | / /___ _/ /______/ /_ |__ /
/ __ / / / /\__ \| | /| / / __ `/ __/ ___/ __ \ /_ < / __ / / / /\__ \| | /| / / __ `/ __/ ___/ __ \ /_ <
@ -24,7 +24,7 @@ logging.debug("- %s loaded", __name__)
class SdrInput(InputBase): class SdrInput(InputBase):
"""!Class for the sdr input source""" r"""!Class for the sdr input source"""
def _runThread(self, dataQueue, sdrConfig, decoderConfig): def _runThread(self, dataQueue, sdrConfig, decoderConfig):
sdrProc = None sdrProc = None

View file

@ -1,6 +1,6 @@
#!/usr/bin/python #!/usr/bin/python
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
"""! r"""!
____ ____ ______ __ __ __ _____ ____ ____ ______ __ __ __ _____
/ __ )/ __ \/ ___/ | / /___ _/ /______/ /_ |__ / / __ )/ __ \/ ___/ | / /___ _/ /______/ /_ |__ /
/ __ / / / /\__ \| | /| / / __ `/ __/ ___/ __ \ /_ < / __ / / / /\__ \| | /| / / __ `/ __/ ___/ __ \ /_ <
@ -22,10 +22,10 @@ logging.debug("- %s loaded", __name__)
class BroadcastClient: class BroadcastClient:
"""!BroadcastClient class""" r"""!BroadcastClient class"""
def __init__(self, port=5000): def __init__(self, port=5000):
"""!Create an BroadcastClient instance r"""!Create an BroadcastClient instance
@param port: port to send broadcast packets (5000)""" @param port: port to send broadcast packets (5000)"""
self._broadcastPort = port self._broadcastPort = port
@ -39,7 +39,7 @@ class BroadcastClient:
self._socket.settimeout(3) self._socket.settimeout(3)
def getConnInfo(self, retry=0): def getConnInfo(self, retry=0):
"""!Get the connection info from server over udp broadcast r"""!Get the connection info from server over udp broadcast
This function will send broadcast package(s) This function will send broadcast package(s)
to get connection info from the server. to get connection info from the server.
@ -73,20 +73,20 @@ class BroadcastClient:
@property @property
def serverIP(self): def serverIP(self):
"""!Property to get the server IP after successful broadcast""" r"""!Property to get the server IP after successful broadcast"""
return self._serverIP return self._serverIP
@property @property
def serverPort(self): def serverPort(self):
"""!Property to get the server Port after successful broadcast""" r"""!Property to get the server Port after successful broadcast"""
return self._serverPort return self._serverPort
class BroadcastServer: class BroadcastServer:
"""!BroadcastServer class""" r"""!BroadcastServer class"""
def __init__(self, servePort=8080, listenPort=5000): def __init__(self, servePort=8080, listenPort=5000):
"""!Create an BroadcastServer instance r"""!Create an BroadcastServer instance
@param servePort: port to serve as connection info (8080) @param servePort: port to serve as connection info (8080)
@param listenPort: port to listen for broadcast packets (5000)""" @param listenPort: port to listen for broadcast packets (5000)"""
@ -106,7 +106,7 @@ class BroadcastServer:
pass pass
def start(self): def start(self):
"""!Start the broadcast server in a new thread r"""!Start the broadcast server in a new thread
@return True or False""" @return True or False"""
if not self.isRunning: if not self.isRunning:
@ -121,7 +121,7 @@ class BroadcastServer:
return True return True
def stop(self): def stop(self):
"""!Stop the broadcast server r"""!Stop the broadcast server
Due to the timeout of the socket, Due to the timeout of the socket,
stopping the thread can be delayed by two seconds. stopping the thread can be delayed by two seconds.
@ -138,7 +138,7 @@ class BroadcastServer:
return True return True
def _listen(self): def _listen(self):
"""!Broadcast server worker thread r"""!Broadcast server worker thread
This function listen for magic packets on broadcast This function listen for magic packets on broadcast
address and send the connection info to the clients. address and send the connection info to the clients.
@ -161,7 +161,7 @@ class BroadcastServer:
@property @property
def isRunning(self): def isRunning(self):
"""!Property of broadcast server running state""" r"""!Property of broadcast server running state"""
if self._serverThread: if self._serverThread:
return True return True
return False return False

View file

@ -1,6 +1,6 @@
#!/usr/bin/python #!/usr/bin/python
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
"""! r"""!
____ ____ ______ __ __ __ _____ ____ ____ ______ __ __ __ _____
/ __ )/ __ \/ ___/ | / /___ _/ /______/ /_ |__ / / __ )/ __ \/ ___/ | / /___ _/ /______/ /_ |__ /
/ __ / / / /\__ \| | /| / / __ `/ __/ ___/ __ \ /_ < / __ / / / /\__ \| | /| / / __ `/ __/ ___/ __ \ /_ <
@ -24,17 +24,17 @@ HEADERSIZE = 10
class TCPClient: class TCPClient:
"""!TCP client class""" r"""!TCP client class"""
def __init__(self, timeout=3): def __init__(self, timeout=3):
"""!Create a new instance r"""!Create a new instance
@param timeout: timeout for the client in sec. (3)""" @param timeout: timeout for the client in sec. (3)"""
socket.setdefaulttimeout(timeout) socket.setdefaulttimeout(timeout)
self._sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM) self._sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
def connect(self, host="localhost", port=8080): def connect(self, host="localhost", port=8080):
"""!Connect to the server r"""!Connect to the server
@param host: Server IP address ("localhost") @param host: Server IP address ("localhost")
@param port: Server Port (8080) @param port: Server Port (8080)
@ -52,7 +52,7 @@ class TCPClient:
return False return False
def disconnect(self): def disconnect(self):
"""!Disconnect from the server r"""!Disconnect from the server
@return True or False""" @return True or False"""
try: try:
@ -68,7 +68,7 @@ class TCPClient:
return False return False
def transmit(self, data): def transmit(self, data):
"""!Send a data packet to the server r"""!Send a data packet to the server
@param data: data to send to the server @param data: data to send to the server
@return True or False""" @return True or False"""
@ -84,7 +84,7 @@ class TCPClient:
return False return False
def receive(self, timeout=1): def receive(self, timeout=1):
"""!Receive data from the server r"""!Receive data from the server
@param timeout: to wait for incoming data in seconds @param timeout: to wait for incoming data in seconds
@return received data""" @return received data"""
@ -109,7 +109,7 @@ class TCPClient:
@property @property
def isConnected(self): def isConnected(self):
"""!Property of client connected state""" r"""!Property of client connected state"""
try: try:
if self._sock: if self._sock:
_, write, _ = select.select([], [self._sock], [], 0.1) _, write, _ = select.select([], [self._sock], [], 0.1)

View file

@ -1,6 +1,6 @@
#!/usr/bin/python #!/usr/bin/python
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
"""! r"""!
____ ____ ______ __ __ __ _____ ____ ____ ______ __ __ __ _____
/ __ )/ __ \/ ___/ | / /___ _/ /______/ /_ |__ / / __ )/ __ \/ ___/ | / /___ _/ /______/ /_ |__ /
/ __ / / / /\__ \| | /| / / __ `/ __/ ___/ __ \ /_ < / __ / / / /\__ \| | /| / / __ `/ __/ ___/ __ \ /_ <
@ -21,10 +21,10 @@ logging.debug("- %s loaded", __name__)
class NetCheck: class NetCheck:
"""!Worker class to check internet connection""" r"""!Worker class to check internet connection"""
def __init__(self, hostname="https://www.google.com/", timeout=1): def __init__(self, hostname="https://www.google.com/", timeout=1):
"""!Create a new NetCheck instance r"""!Create a new NetCheck instance
@param hostname: host against connection check is running ("https://www.google.com/") @param hostname: host against connection check is running ("https://www.google.com/")
@param timeout: timeout for connection check in sec. (1)""" @param timeout: timeout for connection check in sec. (1)"""
@ -34,7 +34,7 @@ class NetCheck:
self.checkConn() # initiate a first check self.checkConn() # initiate a first check
def checkConn(self): def checkConn(self):
"""!Check the connection r"""!Check the connection
@return True or False""" @return True or False"""
try: try:

View file

@ -1,6 +1,6 @@
#!/usr/bin/python #!/usr/bin/python
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
"""! r"""!
____ ____ ______ __ __ __ _____ ____ ____ ______ __ __ __ _____
/ __ )/ __ \/ ___/ | / /___ _/ /______/ /_ |__ / / __ )/ __ \/ ___/ | / /___ _/ /______/ /_ |__ /
/ __ / / / /\__ \| | /| / / __ `/ __/ ___/ __ \ /_ < / __ / / / /\__ \| | /| / / __ `/ __/ ___/ __ \ /_ <
@ -27,10 +27,10 @@ HEADERSIZE = 10
class _ThreadedTCPRequestHandler(socketserver.BaseRequestHandler): class _ThreadedTCPRequestHandler(socketserver.BaseRequestHandler):
"""!ThreadedTCPRequestHandler class for our TCPServer class.""" r"""!ThreadedTCPRequestHandler class for our TCPServer class."""
def handle(self): def handle(self):
"""!Handles the request from an single client in a own thread r"""!Handles the request from an single client in a own thread
Insert a request in the clients[] list and send a [ack]""" Insert a request in the clients[] list and send a [ack]"""
with self.server.clientsConnectedLock: # because our list is not threadsafe with self.server.clientsConnectedLock: # because our list is not threadsafe
@ -79,15 +79,15 @@ class _ThreadedTCPRequestHandler(socketserver.BaseRequestHandler):
class _ThreadedTCPServer(socketserver.ThreadingMixIn, socketserver.TCPServer): class _ThreadedTCPServer(socketserver.ThreadingMixIn, socketserver.TCPServer):
"""!ThreadedTCPServer class for our TCPServer class.""" r"""!ThreadedTCPServer class for our TCPServer class."""
pass pass
class TCPServer: class TCPServer:
"""!TCP server class""" r"""!TCP server class"""
def __init__(self, alarmQueue, timeout=3): def __init__(self, alarmQueue, timeout=3):
"""!Create a new instance r"""!Create a new instance
@param alarmQueue: python queue instance @param alarmQueue: python queue instance
@param timeout: server timeout in sec (3) @param timeout: server timeout in sec (3)
@ -105,7 +105,7 @@ class TCPServer:
self.stop() self.stop()
def start(self, port=8080): def start(self, port=8080):
"""!Start a threaded TCP socket server r"""!Start a threaded TCP socket server
Start a TCP Socket Server in a new thread that will Start a TCP Socket Server in a new thread that will
then start one more thread for each client request. then start one more thread for each client request.
@ -139,7 +139,7 @@ class TCPServer:
return True return True
def stop(self): def stop(self):
"""!Stops the TCP socket server r"""!Stops the TCP socket server
@return True or False""" @return True or False"""
if self.isRunning: if self.isRunning:
@ -155,14 +155,14 @@ class TCPServer:
return True return True
def countClientsConnected(self): def countClientsConnected(self):
"""!Number of currently connected Clients r"""!Number of currently connected Clients
@return Connected clients""" @return Connected clients"""
with self._clientsConnectedLock: # because our list is not threadsafe with self._clientsConnectedLock: # because our list is not threadsafe
return len(self._clientsConnected) return len(self._clientsConnected)
def getClientsConnected(self): def getClientsConnected(self):
"""!A list of all connected clients r"""!A list of all connected clients
with their IP address and last seen timestamp with their IP address and last seen timestamp
_clients[ThreadName] = {"address", "timestamp"} _clients[ThreadName] = {"address", "timestamp"}
@ -173,7 +173,7 @@ class TCPServer:
@property @property
def isRunning(self): def isRunning(self):
"""!Property of server running state""" r"""!Property of server running state"""
if self._server: if self._server:
return True return True
return False return False

View file

@ -1,6 +1,6 @@
#!/usr/bin/python #!/usr/bin/python
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
"""! r"""!
____ ____ ______ __ __ __ _____ ____ ____ ______ __ __ __ _____
/ __ )/ __ \/ ___/ | / /___ _/ /______/ /_ |__ / / __ )/ __ \/ ___/ | / /___ _/ /______/ /_ |__ /
/ __ / / / /\__ \| | /| / / __ `/ __/ ___/ __ \ /_ < / __ / / / /\__ \| | /| / / __ `/ __/ ___/ __ \ /_ <
@ -21,10 +21,10 @@ logging.debug("- %s loaded", __name__)
class Packet: class Packet:
"""!Class implementation of an BOSWatch packet""" r"""!Class implementation of an BOSWatch packet"""
def __init__(self, bwPacket=None): def __init__(self, bwPacket=None):
"""!Build a new BOSWatch packet or copy existing data in it r"""!Build a new BOSWatch packet or copy existing data in it
@param bwPacket: Existing data to copy""" @param bwPacket: Existing data to copy"""
if bwPacket is None: if bwPacket is None:
@ -35,18 +35,18 @@ class Packet:
self._packet = eval(str(bwPacket.strip())) self._packet = eval(str(bwPacket.strip()))
def __str__(self): def __str__(self):
"""!Return the intern _packet dict as string""" r"""!Return the intern _packet dict as string"""
return str(self._packet) return str(self._packet)
def set(self, fieldName, value): def set(self, fieldName, value):
"""!Set a field in the intern _packet dict r"""!Set a field in the intern _packet dict
@param fieldName: Name of the data to set @param fieldName: Name of the data to set
@param value: Value to set""" @param value: Value to set"""
self._packet[fieldName] = str(value) self._packet[fieldName] = str(value)
def get(self, fieldName): def get(self, fieldName):
"""!Returns the value from a single field. r"""!Returns the value from a single field.
If field not existing `None` is returned If field not existing `None` is returned
@param fieldName: Name of the field @param fieldName: Name of the field
@ -58,7 +58,7 @@ class Packet:
return None return None
def printInfo(self): def printInfo(self):
"""!Print a info message to the log on INFO level. r"""!Print a info message to the log on INFO level.
Contains the most useful info about this packet. Contains the most useful info about this packet.
@todo not complete yet - must be edit to print nice formatted messages on console @todo not complete yet - must be edit to print nice formatted messages on console
""" """

View file

@ -1,6 +1,6 @@
#!/usr/bin/python #!/usr/bin/python
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
"""! r"""!
____ ____ ______ __ __ __ _____ ____ ____ ______ __ __ __ _____
/ __ )/ __ \/ ___/ | / /___ _/ /______/ /_ |__ / / __ )/ __ \/ ___/ | / /___ _/ /______/ /_ |__ /
/ __ / / / /\__ \| | /| / / __ `/ __/ ___/ __ \ /_ < / __ / / / /\__ \| | /| / / __ `/ __/ ___/ __ \ /_ <
@ -21,7 +21,7 @@ logging.debug("- %s loaded", __name__)
class ProcessManager: class ProcessManager:
"""!class to manage a extern sub process""" r"""!class to manage a extern sub process"""
def __init__(self, process, textMode=False): def __init__(self, process, textMode=False):
logging.debug("create process instance %s - textMode: %s", process, textMode) logging.debug("create process instance %s - textMode: %s", process, textMode)
self._args = [] self._args = []
@ -33,7 +33,7 @@ class ProcessManager:
self._textMode = textMode self._textMode = textMode
def addArgument(self, arg): def addArgument(self, arg):
"""!add a new argument r"""!add a new argument
@param arg: argument to add as string""" @param arg: argument to add as string"""
logging.debug("add argument to process: %s -> %s", self._args[0], arg) logging.debug("add argument to process: %s -> %s", self._args[0], arg)
@ -41,11 +41,11 @@ class ProcessManager:
self._args.append(splitArg) self._args.append(splitArg)
def clearArguments(self): def clearArguments(self):
"""!clear all arguments""" r"""!clear all arguments"""
self._args = self._args[0:1] # kept first element (process name) self._args = self._args[0:1] # kept first element (process name)
def start(self): def start(self):
"""!start the new process r"""!start the new process
@return: True or False""" @return: True or False"""
logging.debug("start new process: %s %s", self._args[0], self._args[1:]) logging.debug("start new process: %s %s", self._args[0], self._args[1:])
@ -67,7 +67,7 @@ class ProcessManager:
return False return False
def stop(self): def stop(self):
"""!Stop the process by sending SIGTERM and wait for ending""" r"""!Stop the process by sending SIGTERM and wait for ending"""
logging.debug("stopping process: %s", self._args[0]) logging.debug("stopping process: %s", self._args[0])
if self.isRunning: if self.isRunning:
self._processHandle.terminate() self._processHandle.terminate()
@ -76,7 +76,7 @@ class ProcessManager:
logging.debug("process %s returned %d", self._args[0], self._processHandle.returncode) logging.debug("process %s returned %d", self._args[0], self._processHandle.returncode)
def readline(self): def readline(self):
"""!Read one line from stdout stream r"""!Read one line from stdout stream
@return singe line or None""" @return singe line or None"""
if self.isRunning and self._stdout is not None: if self.isRunning and self._stdout is not None:
@ -88,7 +88,7 @@ class ProcessManager:
return None return None
def skipLines(self, lineCount=1): def skipLines(self, lineCount=1):
"""!Skip given number of lines from the output r"""!Skip given number of lines from the output
@param lineCount: number of lines to skip @param lineCount: number of lines to skip
""" """
@ -98,7 +98,7 @@ class ProcessManager:
lineCount -= 1 lineCount -= 1
def skipLinesUntil(self, matchText): def skipLinesUntil(self, matchText):
"""!Skip lines from the output until the given string is in it r"""!Skip lines from the output until the given string is in it
@param matchText: string to search for in output @param matchText: string to search for in output
""" """
@ -109,30 +109,30 @@ class ProcessManager:
pass pass
def setStdin(self, stdin): def setStdin(self, stdin):
"""!Set the stdin stream instance""" r"""!Set the stdin stream instance"""
self._stdin = stdin self._stdin = stdin
def setStdout(self, stdout): def setStdout(self, stdout):
"""!Set the stdout stream instance""" r"""!Set the stdout stream instance"""
self._stdout = stdout self._stdout = stdout
def setStderr(self, stderr): def setStderr(self, stderr):
"""!Set the stderr stream instance""" r"""!Set the stderr stream instance"""
self._stderr = stderr self._stderr = stderr
@property @property
def stdout(self): def stdout(self):
"""!Property to get the stdout stream""" r"""!Property to get the stdout stream"""
return self._processHandle.stdout return self._processHandle.stdout
@property @property
def stderr(self): def stderr(self):
"""!Property to get the stderr stream""" r"""!Property to get the stderr stream"""
return self._processHandle.stderr return self._processHandle.stderr
@property @property
def isRunning(self): def isRunning(self):
"""!Property to get process running state r"""!Property to get process running state
@return True or False""" @return True or False"""
if self._processHandle: if self._processHandle:

View file

@ -1,6 +1,6 @@
#!/usr/bin/python #!/usr/bin/python
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
"""! r"""!
____ ____ ______ __ __ __ _____ ____ ____ ______ __ __ __ _____
/ __ )/ __ \/ ___/ | / /___ _/ /______/ /_ |__ / / __ )/ __ \/ ___/ | / /___ _/ /______/ /_ |__ /
/ __ / / / /\__ \| | /| / / __ `/ __/ ___/ __ \ /_ < / __ / / / /\__ \| | /| / / __ `/ __/ ___/ __ \ /_ <
@ -21,9 +21,9 @@ logging.debug("- %s loaded", __name__)
class Route: class Route:
"""!Class for single routing points""" r"""!Class for single routing points"""
def __init__(self, name, callback, statsCallback=None, cleanupCallback=None): def __init__(self, name, callback, statsCallback=None, cleanupCallback=None):
"""!Create a instance of an route point r"""!Create a instance of an route point
@param name: name of the route point @param name: name of the route point
@param callback: instance of the callback function @param callback: instance of the callback function

View file

@ -1,6 +1,6 @@
#!/usr/bin/python #!/usr/bin/python
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
"""! r"""!
____ ____ ______ __ __ __ _____ ____ ____ ______ __ __ __ _____
/ __ )/ __ \/ ___/ | / /___ _/ /______/ /_ |__ / / __ )/ __ \/ ___/ | / /___ _/ /______/ /_ |__ /
/ __ / / / /\__ \| | /| / / __ `/ __/ ___/ __ \ /_ < / __ / / / /\__ \| | /| / / __ `/ __/ ___/ __ \ /_ <
@ -22,9 +22,9 @@ logging.debug("- %s loaded", __name__)
class Router: class Router:
"""!Class for the Router""" r"""!Class for the Router"""
def __init__(self, name): def __init__(self, name):
"""!Create a new router r"""!Create a new router
@param name: name of the router""" @param name: name of the router"""
self.name = name self.name = name
@ -40,7 +40,7 @@ class Router:
logging.debug("[%s] add new router", self.name) logging.debug("[%s] add new router", self.name)
def addRoute(self, route): def addRoute(self, route):
"""!Adds a route point to the router r"""!Adds a route point to the router
@param route: instance of the Route class @param route: instance of the Route class
""" """
@ -48,7 +48,7 @@ class Router:
self.routeList.append(route) self.routeList.append(route)
def runRouter(self, bwPacket): def runRouter(self, bwPacket):
"""!Run the router r"""!Run the router
@param bwPacket: instance of Packet class @param bwPacket: instance of Packet class
@return a instance of Packet class @return a instance of Packet class
@ -79,7 +79,7 @@ class Router:
return bwPacket return bwPacket
def _getStatistics(self): def _getStatistics(self):
"""!Returns statistical information's from last router run r"""!Returns statistical information's from last router run
@return Statistics as pyton dict""" @return Statistics as pyton dict"""
stats = {"type": "router", stats = {"type": "router",

View file

@ -1,6 +1,6 @@
#!/usr/bin/python #!/usr/bin/python
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
"""! r"""!
____ ____ ______ __ __ __ _____ ____ ____ ______ __ __ __ _____
/ __ )/ __ \/ ___/ | / /___ _/ /______/ /_ |__ / / __ )/ __ \/ ___/ | / /___ _/ /______/ /_ |__ /
/ __ / / / /\__ \| | /| / / __ `/ __/ ___/ __ \ /_ < / __ / / / /\__ \| | /| / / __ `/ __/ ___/ __ \ /_ <
@ -27,16 +27,16 @@ logging.debug("- %s loaded", __name__)
class RouterManager: class RouterManager:
"""!Class to manage all routers""" r"""!Class to manage all routers"""
def __init__(self): def __init__(self):
"""!Create new router""" r"""!Create new router"""
self._routerDict = {} self._routerDict = {}
self._startTime = int(time.time()) self._startTime = int(time.time())
# if there is an error, router list would be empty (see tmp variable) # if there is an error, router list would be empty (see tmp variable)
def buildRouters(self, config): def buildRouters(self, config):
"""!Initialize Routers from given config file r"""!Initialize Routers from given config file
@param config: instance of ConfigYaml class @param config: instance of ConfigYaml class
@return True or False""" @return True or False"""
@ -103,7 +103,7 @@ class RouterManager:
return True return True
def runRouters(self, routerRunList, bwPacket): def runRouters(self, routerRunList, bwPacket):
"""!Run given Routers r"""!Run given Routers
@param routerRunList: string or list of router names in string form @param routerRunList: string or list of router names in string form
@param bwPacket: instance of Packet class""" @param bwPacket: instance of Packet class"""
@ -119,7 +119,7 @@ class RouterManager:
self._saveStats() # write stats to stats file self._saveStats() # write stats to stats file
def cleanup(self): def cleanup(self):
"""!Run cleanup routines for all loaded route points""" r"""!Run cleanup routines for all loaded route points"""
for name, routerObject in self._routerDict.items(): for name, routerObject in self._routerDict.items():
logging.debug("Start cleanup for %s", name) logging.debug("Start cleanup for %s", name)
for routePoint in routerObject.routeList: for routePoint in routerObject.routeList:
@ -127,7 +127,7 @@ class RouterManager:
routePoint.cleanup() routePoint.cleanup()
def _showRouterRoute(self): def _showRouterRoute(self):
"""!Show the routes of all routers""" r"""!Show the routes of all routers"""
for name, routerObject in self._routerDict.items(): for name, routerObject in self._routerDict.items():
logging.debug("Route for %s", name) logging.debug("Route for %s", name)
counter = 0 counter = 0
@ -136,7 +136,7 @@ class RouterManager:
logging.debug(" %d. %s", counter, routePoint.name) logging.debug(" %d. %s", counter, routePoint.name)
def _saveStats(self): def _saveStats(self):
"""!Save current statistics to file""" r"""!Save current statistics to file"""
lines = [] lines = []
for name, routerObject in self._routerDict.items(): for name, routerObject in self._routerDict.items():
lines.append("[" + name + "]") lines.append("[" + name + "]")

View file

@ -1,6 +1,6 @@
#!/usr/bin/python #!/usr/bin/python
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
"""! r"""!
____ ____ ______ __ __ __ _____ ____ ____ ______ __ __ __ _____
/ __ )/ __ \/ ___/ | / /___ _/ /______/ /_ |__ / / __ )/ __ \/ ___/ | / /___ _/ /______/ /_ |__ /
/ __ / / / /\__ \| | /| / / __ `/ __/ ___/ __ \ /_ < / __ / / / /\__ \| | /| / / __ `/ __/ ___/ __ \ /_ <
@ -24,7 +24,7 @@ logging.debug("- %s loaded", __name__)
class RepeatedTimer: class RepeatedTimer:
def __init__(self, interval, targetFunction, *args, **kwargs): def __init__(self, interval, targetFunction, *args, **kwargs):
"""!Create a new instance of the RepeatedTimer r"""!Create a new instance of the RepeatedTimer
@param interval: interval in sec. to recall target function @param interval: interval in sec. to recall target function
@param targetFunction: function to call on timer event @param targetFunction: function to call on timer event
@ -43,7 +43,7 @@ class RepeatedTimer:
self._thread = None self._thread = None
def start(self): def start(self):
"""!Start a new timer worker thread r"""!Start a new timer worker thread
@return True or False""" @return True or False"""
if self._thread is None: if self._thread is None:
@ -58,7 +58,7 @@ class RepeatedTimer:
return True return True
def stop(self): def stop(self):
"""!Stop the timer worker thread r"""!Stop the timer worker thread
@return True or False""" @return True or False"""
if self._thread is not None: if self._thread is not None:
@ -71,7 +71,7 @@ class RepeatedTimer:
return True return True
def _target(self): def _target(self):
"""!Runs the target function with his arguments in own thread""" r"""!Runs the target function with his arguments in own thread"""
self._start = time.time() self._start = time.time()
while not self._event.wait(self.restTime): while not self._event.wait(self.restTime):
logging.debug("work") logging.debug("work")
@ -96,12 +96,12 @@ class RepeatedTimer:
@property @property
def isRunning(self): def isRunning(self):
"""!Property for repeatedTimer running state""" r"""!Property for repeatedTimer running state"""
if self._thread: if self._thread:
return True return True
return False return False
@property @property
def restTime(self): def restTime(self):
"""!Property to get remaining time till next call""" r"""!Property to get remaining time till next call"""
return self._interval - ((time.time() - self._start) % self._interval) return self._interval - ((time.time() - self._start) % self._interval)

View file

@ -1,6 +1,6 @@
#!/usr/bin/python #!/usr/bin/python
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
"""! r"""!
____ ____ ______ __ __ __ _____ ____ ____ ______ __ __ __ _____
/ __ )/ __ \/ ___/ | / /___ _/ /______/ /_ |__ / / __ )/ __ \/ ___/ | / /___ _/ /______/ /_ |__ /
/ __ / / / /\__ \| | /| / / __ `/ __/ ___/ __ \ /_ < / __ / / / /\__ \| | /| / / __ `/ __/ ___/ __ \ /_ <
@ -23,22 +23,22 @@ logging.debug("- %s loaded", __name__)
def logoToLog(): def logoToLog():
"""!Prints the BOSWatch logo to the log at debug level r"""!Prints the BOSWatch logo to the log at debug level
@return True or False on error""" @return True or False on error"""
logging.debug(" ____ ____ ______ __ __ __ _____ ") logging.debug(r" ____ ____ ______ __ __ __ _____ ")
logging.debug(" / __ )/ __ \/ ___/ | / /___ _/ /______/ /_ |__ / ") logging.debug(r" / __ )/ __ \/ ___/ | / /___ _/ /______/ /_ |__ / ")
logging.debug(" / __ / / / /\__ \| | /| / / __ `/ __/ ___/ __ \ /_ < ") logging.debug(r" / __ / / / /\__ \| | /| / / __ `/ __/ ___/ __ \ /_ < ")
logging.debug(" / /_/ / /_/ /___/ /| |/ |/ / /_/ / /_/ /__/ / / / ___/ / ") logging.debug(r" / /_/ / /_/ /___/ /| |/ |/ / /_/ / /_/ /__/ / / / ___/ / ")
logging.debug("/_____/\____//____/ |__/|__/\__,_/\__/\___/_/ /_/ /____/ ") logging.debug(r"/_____/\____//____/ |__/|__/\__,_/\__/\___/_/ /_/ /____/ ")
logging.debug(" German BOS Information Script ") logging.debug(r" German BOS Information Script ")
logging.debug(" by Bastian Schroll ") logging.debug(r" by Bastian Schroll ")
logging.debug("") logging.debug(r"")
return True return True
def infoToLog(): def infoToLog():
"""!Prints the BOSWatch and OS information to log at debug level r"""!Prints the BOSWatch and OS information to log at debug level
@return True or False on error""" @return True or False on error"""
logging.debug("BOSWatch and environment information") logging.debug("BOSWatch and environment information")

View file

@ -1,6 +1,6 @@
#!/usr/bin/python #!/usr/bin/python
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
"""! r"""!
____ ____ ______ __ __ __ _____ ____ ____ ______ __ __ __ _____
/ __ )/ __ \/ ___/ | / /___ _/ /______/ /_ |__ / / __ )/ __ \/ ___/ | / /___ _/ /______/ /_ |__ /
/ __ / / / /\__ \| | /| / / __ `/ __/ ___/ __ \ /_ < / __ / / / /\__ \| | /| / / __ `/ __/ ___/ __ \ /_ <
@ -21,7 +21,7 @@ logging.debug("- %s loaded", __name__)
def addClientDataToPacket(bwPacket, config): def addClientDataToPacket(bwPacket, config):
"""!Add the client information to the decoded data r"""!Add the client information to the decoded data
This function adds the following data to the bwPacket: This function adds the following data to the bwPacket:
- clientName - clientName
@ -40,7 +40,7 @@ def addClientDataToPacket(bwPacket, config):
def addServerDataToPacket(bwPacket, config): def addServerDataToPacket(bwPacket, config):
"""!Add the server information to the decoded data r"""!Add the server information to the decoded data
This function adds the following data to the bwPacket: This function adds the following data to the bwPacket:
- serverName - serverName

View file

@ -1,6 +1,6 @@
#!/usr/bin/python #!/usr/bin/python
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
"""! r"""!
____ ____ ______ __ __ __ _____ ____ ____ ______ __ __ __ _____
/ __ )/ __ \/ ___/ | / /___ _/ /______/ /_ |__ / / __ )/ __ \/ ___/ | / /___ _/ /______/ /_ |__ /
/ __ / / / /\__ \| | /| / / __ `/ __/ ___/ __ \ /_ < / __ / / / /\__ \| | /| / / __ `/ __/ ___/ __ \ /_ <
@ -34,7 +34,7 @@ def fileExist(filePath):
def makeDirIfNotExist(dirPath): def makeDirIfNotExist(dirPath):
"""!Checks if an directory is existing and create it if not r"""!Checks if an directory is existing and create it if not
@param dirPath: Path of the directory @param dirPath: Path of the directory
@return Path of the directory or False""" @return Path of the directory or False"""

View file

@ -1,6 +1,6 @@
#!/usr/bin/python #!/usr/bin/python
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
"""! r"""!
____ ____ ______ __ __ __ _____ ____ ____ ______ __ __ __ _____
/ __ )/ __ \/ ___/ | / /___ _/ /______/ /_ |__ / / __ )/ __ \/ ___/ | / /___ _/ /______/ /_ |__ /
/ __ / / / /\__ \| | /| / / __ `/ __/ ___/ __ \ /_ < / __ / / / /\__ \| | /| / / __ `/ __/ ___/ __ \ /_ <

View file

@ -1,6 +1,6 @@
#!/usr/bin/python #!/usr/bin/python
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
"""! r"""!
____ ____ ______ __ __ __ _____ ____ ____ ______ __ __ __ _____
/ __ )/ __ \/ ___/ | / /___ _/ /______/ /_ |__ / / __ )/ __ \/ ___/ | / /___ _/ /______/ /_ |__ /
/ __ / / / /\__ \| | /| / / __ `/ __/ ___/ __ \ /_ < / __ / / / /\__ \| | /| / / __ `/ __/ ___/ __ \ /_ <
@ -25,7 +25,7 @@ _additionalWildcards = {}
def registerWildcard(wildcard, bwPacketField): def registerWildcard(wildcard, bwPacketField):
"""!Register a new additional wildcard r"""!Register a new additional wildcard
@param wildcard: New wildcard string with format: '{WILDCARD}' @param wildcard: New wildcard string with format: '{WILDCARD}'
@param bwPacketField: Field of the bwPacket which is used for wildcard replacement""" @param bwPacketField: Field of the bwPacket which is used for wildcard replacement"""
@ -37,7 +37,7 @@ def registerWildcard(wildcard, bwPacketField):
def replaceWildcards(message, bwPacket): def replaceWildcards(message, bwPacket):
"""!Replace the wildcards in a given message r"""!Replace the wildcards in a given message
@param message: Message in which wildcards should be replaced @param message: Message in which wildcards should be replaced
@param bwPacket: bwPacket instance with the replacement information @param bwPacket: bwPacket instance with the replacement information

View file

@ -1,6 +1,6 @@
#!/usr/bin/python #!/usr/bin/python
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
""" r"""!
____ ____ ______ __ __ __ _____ ____ ____ ______ __ __ __ _____
/ __ )/ __ \/ ___/ | / /___ _/ /______/ /_ |__ / / __ )/ __ \/ ___/ | / /___ _/ /______/ /_ |__ /
/ __ / / / /\__ \| | /| / / __ `/ __/ ___/ __ \ /_ < / __ / / / /\__ \| | /| / / __ `/ __/ ___/ __ \ /_ <

View file

@ -1,6 +1,6 @@
#!/usr/bin/python #!/usr/bin/python
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
""" r"""!
____ ____ ______ __ __ __ _____ ____ ____ ______ __ __ __ _____
/ __ )/ __ \/ ___/ | / /___ _/ /______/ /_ |__ / / __ )/ __ \/ ___/ | / /___ _/ /______/ /_ |__ /
/ __ / / / /\__ \| | /| / / __ `/ __/ ___/ __ \ /_ < / __ / / / /\__ \| | /| / / __ `/ __/ ___/ __ \ /_ <

View file

@ -1,6 +1,6 @@
#!/usr/bin/python #!/usr/bin/python
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
"""! r"""!
____ ____ ______ __ __ __ _____ ____ ____ ______ __ __ __ _____
/ __ )/ __ \/ ___/ | / /___ _/ /______/ /_ |__ / / __ )/ __ \/ ___/ | / /___ _/ /______/ /_ |__ /
/ __ / / / /\__ \| | /| / / __ `/ __/ ___/ __ \ /_ < / __ / / / /\__ \| | /| / / __ `/ __/ ___/ __ \ /_ <
@ -26,19 +26,19 @@ logging.debug("- %s loaded", __name__)
class BoswatchModule(ModuleBase): class BoswatchModule(ModuleBase):
"""!Adds descriptions to bwPackets""" r"""!Adds descriptions to bwPackets"""
def __init__(self, config): def __init__(self, config):
"""!Do not change anything here!""" r"""!Do not change anything here!"""
super().__init__(__name__, config) # you can access the config class on 'self.config' super().__init__(__name__, config) # you can access the config class on 'self.config'
def onLoad(self): def onLoad(self):
"""!Called by import of the plugin""" r"""!Called by import of the plugin"""
for descriptor in self.config: for descriptor in self.config:
if descriptor.get("wildcard", default=None): if descriptor.get("wildcard", default=None):
self.registerWildcard(descriptor.get("wildcard"), descriptor.get("descrField")) self.registerWildcard(descriptor.get("wildcard"), descriptor.get("descrField"))
def doWork(self, bwPacket): def doWork(self, bwPacket):
"""!start an run of the module. r"""!start an run of the module.
@param bwPacket: A BOSWatch packet instance""" @param bwPacket: A BOSWatch packet instance"""
for descriptor in self.config: for descriptor in self.config:
@ -54,5 +54,5 @@ class BoswatchModule(ModuleBase):
return bwPacket return bwPacket
def onUnload(self): def onUnload(self):
"""!Called by destruction of the plugin""" r"""!Called by destruction of the plugin"""
pass pass

View file

@ -1,6 +1,6 @@
#!/usr/bin/python #!/usr/bin/python
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
"""! r"""!
____ ____ ______ __ __ __ _____ ____ ____ ______ __ __ __ _____
/ __ )/ __ \/ ___/ | / /___ _/ /______/ /_ |__ / / __ )/ __ \/ ___/ | / /___ _/ /______/ /_ |__ /
/ __ / / / /\__ \| | /| / / __ `/ __/ ___/ __ \ /_ < / __ / / / /\__ \| | /| / / __ `/ __/ ___/ __ \ /_ <
@ -26,21 +26,21 @@ logging.debug("- %s loaded", __name__)
class BoswatchModule(ModuleBase): class BoswatchModule(ModuleBase):
"""!Description of the Module""" r"""!Description of the Module"""
def __init__(self, config): def __init__(self, config):
"""!Do not change anything here!""" r"""!Do not change anything here!"""
super().__init__(__name__, config) # you can access the config class on 'self.config' super().__init__(__name__, config) # you can access the config class on 'self.config'
self._filterLists = {} self._filterLists = {}
logging.debug("Configured ignoreTime: %d", self.config.get("ignoreTime", default=10)) logging.debug("Configured ignoreTime: %d", self.config.get("ignoreTime", default=10))
logging.debug("Configured maxEntry: %d", self.config.get("maxEntry", default=10)) logging.debug("Configured maxEntry: %d", self.config.get("maxEntry", default=10))
def onLoad(self): def onLoad(self):
"""!Called by import of the plugin r"""!Called by import of the plugin
Remove if not implemented""" Remove if not implemented"""
pass pass
def doWork(self, bwPacket): def doWork(self, bwPacket):
"""!start an run of the module. r"""!start an run of the module.
@param bwPacket: A BOSWatch packet instance""" @param bwPacket: A BOSWatch packet instance"""
if bwPacket.get("mode") == "fms": if bwPacket.get("mode") == "fms":
@ -62,7 +62,7 @@ class BoswatchModule(ModuleBase):
return self._check(bwPacket, filterFields) return self._check(bwPacket, filterFields)
def onUnload(self): def onUnload(self):
"""!Called by destruction of the plugin r"""!Called by destruction of the plugin
Remove if not implemented""" Remove if not implemented"""
pass pass

View file

@ -1,6 +1,6 @@
#!/usr/bin/python #!/usr/bin/python
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
"""! r"""!
____ ____ ______ __ __ __ _____ ____ ____ ______ __ __ __ _____
/ __ )/ __ \/ ___/ | / /___ _/ /______/ /_ |__ / / __ )/ __ \/ ___/ | / /___ _/ /______/ /_ |__ /
/ __ / / / /\__ \| | /| / / __ `/ __/ ___/ __ \ /_ < / __ / / / /\__ \| | /| / / __ `/ __/ ___/ __ \ /_ <
@ -26,17 +26,17 @@ logging.debug("- %s loaded", __name__)
class BoswatchModule(ModuleBase): class BoswatchModule(ModuleBase):
"""!Filter of specific bwPacket mode""" r"""!Filter of specific bwPacket mode"""
def __init__(self, config): def __init__(self, config):
"""!Do not change anything here!""" r"""!Do not change anything here!"""
super().__init__(__name__, config) # you can access the config class on 'self.config' super().__init__(__name__, config) # you can access the config class on 'self.config'
def onLoad(self): def onLoad(self):
"""!Called by import of the plugin""" r"""!Called by import of the plugin"""
pass pass
def doWork(self, bwPacket): def doWork(self, bwPacket):
"""!start an run of the module. r"""!start an run of the module.
@param bwPacket: A BOSWatch packet instance""" @param bwPacket: A BOSWatch packet instance"""
@ -48,5 +48,5 @@ class BoswatchModule(ModuleBase):
return False return False
def onUnload(self): def onUnload(self):
"""!Called by destruction of the plugin""" r"""!Called by destruction of the plugin"""
pass pass

View file

@ -1,6 +1,6 @@
#!/usr/bin/python #!/usr/bin/python
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
"""! r"""!
____ ____ ______ __ __ __ _____ ____ ____ ______ __ __ __ _____
/ __ )/ __ \/ ___/ | / /___ _/ /______/ /_ |__ / / __ )/ __ \/ ___/ | / /___ _/ /______/ /_ |__ /
/ __ / / / /\__ \| | /| / / __ `/ __/ ___/ __ \ /_ < / __ / / / /\__ \| | /| / / __ `/ __/ ___/ __ \ /_ <
@ -26,17 +26,17 @@ logging.debug("- %s loaded", __name__)
class BoswatchModule(ModuleBase): class BoswatchModule(ModuleBase):
"""!Regex based filter mechanism""" r"""!Regex based filter mechanism"""
def __init__(self, config): def __init__(self, config):
"""!Do not change anything here!""" r"""!Do not change anything here!"""
super().__init__(__name__, config) # you can access the config class on 'self.config' super().__init__(__name__, config) # you can access the config class on 'self.config'
def onLoad(self): def onLoad(self):
"""!Called by import of the plugin""" r"""!Called by import of the plugin"""
pass pass
def doWork(self, bwPacket): def doWork(self, bwPacket):
"""!start an run of the module. r"""!start an run of the module.
@param bwPacket: A BOSWatch packet instance""" @param bwPacket: A BOSWatch packet instance"""
for regexFilter in self.config: for regexFilter in self.config:
@ -61,5 +61,5 @@ class BoswatchModule(ModuleBase):
return False # False -> Router will stop further processing return False # False -> Router will stop further processing
def onUnload(self): def onUnload(self):
"""!Called by destruction of the plugin""" r"""!Called by destruction of the plugin"""
pass pass

View file

@ -1,6 +1,6 @@
#!/usr/bin/python #!/usr/bin/python
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
"""! r"""!
____ ____ ______ __ __ __ _____ ____ ____ ______ __ __ __ _____
/ __ )/ __ \/ ___/ | / /___ _/ /______/ /_ |__ / / __ )/ __ \/ ___/ | / /___ _/ /______/ /_ |__ /
/ __ / / / /\__ \| | /| / / __ `/ __/ ___/ __ \ /_ < / __ / / / /\__ \| | /| / / __ `/ __/ ___/ __ \ /_ <
@ -27,13 +27,13 @@ logging.debug("- %s loaded", __name__)
class BoswatchModule(ModuleBase): class BoswatchModule(ModuleBase):
"""!Description of the Module""" r"""!Description of the Module"""
def __init__(self, config): def __init__(self, config):
"""!Do not change anything here!""" r"""!Do not change anything here!"""
super().__init__(__name__, config) # you can access the config class on 'self.config' super().__init__(__name__, config) # you can access the config class on 'self.config'
def doWork(self, bwPacket): def doWork(self, bwPacket):
"""!start an run of the module. r"""!start an run of the module.
@param bwPacket: A BOSWatch packet instance""" @param bwPacket: A BOSWatch packet instance"""
if bwPacket.get("mode") == "pocsag": if bwPacket.get("mode") == "pocsag":
@ -42,7 +42,7 @@ class BoswatchModule(ModuleBase):
return bwPacket return bwPacket
def geocode(self, bwPacket): def geocode(self, bwPacket):
"""!find address in message and get latitude and longitude r"""!find address in message and get latitude and longitude
@param bwPacket: A BOSWatch packet instance""" @param bwPacket: A BOSWatch packet instance"""
try: try:

View file

@ -1,6 +1,6 @@
#!/usr/bin/python #!/usr/bin/python
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
"""! r"""!
____ ____ ______ __ __ __ _____ ____ ____ ______ __ __ __ _____
/ __ )/ __ \/ ___/ | / /___ _/ /______/ /_ |__ / / __ )/ __ \/ ___/ | / /___ _/ /______/ /_ |__ /
/ __ / / / /\__ \| | /| / / __ `/ __/ ___/ __ \ /_ < / __ / / / /\__ \| | /| / / __ `/ __/ ___/ __ \ /_ <
@ -24,12 +24,12 @@ logging.debug("- %s loaded", __name__)
class ModuleBase(ABC): class ModuleBase(ABC):
"""!Main module class""" r"""!Main module class"""
_modulesActive = [] _modulesActive = []
def __init__(self, moduleName, config): def __init__(self, moduleName, config):
"""!init preload some needed locals and then call onLoad() directly""" r"""!init preload some needed locals and then call onLoad() directly"""
self._moduleName = moduleName self._moduleName = moduleName
self.config = config self.config = config
self._modulesActive.append(self) self._modulesActive.append(self)
@ -46,13 +46,13 @@ class ModuleBase(ABC):
self.onLoad() self.onLoad()
def _cleanup(self): def _cleanup(self):
"""!Cleanup routine calls onUnload() directly""" r"""!Cleanup routine calls onUnload() directly"""
logging.debug("[%s] onUnload()", self._moduleName) logging.debug("[%s] onUnload()", self._moduleName)
self._modulesActive.remove(self) self._modulesActive.remove(self)
self.onUnload() self.onUnload()
def _run(self, bwPacket): def _run(self, bwPacket):
"""!start an run of the module. r"""!start an run of the module.
@param bwPacket: A BOSWatch packet instance @param bwPacket: A BOSWatch packet instance
@return bwPacket or False""" @return bwPacket or False"""
@ -75,7 +75,7 @@ class ModuleBase(ABC):
return bwPacket return bwPacket
def _getStatistics(self): def _getStatistics(self):
"""!Returns statistical information's from last module run r"""!Returns statistical information's from last module run
@return Statistics as pyton dict""" @return Statistics as pyton dict"""
stats = {"type": "module", stats = {"type": "module",
@ -86,25 +86,25 @@ class ModuleBase(ABC):
return stats return stats
def onLoad(self): def onLoad(self):
"""!Called by import of the module r"""!Called by import of the module
can be inherited""" can be inherited"""
pass pass
def doWork(self, bwPacket): def doWork(self, bwPacket):
"""!Called module run r"""!Called module run
can be inherited can be inherited
@param bwPacket: bwPacket instance""" @param bwPacket: bwPacket instance"""
logging.warning("no functionality in module %s", self._moduleName) logging.warning("no functionality in module %s", self._moduleName)
def onUnload(self): def onUnload(self):
"""!Called on shutdown of boswatch r"""!Called on shutdown of boswatch
can be inherited""" can be inherited"""
pass pass
@staticmethod @staticmethod
def registerWildcard(newWildcard, bwPacketField): def registerWildcard(newWildcard, bwPacketField):
"""!Register a new wildcard r"""!Register a new wildcard
@param newWildcard: wildcard where parser searching for @param newWildcard: wildcard where parser searching for
@param bwPacketField: field from bwPacket where holds replacement data""" @param bwPacketField: field from bwPacket where holds replacement data"""

View file

@ -1,6 +1,6 @@
#!/usr/bin/python #!/usr/bin/python
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
"""! r"""!
____ ____ ______ __ __ __ _____ ____ ____ ______ __ __ __ _____
/ __ )/ __ \/ ___/ | / /___ _/ /______/ /_ |__ / / __ )/ __ \/ ___/ | / /___ _/ /______/ /_ |__ /
/ __ / / / /\__ \| | /| / / __ `/ __/ ___/ __ \ /_ < / __ / / / /\__ \| | /| / / __ `/ __/ ___/ __ \ /_ <
@ -26,18 +26,18 @@ logging.debug("- %s loaded", __name__)
class BoswatchModule(ModuleBase): class BoswatchModule(ModuleBase):
"""!Description of the Module""" r"""!Description of the Module"""
def __init__(self, config): def __init__(self, config):
"""!Do not change anything here!""" r"""!Do not change anything here!"""
super().__init__(__name__, config) # you can access the config class on 'self.config' super().__init__(__name__, config) # you can access the config class on 'self.config'
def onLoad(self): def onLoad(self):
"""!Called by import of the plugin r"""!Called by import of the plugin
Remove if not implemented""" Remove if not implemented"""
pass pass
def doWork(self, bwPacket): def doWork(self, bwPacket):
"""!start an run of the module. r"""!start an run of the module.
@param bwPacket: A BOSWatch packet instance""" @param bwPacket: A BOSWatch packet instance"""
if bwPacket.get("mode") == "fms": if bwPacket.get("mode") == "fms":
@ -52,6 +52,6 @@ class BoswatchModule(ModuleBase):
return bwPacket return bwPacket
def onUnload(self): def onUnload(self):
"""!Called by destruction of the plugin r"""!Called by destruction of the plugin
Remove if not implemented""" Remove if not implemented"""
pass pass

View file

@ -1,6 +1,6 @@
#!/usr/bin/python #!/usr/bin/python
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
"""! r"""!
____ ____ ______ __ __ __ _____ ____ ____ ______ __ __ __ _____
/ __ )/ __ \/ ___/ | / /___ _/ /______/ /_ |__ / / __ )/ __ \/ ___/ | / /___ _/ /______/ /_ |__ /
/ __ / / / /\__ \| | /| / / __ `/ __/ ___/ __ \ /_ < / __ / / / /\__ \| | /| / / __ `/ __/ ___/ __ \ /_ <
@ -28,13 +28,13 @@ logging.debug("- %s loaded", __name__)
class BoswatchPlugin(PluginBase): class BoswatchPlugin(PluginBase):
"""!Description of the Plugin""" r"""!Description of the Plugin"""
def __init__(self, config): def __init__(self, config):
"""!Do not change anything here!""" r"""!Do not change anything here!"""
super().__init__(__name__, config) # you can access the config class on 'self.config' super().__init__(__name__, config) # you can access the config class on 'self.config'
def fms(self, bwPacket): def fms(self, bwPacket):
"""!Called on FMS alarm r"""!Called on FMS alarm
@param bwPacket: bwPacket instance @param bwPacket: bwPacket instance
Remove if not implemented""" Remove if not implemented"""
@ -52,7 +52,7 @@ class BoswatchPlugin(PluginBase):
self._makeRequests(apipath, apicall) self._makeRequests(apipath, apicall)
def pocsag(self, bwPacket): def pocsag(self, bwPacket):
"""!Called on POCSAG alarm r"""!Called on POCSAG alarm
@param bwPacket: bwPacket instance @param bwPacket: bwPacket instance
Remove if not implemented""" Remove if not implemented"""
@ -68,7 +68,7 @@ class BoswatchPlugin(PluginBase):
self._makeRequests(apipath, apicall) self._makeRequests(apipath, apicall)
def zvei(self, bwPacket): def zvei(self, bwPacket):
"""!Called on ZVEI alarm r"""!Called on ZVEI alarm
@param bwPacket: bwPacket instance @param bwPacket: bwPacket instance
Remove if not implemented""" Remove if not implemented"""
@ -84,7 +84,7 @@ class BoswatchPlugin(PluginBase):
self._makeRequests(apipath, apicall) self._makeRequests(apipath, apicall)
def msg(self, bwPacket): def msg(self, bwPacket):
"""!Called on MSG packet r"""!Called on MSG packet
@param bwPacket: bwPacket instance @param bwPacket: bwPacket instance
Remove if not implemented""" Remove if not implemented"""

View file

@ -1,6 +1,6 @@
#!/usr/bin/python #!/usr/bin/python
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
"""! r"""!
____ ____ ______ __ __ __ _____ ____ ____ ______ __ __ __ _____
/ __ )/ __ \/ ___/ | / /___ _/ /______/ /_ |__ / / __ )/ __ \/ ___/ | / /___ _/ /______/ /_ |__ /
/ __ / / / /\__ \| | /| / / __ `/ __/ ___/ __ \ /_ < / __ / / / /\__ \| | /| / / __ `/ __/ ___/ __ \ /_ <
@ -27,13 +27,13 @@ logging.debug("- %s loaded", __name__)
class BoswatchPlugin(PluginBase): class BoswatchPlugin(PluginBase):
"""!Description of the Plugin""" r"""!Description of the Plugin"""
def __init__(self, config): def __init__(self, config):
"""!Do not change anything here!""" r"""!Do not change anything here!"""
super().__init__(__name__, config) # you can access the config class on 'self.config' super().__init__(__name__, config) # you can access the config class on 'self.config'
def fms(self, bwPacket): def fms(self, bwPacket):
"""!Called on FMS alarm r"""!Called on FMS alarm
@param bwPacket: bwPacket instance @param bwPacket: bwPacket instance
Remove if not implemented""" Remove if not implemented"""
@ -41,7 +41,7 @@ class BoswatchPlugin(PluginBase):
self._makeRequests(urls) self._makeRequests(urls)
def pocsag(self, bwPacket): def pocsag(self, bwPacket):
"""!Called on POCSAG alarm r"""!Called on POCSAG alarm
@param bwPacket: bwPacket instance @param bwPacket: bwPacket instance
Remove if not implemented""" Remove if not implemented"""
@ -49,7 +49,7 @@ class BoswatchPlugin(PluginBase):
self._makeRequests(urls) self._makeRequests(urls)
def zvei(self, bwPacket): def zvei(self, bwPacket):
"""!Called on ZVEI alarm r"""!Called on ZVEI alarm
@param bwPacket: bwPacket instance @param bwPacket: bwPacket instance
Remove if not implemented""" Remove if not implemented"""
@ -57,7 +57,7 @@ class BoswatchPlugin(PluginBase):
self._makeRequests(urls) self._makeRequests(urls)
def msg(self, bwPacket): def msg(self, bwPacket):
"""!Called on MSG packet r"""!Called on MSG packet
@param bwPacket: bwPacket instance @param bwPacket: bwPacket instance
Remove if not implemented""" Remove if not implemented"""

View file

@ -1,6 +1,6 @@
#!/usr/bin/python #!/usr/bin/python
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
"""! r"""!
____ ____ ______ __ __ __ _____ ____ ____ ______ __ __ __ _____
/ __ )/ __ \/ ___/ | / /___ _/ /______/ /_ |__ / / __ )/ __ \/ ___/ | / /___ _/ /______/ /_ |__ /
/ __ / / / /\__ \| | /| / / __ `/ __/ ___/ __ \ /_ < / __ / / / /\__ \| | /| / / __ `/ __/ ___/ __ \ /_ <
@ -28,14 +28,14 @@ logging.debug("- %s loaded", __name__)
class BoswatchPlugin(PluginBase): class BoswatchPlugin(PluginBase):
"""!Description of the Plugin""" r"""!Description of the Plugin"""
def __init__(self, config): def __init__(self, config):
"""!Do not change anything here!""" r"""!Do not change anything here!"""
super().__init__(__name__, config) # you can access the config class on 'self.config' super().__init__(__name__, config) # you can access the config class on 'self.config'
def onLoad(self): def onLoad(self):
"""!Called by import of the plugin r"""!Called by import of the plugin
Remove if not implemented""" Remove if not implemented"""
self.sqlInserts = { self.sqlInserts = {
"pocsag": "INSERT INTO boswatch (packetTimestamp, packetMode, pocsag_ric, pocsag_subric, pocsag_subricText, pocsag_message, pocsag_bitrate, serverName, serverVersion, serverBuildDate, serverBranch, clientName, clientIP, clientVersion, clientBuildDate, clientBranch, inputSource, frequency) VALUES (%s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s)", "pocsag": "INSERT INTO boswatch (packetTimestamp, packetMode, pocsag_ric, pocsag_subric, pocsag_subricText, pocsag_message, pocsag_bitrate, serverName, serverVersion, serverBuildDate, serverBranch, clientName, clientIP, clientVersion, clientBuildDate, clientBranch, inputSource, frequency) VALUES (%s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s)",
@ -63,7 +63,7 @@ class BoswatchPlugin(PluginBase):
self.cursor.close() self.cursor.close()
def setup(self): def setup(self):
"""!Called before alarm r"""!Called before alarm
Remove if not implemented""" Remove if not implemented"""
try: try:
self.connection.ping(reconnect=True, attempts=3, delay=2) self.connection.ping(reconnect=True, attempts=3, delay=2)
@ -74,7 +74,7 @@ class BoswatchPlugin(PluginBase):
self.cursor = self.connection.cursor() self.cursor = self.connection.cursor()
def fms(self, bwPacket): def fms(self, bwPacket):
"""!Called on FMS alarm r"""!Called on FMS alarm
@param bwPacket: bwPacket instance @param bwPacket: bwPacket instance
Remove if not implemented""" Remove if not implemented"""
@ -105,7 +105,7 @@ class BoswatchPlugin(PluginBase):
self.cursor.execute(self.sqlInserts.get("fms"), val) self.cursor.execute(self.sqlInserts.get("fms"), val)
def pocsag(self, bwPacket): def pocsag(self, bwPacket):
"""!Called on POCSAG alarm r"""!Called on POCSAG alarm
@param bwPacket: bwPacket instance @param bwPacket: bwPacket instance
Remove if not implemented""" Remove if not implemented"""
@ -132,7 +132,7 @@ class BoswatchPlugin(PluginBase):
self.cursor.execute(self.sqlInserts.get("pocsag"), val) self.cursor.execute(self.sqlInserts.get("pocsag"), val)
def zvei(self, bwPacket): def zvei(self, bwPacket):
"""!Called on ZVEI alarm r"""!Called on ZVEI alarm
@param bwPacket: bwPacket instance @param bwPacket: bwPacket instance
Remove if not implemented""" Remove if not implemented"""
@ -155,7 +155,7 @@ class BoswatchPlugin(PluginBase):
self.cursor.execute(self.sqlInserts.get("pocsag"), val) self.cursor.execute(self.sqlInserts.get("pocsag"), val)
def msg(self, bwPacket): def msg(self, bwPacket):
"""!Called on MSG packet r"""!Called on MSG packet
@param bwPacket: bwPacket instance @param bwPacket: bwPacket instance
Remove if not implemented""" Remove if not implemented"""
@ -177,12 +177,12 @@ class BoswatchPlugin(PluginBase):
self.cursor.execute(self.sqlInserts.get("msg"), val) self.cursor.execute(self.sqlInserts.get("msg"), val)
def teardown(self): def teardown(self):
"""!Called after alarm r"""!Called after alarm
Remove if not implemented""" Remove if not implemented"""
self.connection.commit() self.connection.commit()
self.cursor.close() self.cursor.close()
def onUnload(self): def onUnload(self):
"""!Called by destruction of the plugin r"""!Called by destruction of the plugin
Remove if not implemented""" Remove if not implemented"""
self.connection.close() self.connection.close()

View file

@ -1,6 +1,6 @@
#!/usr/bin/python #!/usr/bin/python
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
"""! r"""!
____ ____ ______ __ __ __ _____ ____ ____ ______ __ __ __ _____
/ __ )/ __ \/ ___/ | / /___ _/ /______/ /_ |__ / / __ )/ __ \/ ___/ | / /___ _/ /______/ /_ |__ /
/ __ / / / /\__ \| | /| / / __ `/ __/ ___/ __ \ /_ < / __ / / / /\__ \| | /| / / __ `/ __/ ___/ __ \ /_ <
@ -24,12 +24,12 @@ logging.debug("- %s loaded", __name__)
class PluginBase(ABC): class PluginBase(ABC):
"""!Main plugin class""" r"""!Main plugin class"""
_pluginsActive = [] _pluginsActive = []
def __init__(self, pluginName, config): def __init__(self, pluginName, config):
"""!init preload some needed locals and then call onLoad() directly""" r"""!init preload some needed locals and then call onLoad() directly"""
self._pluginName = pluginName self._pluginName = pluginName
self.config = config self.config = config
self._pluginsActive.append(self) self._pluginsActive.append(self)
@ -54,13 +54,13 @@ class PluginBase(ABC):
self.onLoad() self.onLoad()
def _cleanup(self): def _cleanup(self):
"""!Cleanup routine calls onUnload() directly""" r"""!Cleanup routine calls onUnload() directly"""
logging.debug("[%s] onUnload()", self._pluginName) logging.debug("[%s] onUnload()", self._pluginName)
self._pluginsActive.remove(self) self._pluginsActive.remove(self)
self.onUnload() self.onUnload()
def _run(self, bwPacket): def _run(self, bwPacket):
"""!start an complete running turn of an plugin. r"""!start an complete running turn of an plugin.
Calls setup(), alarm() and teardown() in this order. Calls setup(), alarm() and teardown() in this order.
The alarm() method serves the BOSWatch packet to the plugin. The alarm() method serves the BOSWatch packet to the plugin.
@ -121,7 +121,7 @@ class PluginBase(ABC):
return None return None
def _getStatistics(self): def _getStatistics(self):
"""!Returns statistical information's from last plugin run r"""!Returns statistical information's from last plugin run
@return Statistics as pyton dict""" @return Statistics as pyton dict"""
stats = {"type": "plugin", stats = {"type": "plugin",
@ -137,55 +137,55 @@ class PluginBase(ABC):
return stats return stats
def onLoad(self): def onLoad(self):
"""!Called by import of the plugin r"""!Called by import of the plugin
can be inherited""" can be inherited"""
pass pass
def setup(self): def setup(self):
"""!Called before alarm r"""!Called before alarm
can be inherited""" can be inherited"""
pass pass
def fms(self, bwPacket): def fms(self, bwPacket):
"""!Called on FMS alarm r"""!Called on FMS alarm
can be inherited can be inherited
@param bwPacket: bwPacket instance""" @param bwPacket: bwPacket instance"""
logging.warning("ZVEI not implemented in %s", self._pluginName) logging.warning("ZVEI not implemented in %s", self._pluginName)
def pocsag(self, bwPacket): def pocsag(self, bwPacket):
"""!Called on POCSAG alarm r"""!Called on POCSAG alarm
can be inherited can be inherited
@param bwPacket: bwPacket instance""" @param bwPacket: bwPacket instance"""
logging.warning("POCSAG not implemented in %s", self._pluginName) logging.warning("POCSAG not implemented in %s", self._pluginName)
def zvei(self, bwPacket): def zvei(self, bwPacket):
"""!Called on ZVEI alarm r"""!Called on ZVEI alarm
can be inherited can be inherited
@param bwPacket: bwPacket instance""" @param bwPacket: bwPacket instance"""
logging.warning("ZVEI not implemented in %s", self._pluginName) logging.warning("ZVEI not implemented in %s", self._pluginName)
def msg(self, bwPacket): def msg(self, bwPacket):
"""!Called on MSG packet r"""!Called on MSG packet
can be inherited can be inherited
@param bwPacket: bwPacket instance""" @param bwPacket: bwPacket instance"""
logging.warning("MSG not implemented in %s", self._pluginName) logging.warning("MSG not implemented in %s", self._pluginName)
def teardown(self): def teardown(self):
"""!Called after alarm r"""!Called after alarm
can be inherited""" can be inherited"""
pass pass
def onUnload(self): def onUnload(self):
"""!Called on shutdown of boswatch r"""!Called on shutdown of boswatch
can be inherited""" can be inherited"""
pass pass
def parseWildcards(self, msg): def parseWildcards(self, msg):
"""!Return the message with parsed wildcards""" r"""!Return the message with parsed wildcards"""
if self._bwPacket is None: if self._bwPacket is None:
logging.warning("wildcard replacing not allowed - no bwPacket set") logging.warning("wildcard replacing not allowed - no bwPacket set")
return msg return msg

View file

@ -1,6 +1,6 @@
#!/usr/bin/python #!/usr/bin/python
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
"""! r"""!
____ ____ ______ __ __ __ _____ ____ ____ ______ __ __ __ _____
/ __ )/ __ \/ ___/ | / /___ _/ /______/ /_ |__ / / __ )/ __ \/ ___/ | / /___ _/ /______/ /_ |__ /
/ __ / / / /\__ \| | /| / / __ `/ __/ ___/ __ \ /_ < / __ / / / /\__ \| | /| / / __ `/ __/ ___/ __ \ /_ <
@ -51,14 +51,14 @@ class MQBot(telegram.bot.Bot):
class BoswatchPlugin(PluginBase): class BoswatchPlugin(PluginBase):
"""!Description of the Plugin""" r"""!Description of the Plugin"""
def __init__(self, config): def __init__(self, config):
"""!Do not change anything here!""" r"""!Do not change anything here!"""
super().__init__(__name__, config) # you can access the config class on 'self.config' super().__init__(__name__, config) # you can access the config class on 'self.config'
def onLoad(self): def onLoad(self):
"""!Called by import of the plugin""" r"""!Called by import of the plugin"""
if self.config.get("queue", default=True): if self.config.get("queue", default=True):
q = mq.MessageQueue() q = mq.MessageQueue()
request = Request(con_pool_size=8) request = Request(con_pool_size=8)
@ -69,14 +69,14 @@ class BoswatchPlugin(PluginBase):
print('normal') print('normal')
def fms(self, bwPacket): def fms(self, bwPacket):
"""!Called on FMS alarm r"""!Called on FMS alarm
@param bwPacket: bwPacket instance""" @param bwPacket: bwPacket instance"""
msg = self.parseWildcards(self.config.get("message_fms", default="{FMS}")) msg = self.parseWildcards(self.config.get("message_fms", default="{FMS}"))
self._sendMessage(msg) self._sendMessage(msg)
def pocsag(self, bwPacket): def pocsag(self, bwPacket):
"""!Called on POCSAG alarm r"""!Called on POCSAG alarm
@param bwPacket: bwPacket instance""" @param bwPacket: bwPacket instance"""
msg = self.parseWildcards(self.config.get("message_pocsag", default="{RIC}({SRIC})\n{MSG}")) msg = self.parseWildcards(self.config.get("message_pocsag", default="{RIC}({SRIC})\n{MSG}"))
@ -88,14 +88,14 @@ class BoswatchPlugin(PluginBase):
self._sendLocation(lat, lon) self._sendLocation(lat, lon)
def zvei(self, bwPacket): def zvei(self, bwPacket):
"""!Called on ZVEI alarm r"""!Called on ZVEI alarm
@param bwPacket: bwPacket instance""" @param bwPacket: bwPacket instance"""
msg = self.parseWildcards(self.config.get("message_zvei", default="{TONE}")) msg = self.parseWildcards(self.config.get("message_zvei", default="{TONE}"))
self._sendMessage(msg) self._sendMessage(msg)
def msg(self, bwPacket): def msg(self, bwPacket):
"""!Called on MSG packet r"""!Called on MSG packet
@param bwPacket: bwPacket instance""" @param bwPacket: bwPacket instance"""
msg = self.parseWildcards(self.config.get("message_msg")) msg = self.parseWildcards(self.config.get("message_msg"))

View file

@ -1,6 +1,6 @@
#!/usr/bin/python #!/usr/bin/python
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
"""! r"""!
____ ____ ______ __ __ __ _____ ____ ____ ______ __ __ __ _____
/ __ )/ __ \/ ___/ | / /___ _/ /______/ /_ |__ / / __ )/ __ \/ ___/ | / /___ _/ /______/ /_ |__ /
/ __ / / / /\__ \| | /| / / __ `/ __/ ___/ __ \ /_ < / __ / / / /\__ \| | /| / / __ `/ __/ ___/ __ \ /_ <
@ -26,55 +26,55 @@ logging.debug("- %s loaded", __name__)
class BoswatchPlugin(PluginBase): class BoswatchPlugin(PluginBase):
"""!Description of the Plugin""" r"""!Description of the Plugin"""
def __init__(self, config): def __init__(self, config):
"""!Do not change anything here!""" r"""!Do not change anything here!"""
super().__init__(__name__, config) # you can access the config class on 'self.config' super().__init__(__name__, config) # you can access the config class on 'self.config'
def onLoad(self): def onLoad(self):
"""!Called by import of the plugin r"""!Called by import of the plugin
Remove if not implemented""" Remove if not implemented"""
pass pass
def setup(self): def setup(self):
"""!Called before alarm r"""!Called before alarm
Remove if not implemented""" Remove if not implemented"""
pass pass
def fms(self, bwPacket): def fms(self, bwPacket):
"""!Called on FMS alarm r"""!Called on FMS alarm
@param bwPacket: bwPacket instance @param bwPacket: bwPacket instance
Remove if not implemented""" Remove if not implemented"""
pass pass
def pocsag(self, bwPacket): def pocsag(self, bwPacket):
"""!Called on POCSAG alarm r"""!Called on POCSAG alarm
@param bwPacket: bwPacket instance @param bwPacket: bwPacket instance
Remove if not implemented""" Remove if not implemented"""
pass pass
def zvei(self, bwPacket): def zvei(self, bwPacket):
"""!Called on ZVEI alarm r"""!Called on ZVEI alarm
@param bwPacket: bwPacket instance @param bwPacket: bwPacket instance
Remove if not implemented""" Remove if not implemented"""
pass pass
def msg(self, bwPacket): def msg(self, bwPacket):
"""!Called on MSG packet r"""!Called on MSG packet
@param bwPacket: bwPacket instance @param bwPacket: bwPacket instance
Remove if not implemented""" Remove if not implemented"""
pass pass
def teardown(self): def teardown(self):
"""!Called after alarm r"""!Called after alarm
Remove if not implemented""" Remove if not implemented"""
pass pass
def onUnload(self): def onUnload(self):
"""!Called by destruction of the plugin r"""!Called by destruction of the plugin
Remove if not implemented""" Remove if not implemented"""
pass pass

View file

@ -1,6 +1,6 @@
#!/usr/bin/python #!/usr/bin/python
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
"""! r"""!
____ ____ ______ __ __ __ _____ ____ ____ ______ __ __ __ _____
/ __ )/ __ \/ ___/ | / /___ _/ /______/ /_ |__ / / __ )/ __ \/ ___/ | / /___ _/ /______/ /_ |__ /
/ __ / / / /\__ \| | /| / / __ `/ __/ ___/ __ \ /_ < / __ / / / /\__ \| | /| / / __ `/ __/ ___/ __ \ /_ <
@ -32,13 +32,13 @@ def setup_function(function):
@pytest.fixture @pytest.fixture
def getClient(): def getClient():
"""!Build and serve a TCPCLient""" r"""!Build and serve a TCPCLient"""
return TCPClient() return TCPClient()
@pytest.fixture @pytest.fixture
def getServer(): def getServer():
"""!Build and serve a TCPServer""" r"""!Build and serve a TCPServer"""
dataQueue = queue.Queue() dataQueue = queue.Queue()
testServer = TCPServer(dataQueue) testServer = TCPServer(dataQueue)
return testServer return testServer
@ -46,7 +46,7 @@ def getServer():
@pytest.fixture @pytest.fixture
def getRunningServer(getServer): def getRunningServer(getServer):
"""!Build and serve a still running TCPServer""" r"""!Build and serve a still running TCPServer"""
logging.debug("start server") logging.debug("start server")
assert getServer.start() assert getServer.start()
while not getServer.isRunning: while not getServer.isRunning:
@ -58,40 +58,40 @@ def getRunningServer(getServer):
def test_clientConnectFailed(getClient): def test_clientConnectFailed(getClient):
"""!Connect to a non available server""" r"""!Connect to a non available server"""
assert not getClient.connect() assert not getClient.connect()
def test_clientDisconnectFailed(getClient): def test_clientDisconnectFailed(getClient):
"""!Disconnect while no connection is established""" r"""!Disconnect while no connection is established"""
assert getClient.disconnect() assert getClient.disconnect()
def test_clientTransmitFailed(getClient): def test_clientTransmitFailed(getClient):
"""!Transmit while no connection is established""" r"""!Transmit while no connection is established"""
assert not getClient.transmit("test") assert not getClient.transmit("test")
def test_clientReceiveFailed(getClient): def test_clientReceiveFailed(getClient):
"""!Receive while no connection is established""" r"""!Receive while no connection is established"""
assert not getClient.receive() assert not getClient.receive()
def test_clientConnect(getClient, getRunningServer): def test_clientConnect(getClient, getRunningServer):
"""!Connect to a server""" r"""!Connect to a server"""
assert getClient.connect() assert getClient.connect()
assert getClient.disconnect() assert getClient.disconnect()
def test_doubleConnect(getClient, getRunningServer): def test_doubleConnect(getClient, getRunningServer):
"""!Connect to a server twice""" r"""!Connect to a server twice"""
assert getClient.connect() assert getClient.connect()
assert getClient.connect() assert getClient.connect()
assert getClient.disconnect() assert getClient.disconnect()
def test_clientReconnect(getClient, getRunningServer): def test_clientReconnect(getClient, getRunningServer):
"""!Try a reconnect after a established connection""" r"""!Try a reconnect after a established connection"""
assert getClient.connect() assert getClient.connect()
assert getClient.disconnect() assert getClient.disconnect()
assert getClient.connect() assert getClient.connect()
@ -99,7 +99,7 @@ def test_clientReconnect(getClient, getRunningServer):
def test_clientMultiConnect(getClient, getRunningServer): def test_clientMultiConnect(getClient, getRunningServer):
"""!Connect with 2 clients to the server""" r"""!Connect with 2 clients to the server"""
assert getClient.connect() assert getClient.connect()
testClient2 = TCPClient() testClient2 = TCPClient()
assert testClient2.connect() assert testClient2.connect()
@ -112,7 +112,7 @@ def test_clientMultiConnect(getClient, getRunningServer):
def test_clientCommunicate(getClient, getRunningServer): def test_clientCommunicate(getClient, getRunningServer):
"""!Try to send data to the server and check on '[ack]'""" r"""!Try to send data to the server and check on '[ack]'"""
assert getClient.connect() assert getClient.connect()
assert getClient.transmit("test") assert getClient.transmit("test")
assert getClient.receive() == "[ack]" assert getClient.receive() == "[ack]"
@ -121,7 +121,7 @@ def test_clientCommunicate(getClient, getRunningServer):
@pytest.mark.skip("needs fixture for more than one client") @pytest.mark.skip("needs fixture for more than one client")
def test_clientMultiCommunicate(getServer): def test_clientMultiCommunicate(getServer):
"""!Try to send data to the server with 3 clients and check on '[ack]'""" r"""!Try to send data to the server with 3 clients and check on '[ack]'"""
# connect all # connect all
testClient1 = TCPClient() testClient1 = TCPClient()
assert testClient1.connect() assert testClient1.connect()
@ -146,26 +146,26 @@ def test_clientMultiCommunicate(getServer):
def test_serverRestart(getRunningServer): def test_serverRestart(getRunningServer):
"""!Test a stop and restart of the server""" r"""!Test a stop and restart of the server"""
assert getRunningServer.stop() assert getRunningServer.stop()
assert getRunningServer.start() assert getRunningServer.start()
assert getRunningServer.stop() assert getRunningServer.stop()
def test_serverStopFailed(getServer): def test_serverStopFailed(getServer):
"""!Test to stop a stopped server""" r"""!Test to stop a stopped server"""
assert getServer.stop() assert getServer.stop()
def test_serverDoubleStart(getServer): def test_serverDoubleStart(getServer):
"""!Test to start the server twice""" r"""!Test to start the server twice"""
assert getServer.start() assert getServer.start()
assert getServer.start() assert getServer.start()
assert getServer.stop() assert getServer.stop()
def test_serverStartTwoInstances(): def test_serverStartTwoInstances():
"""!Test to start two server different server instances""" r"""!Test to start two server different server instances"""
dataQueue = queue.Queue() dataQueue = queue.Queue()
testServer1 = TCPServer(dataQueue) testServer1 = TCPServer(dataQueue)
testServer2 = TCPServer(dataQueue) testServer2 = TCPServer(dataQueue)
@ -179,7 +179,7 @@ def test_serverStartTwoInstances():
def test_serverStopsWhileConnected(getRunningServer, getClient): def test_serverStopsWhileConnected(getRunningServer, getClient):
"""!Shutdown server while client is connected""" r"""!Shutdown server while client is connected"""
getClient.connect() getClient.connect()
getRunningServer.stop() getRunningServer.stop()
timeout = 5 timeout = 5
@ -193,7 +193,7 @@ def test_serverStopsWhileConnected(getRunningServer, getClient):
@pytest.mark.skip("needs fixture for more than one client") @pytest.mark.skip("needs fixture for more than one client")
def test_serverGetOutput(getRunningServer): def test_serverGetOutput(getRunningServer):
"""!Send data to server with 2 clients, check '[ack]' and data on server queue""" r"""!Send data to server with 2 clients, check '[ack]' and data on server queue"""
# connect all # connect all
testClient1 = TCPClient() testClient1 = TCPClient()
assert testClient1.connect() assert testClient1.connect()
@ -217,7 +217,7 @@ def test_serverGetOutput(getRunningServer):
def test_serverHighLoad(getRunningServer): def test_serverHighLoad(getRunningServer):
"""!High load server test with 10 send threads each will send 100 msg with 324 bytes size""" r"""!High load server test with 10 send threads each will send 100 msg with 324 bytes size"""
logging.debug("start sendThreads") logging.debug("start sendThreads")
threads = [] threads = []
for thr_id in range(10): for thr_id in range(10):

View file

@ -1,6 +1,6 @@
#!/usr/bin/python #!/usr/bin/python
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
"""! r"""!
____ ____ ______ __ __ __ _____ ____ ____ ______ __ __ __ _____
/ __ )/ __ \/ ___/ | / /___ _/ /______/ /_ |__ / / __ )/ __ \/ ___/ | / /___ _/ /______/ /_ |__ /
/ __ / / / /\__ \| | /| / / __ `/ __/ ___/ __ \ /_ < / __ / / / /\__ \| | /| / / __ `/ __/ ___/ __ \ /_ <
@ -29,7 +29,7 @@ def setup_function(function):
@pytest.fixture() @pytest.fixture()
def broadcastServer(): def broadcastServer():
"""!Server a BroadcastServer instance""" r"""!Server a BroadcastServer instance"""
broadcastServer = BroadcastServer() broadcastServer = BroadcastServer()
yield broadcastServer yield broadcastServer
if broadcastServer.isRunning: if broadcastServer.isRunning:
@ -40,36 +40,36 @@ def broadcastServer():
@pytest.fixture() @pytest.fixture()
def broadcastClient(): def broadcastClient():
"""!Server a BroadcastClient instance""" r"""!Server a BroadcastClient instance"""
return BroadcastClient() return BroadcastClient()
def test_serverStartStop(broadcastServer): def test_serverStartStop(broadcastServer):
"""!Start a BroadcastServer, check if running and stop it""" r"""!Start a BroadcastServer, check if running and stop it"""
assert broadcastServer.start() assert broadcastServer.start()
assert broadcastServer.isRunning assert broadcastServer.isRunning
assert broadcastServer.stop() assert broadcastServer.stop()
def test_serverDoubleStart(broadcastServer): def test_serverDoubleStart(broadcastServer):
"""!Try to start a BroadcastServer twice""" r"""!Try to start a BroadcastServer twice"""
assert broadcastServer.start() assert broadcastServer.start()
assert broadcastServer.start() assert broadcastServer.start()
assert broadcastServer.stop() assert broadcastServer.stop()
def test_serverStopNotStarted(broadcastServer): def test_serverStopNotStarted(broadcastServer):
"""!Try to stop a BroadcastServer where is not running""" r"""!Try to stop a BroadcastServer where is not running"""
assert broadcastServer.stop() assert broadcastServer.stop()
def test_clientWithoutServer(broadcastClient): def test_clientWithoutServer(broadcastClient):
"""!Use BroadcastClient with no server""" r"""!Use BroadcastClient with no server"""
assert not broadcastClient.getConnInfo(1) assert not broadcastClient.getConnInfo(1)
def test_serverClientFetchConnInfo(broadcastClient, broadcastServer): def test_serverClientFetchConnInfo(broadcastClient, broadcastServer):
"""!Fetch connection info from BroadcastServer""" r"""!Fetch connection info from BroadcastServer"""
assert broadcastServer.start() assert broadcastServer.start()
assert broadcastClient.getConnInfo() assert broadcastClient.getConnInfo()
assert broadcastServer.stop() assert broadcastServer.stop()

View file

@ -1,6 +1,6 @@
#!/usr/bin/python #!/usr/bin/python
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
"""! r"""!
____ ____ ______ __ __ __ _____ ____ ____ ______ __ __ __ _____
/ __ )/ __ \/ ___/ | / /___ _/ /______/ /_ |__ / / __ )/ __ \/ ___/ | / /___ _/ /______/ /_ |__ /
/ __ / / / /\__ \| | /| / / __ `/ __/ ___/ __ \ /_ < / __ / / / /\__ \| | /| / / __ `/ __/ ___/ __ \ /_ <
@ -29,41 +29,41 @@ def setup_function(function):
@pytest.fixture @pytest.fixture
def getConfig(): def getConfig():
"""!Build a config object""" r"""!Build a config object"""
return ConfigYAML() return ConfigYAML()
@pytest.fixture @pytest.fixture
def getFilledConfig(): def getFilledConfig():
"""!Build a config object and fill it with the config data""" r"""!Build a config object and fill it with the config data"""
filledConfig = ConfigYAML() filledConfig = ConfigYAML()
assert filledConfig.loadConfigFile(paths.TEST_PATH + "test_config.yaml") is True assert filledConfig.loadConfigFile(paths.TEST_PATH + "test_config.yaml") is True
return filledConfig return filledConfig
def test_loadConfigFile(getConfig): def test_loadConfigFile(getConfig):
"""!load a config file""" r"""!load a config file"""
assert getConfig.loadConfigFile(paths.TEST_PATH + "test_config.yaml") is True assert getConfig.loadConfigFile(paths.TEST_PATH + "test_config.yaml") is True
def test_loadConfigFileFailed(getConfig): def test_loadConfigFileFailed(getConfig):
"""!load a config file with syntax error""" r"""!load a config file with syntax error"""
assert getConfig.loadConfigFile(paths.TEST_PATH + "test_configFailed.yaml") is False assert getConfig.loadConfigFile(paths.TEST_PATH + "test_configFailed.yaml") is False
def test_loadConfigFileNotFound(getConfig): def test_loadConfigFileNotFound(getConfig):
"""!load a config file where is not available""" r"""!load a config file where is not available"""
assert getConfig.loadConfigFile(paths.TEST_PATH + "test_configNotFound.yaml") is False assert getConfig.loadConfigFile(paths.TEST_PATH + "test_configNotFound.yaml") is False
def test_getConfigAsString(getFilledConfig): def test_getConfigAsString(getFilledConfig):
"""!Get the string representation of the config""" r"""!Get the string representation of the config"""
assert type(str(getFilledConfig)) is str assert type(str(getFilledConfig)) is str
logging.debug(getFilledConfig) logging.debug(getFilledConfig)
def test_getTypes(getFilledConfig): def test_getTypes(getFilledConfig):
"""!Get and check different data types in config""" r"""!Get and check different data types in config"""
assert type(getFilledConfig.get("types")) is ConfigYAML assert type(getFilledConfig.get("types")) is ConfigYAML
assert type(getFilledConfig.get("types", "string")) is str assert type(getFilledConfig.get("types", "string")) is str
assert type(getFilledConfig.get("types", "bool")) is bool assert type(getFilledConfig.get("types", "bool")) is bool
@ -72,19 +72,19 @@ def test_getTypes(getFilledConfig):
def test_getDefaultValue(getFilledConfig): def test_getDefaultValue(getFilledConfig):
"""!Get the default value of an not existent entry""" r"""!Get the default value of an not existent entry"""
assert getFilledConfig.get("notExistent", default="defaultValue") == "defaultValue" assert getFilledConfig.get("notExistent", default="defaultValue") == "defaultValue"
def test_getNestedConfig(getFilledConfig): def test_getNestedConfig(getFilledConfig):
"""!Work with nested sub-config elements""" r"""!Work with nested sub-config elements"""
nestedConfig = getFilledConfig.get("types") nestedConfig = getFilledConfig.get("types")
assert type(nestedConfig) is ConfigYAML assert type(nestedConfig) is ConfigYAML
assert nestedConfig.get("string") == "Hello World" assert nestedConfig.get("string") == "Hello World"
def test_configIterationList(getFilledConfig): def test_configIterationList(getFilledConfig):
"""!Try to iterate over a list in the config""" r"""!Try to iterate over a list in the config"""
counter = 0 counter = 0
for item in getFilledConfig.get("list"): for item in getFilledConfig.get("list"):
assert type(item) is str assert type(item) is str
@ -93,7 +93,7 @@ def test_configIterationList(getFilledConfig):
def test_configIterationListWithNestedList(getFilledConfig): def test_configIterationListWithNestedList(getFilledConfig):
"""!Try to iterate over a list in the config where its elements are lists itself""" r"""!Try to iterate over a list in the config where its elements are lists itself"""
listCnt = 0 listCnt = 0
strCnt = 0 strCnt = 0
for item in getFilledConfig.get("list1"): for item in getFilledConfig.get("list1"):

View file

@ -1,6 +1,6 @@
#!/usr/bin/python #!/usr/bin/python
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
"""! r"""!
____ ____ ______ __ __ __ _____ ____ ____ ______ __ __ __ _____
/ __ )/ __ \/ ___/ | / /___ _/ /______/ /_ |__ / / __ )/ __ \/ ___/ | / /___ _/ /______/ /_ |__ /
/ __ / / / /\__ \| | /| / / __ `/ __/ ___/ __ \ /_ < / __ / / / /\__ \| | /| / / __ `/ __/ ___/ __ \ /_ <
@ -26,19 +26,19 @@ def setup_function(function):
def test_decoderNoData(): def test_decoderNoData():
"""!Test a empty string""" r"""!Test a empty string"""
assert Decoder.decode("") is None assert Decoder.decode("") is None
def test_decoderZveiValid(): def test_decoderZveiValid():
"""!Test valid ZVEI""" r"""!Test valid ZVEI"""
assert not Decoder.decode("ZVEI1: 12345") is None assert not Decoder.decode("ZVEI1: 12345") is None
assert not Decoder.decode("ZVEI1: 12838") is None assert not Decoder.decode("ZVEI1: 12838") is None
assert not Decoder.decode("ZVEI1: 34675") is None assert not Decoder.decode("ZVEI1: 34675") is None
def test_decoderZveiDoubleTone(): def test_decoderZveiDoubleTone():
"""!Test doubleTone included ZVEI""" r"""!Test doubleTone included ZVEI"""
assert not Decoder.decode("ZVEI1: 6E789") is None assert not Decoder.decode("ZVEI1: 6E789") is None
assert not Decoder.decode("ZVEI1: 975E7") is None assert not Decoder.decode("ZVEI1: 975E7") is None
assert not Decoder.decode("ZVEI1: 2E87E") is None assert not Decoder.decode("ZVEI1: 2E87E") is None
@ -54,7 +54,7 @@ def test_decoderZveiInvalid():
def test_decoderPocsagValid(): def test_decoderPocsagValid():
"""!Test valid POCSAG""" r"""!Test valid POCSAG"""
assert not Decoder.decode("POCSAG512: Address: 1000000 Function: 0") is None assert not Decoder.decode("POCSAG512: Address: 1000000 Function: 0") is None
assert not Decoder.decode("POCSAG512: Address: 1000001 Function: 1") is None assert not Decoder.decode("POCSAG512: Address: 1000001 Function: 1") is None
assert not Decoder.decode("POCSAG1200: Address: 1000002 Function: 2") is None assert not Decoder.decode("POCSAG1200: Address: 1000002 Function: 2") is None
@ -62,7 +62,7 @@ def test_decoderPocsagValid():
def test_decoderPocsagText(): def test_decoderPocsagText():
"""!Test POCSAG with text""" r"""!Test POCSAG with text"""
assert not Decoder.decode("POCSAG512: Address: 1000000 Function: 0 Alpha: test") is None assert not Decoder.decode("POCSAG512: Address: 1000000 Function: 0 Alpha: test") is None
assert not Decoder.decode("POCSAG512: Address: 1000001 Function: 1 Alpha: test") is None assert not Decoder.decode("POCSAG512: Address: 1000001 Function: 1 Alpha: test") is None
assert not Decoder.decode("POCSAG1200: Address: 1000002 Function: 2 Alpha: test") is None assert not Decoder.decode("POCSAG1200: Address: 1000002 Function: 2 Alpha: test") is None
@ -70,7 +70,7 @@ def test_decoderPocsagText():
def test_decoderPocsagShortRic(): def test_decoderPocsagShortRic():
"""!Test short POCSAG""" r"""!Test short POCSAG"""
assert not Decoder.decode("POCSAG512: Address: 3 Function: 0 Alpha: test") is None assert not Decoder.decode("POCSAG512: Address: 3 Function: 0 Alpha: test") is None
assert not Decoder.decode("POCSAG512: Address: 33 Function: 0 Alpha: test") is None assert not Decoder.decode("POCSAG512: Address: 33 Function: 0 Alpha: test") is None
assert not Decoder.decode("POCSAG1200: Address: 333 Function: 0 Alpha: test") is None assert not Decoder.decode("POCSAG1200: Address: 333 Function: 0 Alpha: test") is None
@ -81,14 +81,14 @@ def test_decoderPocsagShortRic():
def test_decoderPocsagInvalid(): def test_decoderPocsagInvalid():
"""!Test invalid POCSAG""" r"""!Test invalid POCSAG"""
assert Decoder.decode("POCSAG512: Address: 333333F Function: 0 Alpha: invalid") is None assert Decoder.decode("POCSAG512: Address: 333333F Function: 0 Alpha: invalid") is None
assert Decoder.decode("POCSAG512: Address: 333333F Function: 1 Alpha: invalid") is None assert Decoder.decode("POCSAG512: Address: 333333F Function: 1 Alpha: invalid") is None
assert Decoder.decode("POCSAG512: Address: 3333333 Function: 4 Alpha: invalid") is None assert Decoder.decode("POCSAG512: Address: 3333333 Function: 4 Alpha: invalid") is None
def test_decoderFmsValid(): def test_decoderFmsValid():
"""!Test valid FMS""" r"""!Test valid FMS"""
assert not Decoder.decode("""FMS: 43f314170000 (9=Rotkreuz 3=Bayern 1 Ort 0x25=037FZG 7141Status 3=Einsatz Ab 0=FZG->LST 2=I (ohneNA,ohneSIGNAL)) CRC correct""") is None assert not Decoder.decode("""FMS: 43f314170000 (9=Rotkreuz 3=Bayern 1 Ort 0x25=037FZG 7141Status 3=Einsatz Ab 0=FZG->LST 2=I (ohneNA,ohneSIGNAL)) CRC correct""") is None
assert not Decoder.decode("""FMS: 43f314170000 (9=Rotkreuz 3=Bayern 1 Ort 0x25=037FZG 7141Status 3=Einsatz Ab 1=LST->FZG 2=I (ohneNA,ohneSIGNAL)) CRC correct""") is None assert not Decoder.decode("""FMS: 43f314170000 (9=Rotkreuz 3=Bayern 1 Ort 0x25=037FZG 7141Status 3=Einsatz Ab 1=LST->FZG 2=I (ohneNA,ohneSIGNAL)) CRC correct""") is None
assert not Decoder.decode("""FMS: 43f314170000 (9=Rotkreuz 3=Bayern 1 Ort 0x25=037FZG 7141Status 3=Einsatz Ab 0=FZG->LST 2=II (ohneNA,mit SIGNAL)) CRC correct""") is None assert not Decoder.decode("""FMS: 43f314170000 (9=Rotkreuz 3=Bayern 1 Ort 0x25=037FZG 7141Status 3=Einsatz Ab 0=FZG->LST 2=II (ohneNA,mit SIGNAL)) CRC correct""") is None
@ -97,7 +97,7 @@ def test_decoderFmsValid():
def test_decoderFmsInvalid(): def test_decoderFmsInvalid():
"""!Test invalid FMS""" r"""!Test invalid FMS"""
assert Decoder.decode("""FMS: 14170000 (9=Rotkreuz 3=Bayern 1 Ort 0x25=037FZG 7141Status 3=Einsatz Ab 1=LST->FZG 2=III(mit NA,ohneSIGNAL)) CRC correct""") is None assert Decoder.decode("""FMS: 14170000 (9=Rotkreuz 3=Bayern 1 Ort 0x25=037FZG 7141Status 3=Einsatz Ab 1=LST->FZG 2=III(mit NA,ohneSIGNAL)) CRC correct""") is None
assert Decoder.decode("""FMS: 43f314170000 (9=Rotkreuz 3=Bayern 1 Ort 0x25=037FZG 7141Sta 3=Einsatz Ab 0=FZG->LST 2=IV (mit NA,mit SIGNAL)) CRC correct""") is None assert Decoder.decode("""FMS: 43f314170000 (9=Rotkreuz 3=Bayern 1 Ort 0x25=037FZG 7141Sta 3=Einsatz Ab 0=FZG->LST 2=IV (mit NA,mit SIGNAL)) CRC correct""") is None
assert Decoder.decode("""FMS: 14170000 (9=Rotkreuz 3=Bayern 1 Ort 0x25=037FZG 7141Status 3=Einsatz Ab 1=LST->FZG 2=III(mit NA,ohneSIGNAL)) CRC incorrect""") is None assert Decoder.decode("""FMS: 14170000 (9=Rotkreuz 3=Bayern 1 Ort 0x25=037FZG 7141Status 3=Einsatz Ab 1=LST->FZG 2=III(mit NA,ohneSIGNAL)) CRC incorrect""") is None

View file

@ -1,6 +1,6 @@
#!/usr/bin/python #!/usr/bin/python
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
"""! r"""!
____ ____ ______ __ __ __ _____ ____ ____ ______ __ __ __ _____
/ __ )/ __ \/ ___/ | / /___ _/ /______/ /_ |__ / / __ )/ __ \/ ___/ | / /___ _/ /______/ /_ |__ /
/ __ / / / /\__ \| | /| / / __ `/ __/ ___/ __ \ /_ < / __ / / / /\__ \| | /| / / __ `/ __/ ___/ __ \ /_ <
@ -26,10 +26,10 @@ def setup_function(function):
def test_logoToLog(): def test_logoToLog():
"""!Test logo to log""" r"""!Test logo to log"""
assert header.logoToLog() assert header.logoToLog()
def test_infoToLog(): def test_infoToLog():
"""!Test info to log""" r"""!Test info to log"""
assert header.infoToLog() assert header.infoToLog()

View file

@ -1,6 +1,6 @@
#!/usr/bin/python #!/usr/bin/python
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
"""! r"""!
____ ____ ______ __ __ __ _____ ____ ____ ______ __ __ __ _____
/ __ )/ __ \/ ___/ | / /___ _/ /______/ /_ |__ / / __ )/ __ \/ ___/ | / /___ _/ /______/ /_ |__ /
/ __ / / / /\__ \| | /| / / __ `/ __/ ___/ __ \ /_ < / __ / / / /\__ \| | /| / / __ `/ __/ ___/ __ \ /_ <
@ -28,33 +28,33 @@ def setup_function(function):
@pytest.fixture() @pytest.fixture()
def buildPacket(): def buildPacket():
"""!Build a BOSWatch packet and serve it to each test""" r"""!Build a BOSWatch packet and serve it to each test"""
return Packet() return Packet()
def test_createPacket(buildPacket): def test_createPacket(buildPacket):
"""!Create a packet""" r"""!Create a packet"""
assert buildPacket != "" assert buildPacket != ""
def test_copyPacket(buildPacket): def test_copyPacket(buildPacket):
"""!Copy a packet to an new instance""" r"""!Copy a packet to an new instance"""
bwCopyPacket = Packet(buildPacket.__str__()) bwCopyPacket = Packet(buildPacket.__str__())
assert bwCopyPacket != "" assert bwCopyPacket != ""
def test_getPacketString(buildPacket): def test_getPacketString(buildPacket):
"""!get the intern packet dict as string""" r"""!get the intern packet dict as string"""
assert type(buildPacket.__str__()) is str assert type(buildPacket.__str__()) is str
assert buildPacket.__str__() != "" assert buildPacket.__str__() != ""
def test_getNotSetField(buildPacket): def test_getNotSetField(buildPacket):
"""!try to get a not set field""" r"""!try to get a not set field"""
assert not buildPacket.get("testfield") assert not buildPacket.get("testfield")
def test_setGetField(buildPacket): def test_setGetField(buildPacket):
"""!set and get a field""" r"""!set and get a field"""
buildPacket.set("testField", "test") buildPacket.set("testField", "test")
assert buildPacket.get("testField") == "test" assert buildPacket.get("testField") == "test"

View file

@ -1,6 +1,6 @@
#!/usr/bin/python #!/usr/bin/python
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
"""! r"""!
____ ____ ______ __ __ __ _____ ____ ____ ______ __ __ __ _____
/ __ )/ __ \/ ___/ | / /___ _/ /______/ /_ |__ / / __ )/ __ \/ ___/ | / /___ _/ /______/ /_ |__ /
/ __ / / / /\__ \| | /| / / __ `/ __/ ___/ __ \ /_ < / __ / / / /\__ \| | /| / / __ `/ __/ ___/ __ \ /_ <
@ -27,23 +27,23 @@ def setup_function(function):
def test_fileExists(): def test_fileExists():
"""!load a local config file""" r"""!load a local config file"""
assert paths.fileExist("README.md") assert paths.fileExist("README.md")
def test_fileNotExists(): def test_fileNotExists():
"""!load a local config file""" r"""!load a local config file"""
assert not paths.fileExist("notFound.txt") assert not paths.fileExist("notFound.txt")
def test_makeDirNotExisting(): def test_makeDirNotExisting():
"""!load a local config file""" r"""!load a local config file"""
assert paths.makeDirIfNotExist("UnItTeSt") assert paths.makeDirIfNotExist("UnItTeSt")
os.removedirs("UnItTeSt") os.removedirs("UnItTeSt")
def test_makeDirExisting(): def test_makeDirExisting():
"""!load a local config file""" r"""!load a local config file"""
paths.makeDirIfNotExist("UnItTeSt") paths.makeDirIfNotExist("UnItTeSt")
assert paths.makeDirIfNotExist("UnItTeSt") assert paths.makeDirIfNotExist("UnItTeSt")
os.removedirs("UnItTeSt") os.removedirs("UnItTeSt")

View file

@ -1,6 +1,6 @@
#!/usr/bin/python #!/usr/bin/python
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
"""! r"""!
____ ____ ______ __ __ __ _____ ____ ____ ______ __ __ __ _____
/ __ )/ __ \/ ___/ | / /___ _/ /______/ /_ |__ / / __ )/ __ \/ ___/ | / /___ _/ /______/ /_ |__ /
/ __ / / / /\__ \| | /| / / __ `/ __/ ___/ __ \ /_ < / __ / / / /\__ \| | /| / / __ `/ __/ ___/ __ \ /_ <
@ -28,12 +28,12 @@ def setup_function(function):
def testTargetFast(): def testTargetFast():
"""!Fast worker thread""" r"""!Fast worker thread"""
logging.debug("run testTargetFast") logging.debug("run testTargetFast")
def testTargetSlow(): def testTargetSlow():
"""!Slow worker thread""" r"""!Slow worker thread"""
logging.debug("run testTargetSlow start") logging.debug("run testTargetSlow start")
time.sleep(0.51) time.sleep(0.51)
logging.debug("run testTargetSlow end") logging.debug("run testTargetSlow end")
@ -41,7 +41,7 @@ def testTargetSlow():
@pytest.fixture() @pytest.fixture()
def useTimerFast(): def useTimerFast():
"""!Server a RepeatedTimer instance with fast worker""" r"""!Server a RepeatedTimer instance with fast worker"""
testTimer = RepeatedTimer(0.1, testTargetFast) testTimer = RepeatedTimer(0.1, testTargetFast)
yield testTimer yield testTimer
if testTimer.isRunning: if testTimer.isRunning:
@ -50,7 +50,7 @@ def useTimerFast():
@pytest.fixture() @pytest.fixture()
def useTimerSlow(): def useTimerSlow():
"""!Server a RepeatedTimer instance slow worker""" r"""!Server a RepeatedTimer instance slow worker"""
testTimer = RepeatedTimer(0.1, testTargetSlow) testTimer = RepeatedTimer(0.1, testTargetSlow)
yield testTimer yield testTimer
if testTimer.isRunning: if testTimer.isRunning:
@ -58,32 +58,32 @@ def useTimerSlow():
def test_timerStartStop(useTimerFast): def test_timerStartStop(useTimerFast):
"""!Try to start and stop a timer""" r"""!Try to start and stop a timer"""
assert useTimerFast.start() assert useTimerFast.start()
assert useTimerFast.stop() assert useTimerFast.stop()
def test_timerDoubleStart(useTimerFast): def test_timerDoubleStart(useTimerFast):
"""!Try to start a timer twice""" r"""!Try to start a timer twice"""
assert useTimerFast.start() assert useTimerFast.start()
assert useTimerFast.start() assert useTimerFast.start()
assert useTimerFast.stop() assert useTimerFast.stop()
def test_timerStopNotStarted(useTimerFast): def test_timerStopNotStarted(useTimerFast):
"""!Try to stop a timer where is not started""" r"""!Try to stop a timer where is not started"""
assert useTimerFast.stop() assert useTimerFast.stop()
def test_timerIsRunning(useTimerFast): def test_timerIsRunning(useTimerFast):
"""!Check if a timer is running""" r"""!Check if a timer is running"""
assert useTimerFast.start() assert useTimerFast.start()
assert useTimerFast.isRunning assert useTimerFast.isRunning
assert useTimerFast.stop() assert useTimerFast.stop()
def test_timerRun(useTimerFast): def test_timerRun(useTimerFast):
"""!Run a timer and check overdue and lostEvents""" r"""!Run a timer and check overdue and lostEvents"""
assert useTimerFast.start() assert useTimerFast.start()
time.sleep(0.2) time.sleep(0.2)
assert useTimerFast.stop() assert useTimerFast.stop()
@ -92,7 +92,7 @@ def test_timerRun(useTimerFast):
def test_timerOverdue(useTimerSlow): def test_timerOverdue(useTimerSlow):
"""!Run a timer and check overdue and lostEvents""" r"""!Run a timer and check overdue and lostEvents"""
assert useTimerSlow.start() assert useTimerSlow.start()
time.sleep(0.2) time.sleep(0.2)
assert useTimerSlow.stop() assert useTimerSlow.stop()
@ -101,7 +101,7 @@ def test_timerOverdue(useTimerSlow):
def test_timerOverdueLong(useTimerSlow): def test_timerOverdueLong(useTimerSlow):
"""!Run a timer and check overdue and lostEvents""" r"""!Run a timer and check overdue and lostEvents"""
assert useTimerSlow.start() assert useTimerSlow.start()
time.sleep(1) time.sleep(1)
assert useTimerSlow.stop() assert useTimerSlow.stop()

View file

@ -1,6 +1,6 @@
#!/usr/bin/python #!/usr/bin/python
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
"""! r"""!
____ ____ ______ __ __ __ _____ ____ ____ ______ __ __ __ _____
/ __ )/ __ \/ ___/ | / /___ _/ /______/ /_ |__ / / __ )/ __ \/ ___/ | / /___ _/ /______/ /_ |__ /
/ __ / / / /\__ \| | /| / / __ `/ __/ ___/ __ \ /_ < / __ / / / /\__ \| | /| / / __ `/ __/ ___/ __ \ /_ <
@ -31,7 +31,7 @@ def setup_method(method):
@pytest.fixture @pytest.fixture
def makeDescriptor(): def makeDescriptor():
"""!Build a descriptor object with loaded configuration""" r"""!Build a descriptor object with loaded configuration"""
config = ConfigYAML() config = ConfigYAML()
assert config.loadConfigFile(paths.TEST_PATH + "test_config.yaml") is True assert config.loadConfigFile(paths.TEST_PATH + "test_config.yaml") is True
descriptor = Descriptor(config.get("descriptor_test")) descriptor = Descriptor(config.get("descriptor_test"))
@ -40,33 +40,33 @@ def makeDescriptor():
@pytest.fixture @pytest.fixture
def makePacket(): def makePacket():
"""!Build a BW Packet object""" r"""!Build a BW Packet object"""
packet = Packet() packet = Packet()
return packet return packet
def test_descriptorFoundFirst(makeDescriptor, makePacket): def test_descriptorFoundFirst(makeDescriptor, makePacket):
"""!Run descriptor on the first entry in list""" r"""!Run descriptor on the first entry in list"""
makePacket.set("tone", "12345") makePacket.set("tone", "12345")
makePacket = makeDescriptor.doWork(makePacket) makePacket = makeDescriptor.doWork(makePacket)
assert makePacket.get("description") == "Test 12345" assert makePacket.get("description") == "Test 12345"
def test_descriptorFoundSecond(makeDescriptor, makePacket): def test_descriptorFoundSecond(makeDescriptor, makePacket):
"""!Run descriptor on the second entry in list""" r"""!Run descriptor on the second entry in list"""
makePacket.set("tone", "23456") makePacket.set("tone", "23456")
makePacket = makeDescriptor.doWork(makePacket) makePacket = makeDescriptor.doWork(makePacket)
assert makePacket.get("description") == "Test 23456" assert makePacket.get("description") == "Test 23456"
def test_descriptorNotFound(makeDescriptor, makePacket): def test_descriptorNotFound(makeDescriptor, makePacket):
"""!Run descriptor no matching data found""" r"""!Run descriptor no matching data found"""
makePacket.set("tone", "99999") makePacket.set("tone", "99999")
makePacket = makeDescriptor.doWork(makePacket) makePacket = makeDescriptor.doWork(makePacket)
assert makePacket.get("description") == "99999" assert makePacket.get("description") == "99999"
def test_descriptorScanFieldNotAvailable(makeDescriptor, makePacket): def test_descriptorScanFieldNotAvailable(makeDescriptor, makePacket):
"""!Run descriptor on a non existent scanField""" r"""!Run descriptor on a non existent scanField"""
makePacket = makeDescriptor.doWork(makePacket) makePacket = makeDescriptor.doWork(makePacket)
assert makePacket.get("description") is None assert makePacket.get("description") is None

View file

@ -1,6 +1,6 @@
#!/usr/bin/python #!/usr/bin/python
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
"""! r"""!
____ ____ ______ __ __ __ _____ ____ ____ ______ __ __ __ _____
/ __ )/ __ \/ ___/ | / /___ _/ /______/ /_ |__ / / __ )/ __ \/ ___/ | / /___ _/ /______/ /_ |__ /
/ __ / / / /\__ \| | /| / / __ `/ __/ ___/ __ \ /_ < / __ / / / /\__ \| | /| / / __ `/ __/ ___/ __ \ /_ <