mirror of
https://github.com/Schrolli91/BOSWatch.git
synced 2026-04-04 14:07:25 +00:00
reduce entries in globals.py
only entries for use in more than one .py-file have to stay here...
This commit is contained in:
parent
e26fc45313
commit
02efb9552a
4 changed files with 45 additions and 37 deletions
|
|
@ -1,5 +1,5 @@
|
|||
#!/usr/bin/python
|
||||
# -*- coding: UTF-8 -*-
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
"""
|
||||
Function to expand the dataset with a description.
|
||||
|
|
@ -10,13 +10,18 @@ Function to expand the dataset with a description.
|
|||
"""
|
||||
|
||||
import logging # Global logger
|
||||
|
||||
import csv # for loading the description files
|
||||
|
||||
from includes import globals # Global variables
|
||||
from includes.helper import stringConverter
|
||||
|
||||
|
||||
# local variables
|
||||
fmsDescribtionList = {}
|
||||
zveiDescribtionList = {}
|
||||
ricDescribtionList = {}
|
||||
|
||||
|
||||
##
|
||||
#
|
||||
# Local function will load the csv-file
|
||||
|
|
@ -67,15 +72,18 @@ def loadDescriptionLists():
|
|||
|
||||
if globals.config.getint("FMS", "idDescribed"):
|
||||
logging.debug("- load FMS description list")
|
||||
globals.fmsDescribtionList = loadCSV("fms", "fms")
|
||||
global fmsDescribtionList
|
||||
fmsDescribtionList = loadCSV("fms", "fms")
|
||||
|
||||
if globals.config.getint("ZVEI", "idDescribed"):
|
||||
logging.debug("- load ZVEI description list")
|
||||
globals.zveiDescribtionList = loadCSV("zvei", "zvei")
|
||||
global zveiDescribtionList
|
||||
zveiDescribtionList = loadCSV("zvei", "zvei")
|
||||
|
||||
if globals.config.getint("POC", "idDescribed"):
|
||||
logging.debug("- load pocsag description list")
|
||||
globals.ricDescribtionList = loadCSV("poc", "ric")
|
||||
global ricDescribtionList
|
||||
ricDescribtionList = loadCSV("poc", "ric")
|
||||
|
||||
except:
|
||||
logging.error("cannot load description lists")
|
||||
|
|
@ -98,11 +106,14 @@ def getDescription(typ, id):
|
|||
logging.debug("look up description lists")
|
||||
try:
|
||||
if typ == "FMS":
|
||||
resultStr = globals.fmsDescribtionList[id]
|
||||
global fmsDescribtionList
|
||||
resultStr = fmsDescribtionList[id]
|
||||
elif typ == "ZVEI":
|
||||
resultStr = globals.zveiDescribtionList[id]
|
||||
global zveiDescribtionList
|
||||
resultStr = zveiDescribtionList[id]
|
||||
elif typ == "POC":
|
||||
resultStr = globals.ricDescribtionList[id]
|
||||
global ricDescribtionList
|
||||
resultStr = ricDescribtionList[id]
|
||||
else:
|
||||
logging.warning("Invalid Typ: %s", typ)
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue