Skip to content

Commit

Permalink
Merge pull request #112 from Luflosi/fix-deprecation-warning
Browse files Browse the repository at this point in the history
Avoid "DeprecationWarning: invalid escape sequence"
  • Loading branch information
Schrolli91 authored Jan 8, 2024
2 parents 1b95474 + d4dcc75 commit b7ba7f8
Show file tree
Hide file tree
Showing 50 changed files with 327 additions and 327 deletions.
6 changes: 3 additions & 3 deletions FileHead.template.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/usr/bin/python
# -*- coding: utf-8 -*-
"""!
r"""!
____ ____ ______ __ __ __ _____
/ __ )/ __ \/ ___/ | / /___ _/ /______/ /_ |__ /
/ __ / / / /\__ \| | /| / / __ `/ __/ ___/ __ \ /_ <
Expand All @@ -22,8 +22,8 @@


class ClassName:
"""!General class comment"""
r"""!General class comment"""

def __init__(self):
"""!init comment"""
r"""!init comment"""
pass
10 changes: 5 additions & 5 deletions boswatch/configYaml.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/usr/bin/python
# -*- coding: utf-8 -*-
"""!
r"""!
____ ____ ______ __ __ __ _____
/ __ )/ __ \/ ___/ | / /___ _/ /______/ /_ |__ /
/ __ / / / /\__ \| | /| / / __ `/ __/ ___/ __ \ /_ <
Expand Down Expand Up @@ -34,15 +34,15 @@ def __iter__(self):
yield item

def __len__(self):
"""!returns the length of an config element"""
r"""!returns the length of an config element"""
return len(self._config)

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)

def loadConfigFile(self, configPath):
"""!loads a given configuration file
r"""!loads a given configuration file
@param configPath: Path to the config file
@return True or False"""
Expand All @@ -59,7 +59,7 @@ def loadConfigFile(self, configPath):
return False

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
@param *args: Config section (one ore more strings)
Expand Down
4 changes: 2 additions & 2 deletions boswatch/decoder/decoder.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/usr/bin/python
# -*- coding: utf-8 -*-
"""!
r"""!
____ ____ ______ __ __ __ _____
/ __ )/ __ \/ ___/ | / /___ _/ /______/ /_ |__ /
/ __ / / / /\__ \| | /| / / __ `/ __/ ___/ __ \ /_ <
Expand All @@ -27,7 +27,7 @@ class Decoder:

@staticmethod
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
@return bwPacket instance"""
Expand Down
6 changes: 3 additions & 3 deletions boswatch/decoder/fmsDecoder.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/usr/bin/python
# -*- coding: utf-8 -*-
"""!
r"""!
____ ____ ______ __ __ __ _____
/ __ )/ __ \/ ___/ | / /___ _/ /______/ /_ |__ /
/ __ / / / /\__ \| | /| / / __ `/ __/ ___/ __ \ /_ <
Expand All @@ -24,15 +24,15 @@


class FmsDecoder:
"""!FMS decoder class
r"""!FMS decoder class
This class decodes FMS data.
First step is to validate the data and _check if the format is correct.
In the last step a valid BOSWatch packet is created and returned"""

@staticmethod
def decode(data):
"""!Decodes FMS
r"""!Decodes FMS
@param data: FMS for decoding
@return BOSWatch FMS packet or None"""
Expand Down
8 changes: 4 additions & 4 deletions boswatch/decoder/pocsagDecoder.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/usr/bin/python
# -*- coding: utf-8 -*-
"""!
r"""!
____ ____ ______ __ __ __ _____
/ __ )/ __ \/ ___/ | / /___ _/ /______/ /_ |__ /
/ __ / / / /\__ \| | /| / / __ `/ __/ ___/ __ \ /_ <
Expand All @@ -24,15 +24,15 @@


class PocsagDecoder:
"""!POCSAG decoder class
r"""!POCSAG decoder class
This class decodes POCSAG data.
First step is to validate the data and _check if the format is correct.
In the last step a valid BOSWatch packet is created and returned"""

@staticmethod
def decode(data):
"""!Decodes POCSAG
r"""!Decodes POCSAG
@param data: POCSAG for decoding
@return BOSWatch POCSAG packet or None"""
Expand Down Expand Up @@ -63,7 +63,7 @@ def decode(data):

@staticmethod
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
@return bitrate
Expand Down
8 changes: 4 additions & 4 deletions boswatch/decoder/zveiDecoder.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/usr/bin/python
# -*- coding: utf-8 -*-
"""!
r"""!
____ ____ ______ __ __ __ _____
/ __ )/ __ \/ ___/ | / /___ _/ /______/ /_ |__ /
/ __ / / / /\__ \| | /| / / __ `/ __/ ___/ __ \ /_ <
Expand All @@ -24,7 +24,7 @@


class ZveiDecoder:
"""!ZVEI decoder class
r"""!ZVEI decoder class
This class decodes ZVEI data.
First step is to validate the data and _check if the format is correct.
Expand All @@ -33,7 +33,7 @@ class ZveiDecoder:

@staticmethod
def decode(data):
"""!Decodes ZVEI
r"""!Decodes ZVEI
@param data: ZVEI for decoding
@return BOSWatch ZVEI packet or None"""
Expand All @@ -51,7 +51,7 @@ def decode(data):

@staticmethod
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
@return Double Tone replaced ZVEI"""
Expand Down
14 changes: 7 additions & 7 deletions boswatch/inputSource/inputBase.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/usr/bin/python
# -*- coding: utf-8 -*-
"""!
r"""!
____ ____ ______ __ __ __ _____
/ __ )/ __ \/ ___/ | / /___ _/ /______/ /_ |__ /
/ __ / / / /\__ \| | /| / / __ `/ __/ ___/ __ \ /_ <
Expand All @@ -26,10 +26,10 @@


class InputBase(ABC):
"""!Base class for handling inout sources"""
r"""!Base class for handling inout sources"""

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 inputConfig: ConfigYaml object with the inoutSource config
Expand All @@ -41,7 +41,7 @@ def __init__(self, inputQueue, inputConfig, decoderConfig):
self._decoderConfig = decoderConfig

def start(self):
"""!Start the input source thread"""
r"""!Start the input source thread"""
logging.debug("starting input thread")
self._isRunning = True
self._inputThread = threading.Thread(target=self._runThread, name="inputThread",
Expand All @@ -51,18 +51,18 @@ def start(self):

@abstractmethod
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):
"""!Stop the input source thread"""
r"""!Stop the input source thread"""
if self._isRunning:
logging.debug("wait for stopping the input thread")
self._isRunning = False
self._inputThread.join()
logging.debug("input thread stopped")

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)
if bwPacket is not None:
self._inputQueue.put_nowait((bwPacket, time.time()))
Expand Down
4 changes: 2 additions & 2 deletions boswatch/inputSource/lineInInput.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/usr/bin/python
# -*- coding: utf-8 -*-
"""!
r"""!
____ ____ ______ __ __ __ _____
/ __ )/ __ \/ ___/ | / /___ _/ /______/ /_ |__ /
/ __ / / / /\__ \| | /| / / __ `/ __/ ___/ __ \ /_ <
Expand All @@ -23,7 +23,7 @@


class LineInInput(InputBase):
"""!Class for the line-in input source"""
r"""!Class for the line-in input source"""

def _runThread(self, dataQueue, lineInConfig, decoderConfig):
lineInProc = None
Expand Down
4 changes: 2 additions & 2 deletions boswatch/inputSource/pulseaudioInput.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/usr/bin/python
# -*- coding: utf-8 -*-
"""!
r"""!
____ ____ ______ __ __ __ _____
/ __ )/ __ \/ ___/ | / /___ _/ /______/ /_ |__ /
/ __ / / / /\__ \| | /| / / __ `/ __/ ___/ __ \ /_ <
Expand All @@ -23,7 +23,7 @@


class PulseAudioInput(InputBase):
"""!Class for the PulseAudio input source"""
r"""!Class for the PulseAudio input source"""

def _runThread(self, dataQueue, PulseAudioConfig, decoderConfig):
PulseAudioProc = None
Expand Down
4 changes: 2 additions & 2 deletions boswatch/inputSource/sdrInput.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/usr/bin/python
# -*- coding: utf-8 -*-
"""!
r"""!
____ ____ ______ __ __ __ _____
/ __ )/ __ \/ ___/ | / /___ _/ /______/ /_ |__ /
/ __ / / / /\__ \| | /| / / __ `/ __/ ___/ __ \ /_ <
Expand All @@ -24,7 +24,7 @@


class SdrInput(InputBase):
"""!Class for the sdr input source"""
r"""!Class for the sdr input source"""

def _runThread(self, dataQueue, sdrConfig, decoderConfig):
sdrProc = None
Expand Down
24 changes: 12 additions & 12 deletions boswatch/network/broadcast.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/usr/bin/python
# -*- coding: utf-8 -*-
"""!
r"""!
____ ____ ______ __ __ __ _____
/ __ )/ __ \/ ___/ | / /___ _/ /______/ /_ |__ /
/ __ / / / /\__ \| | /| / / __ `/ __/ ___/ __ \ /_ <
Expand All @@ -22,10 +22,10 @@


class BroadcastClient:
"""!BroadcastClient class"""
r"""!BroadcastClient class"""

def __init__(self, port=5000):
"""!Create an BroadcastClient instance
r"""!Create an BroadcastClient instance
@param port: port to send broadcast packets (5000)"""
self._broadcastPort = port
Expand All @@ -39,7 +39,7 @@ def __init__(self, port=5000):
self._socket.settimeout(3)

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)
to get connection info from the server.
Expand Down Expand Up @@ -73,20 +73,20 @@ def getConnInfo(self, retry=0):

@property
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

@property
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


class BroadcastServer:
"""!BroadcastServer class"""
r"""!BroadcastServer class"""

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 listenPort: port to listen for broadcast packets (5000)"""
Expand All @@ -106,7 +106,7 @@ def __del__(self): # pragma: no cover
pass

def start(self):
"""!Start the broadcast server in a new thread
r"""!Start the broadcast server in a new thread
@return True or False"""
if not self.isRunning:
Expand All @@ -121,7 +121,7 @@ def start(self):
return True

def stop(self):
"""!Stop the broadcast server
r"""!Stop the broadcast server
Due to the timeout of the socket,
stopping the thread can be delayed by two seconds.
Expand All @@ -138,7 +138,7 @@ def stop(self):
return True

def _listen(self):
"""!Broadcast server worker thread
r"""!Broadcast server worker thread
This function listen for magic packets on broadcast
address and send the connection info to the clients.
Expand All @@ -161,7 +161,7 @@ def _listen(self):

@property
def isRunning(self):
"""!Property of broadcast server running state"""
r"""!Property of broadcast server running state"""
if self._serverThread:
return True
return False
Loading

0 comments on commit b7ba7f8

Please sign in to comment.