Import the main module properly and fix some oddities in Twisted to prevent it from discarding some data

This commit is contained in:
2018-03-14 20:13:40 +00:00
parent 5b1e3c6fb1
commit d168d69732
33 changed files with 370 additions and 318 deletions

View File

@@ -1,29 +1,29 @@
from core.main import *
import main
def event(name, eventType):
if not "local" in counters.keys():
counters["local"] = {}
if not "global" in counters.keys():
counters["global"] = {}
if not name in counters["local"].keys():
counters["local"][name] = {}
if eventType not in counters["local"][name].keys():
counters["local"][name][eventType] = 0
if not "local" in main.counters.keys():
main.counters["local"] = {}
if not "global" in main.counters.keys():
main.counters["global"] = {}
if not name in main.counters["local"].keys():
main.counters["local"][name] = {}
if eventType not in main.counters["local"][name].keys():
main.counters["local"][name][eventType] = 0
if eventType not in counters["global"]:
counters["global"][eventType] = 0
if eventType not in main.counters["global"]:
main.counters["global"][eventType] = 0
counters["local"][name][eventType] += 1
counters["global"][eventType] += 1
main.counters["local"][name][eventType] += 1
main.counters["global"][eventType] += 1
def getEvents(name=None):
if name == None:
if "global" in counters.keys():
return counters["global"]
if "global" in main.counters.keys():
return main.counters["global"]
else:
return None
else:
if name in counters["local"].keys():
return counters["local"][name]
if name in main.counters["local"].keys():
return main.counters["local"][name]
else:
return None