Merge pull request #286 from PeterLaemmle/develop

Improve code style
This commit is contained in:
Bastian Schroll 2017-08-06 15:18:44 +02:00 committed by GitHub
commit 42e7de7d4c
5 changed files with 5 additions and 14 deletions

View file

@ -106,13 +106,10 @@ def getDescription(typ, data):
logging.debug("look up description lists")
try:
if typ == "FMS":
global fmsDescribtionList
resultStr = fmsDescribtionList[data]
elif typ == "ZVEI":
global zveiDescribtionList
resultStr = zveiDescribtionList[data]
elif typ == "POC":
global ricDescribtionList
resultStr = ricDescribtionList[data[:-1]] # MainRIC
resultStr += " " + ricDescribtionList[data] # SubRIC
else:

View file

@ -31,12 +31,10 @@ def checkID(typ, data, msg=""):
@return: True if check was OK
@return: False if double was found
"""
global doubleList
timestamp = int(time.time()) # Get Timestamp
logging.debug("checkID: %s (%s)", data, msg)
for i in range(len(doubleList)):
(xID, xTimestamp, xMsg) = doubleList[i]
for (xID, xTimestamp, xMsg) in doubleList:
# given ID found?
# return False if the first entry in double_ignore_time is found, we will not check for younger ones...
if data == xID and timestamp < xTimestamp + globalVars.config.getint("BOSWatch", "doubleFilter_ignore_time"):

View file

@ -39,16 +39,16 @@ takes 2 optional arguments:
self._developerkey = None
self.developerkey(developerkey)
if apikey:
if type(apikey) == str:
if isinstance(apikey, str):
apikey = [apikey]
self._apikey = uniq(apikey)
def addkey(self, key):
"Add a key (register ?)"
if type(key) == str:
if isinstance(key, str):
if not key in self._apikey:
self._apikey.append(key)
elif type(key) == list:
elif isinstance(key, list):
for k in key:
if not k in self._apikey:
self._apikey.append(k)
@ -65,7 +65,7 @@ takes 2 optional arguments:
def developerkey(self, developerkey):
"Sets the developer key (and check it has the good length)"
if type(developerkey) == str and len(developerkey) == 48:
if isinstance(developerkey, str) and len(developerkey) == 48:
self._developerkey = developerkey
def pushWithAPIKey(self, apikey=[], application="", event="", description="", url="", contenttype=None, priority=0, batch_mode=False, html=False):

View file

@ -28,7 +28,6 @@ def loadFilters():
@return: nothing
"""
global filterList
try:
logging.debug("loading filters")
# For each entry in config.ini [Filters] section

View file

@ -173,9 +173,6 @@ def run(typ,freq,data):
@return: nothing
"""
# local variables
global fmsAPIKeyList
global zveiAPIKeyList
global pocAPIKeyList
try:
try: