You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

30 lines
919 B
Python

import main
def event(name, eventType):
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 main.counters["global"]:
main.counters["global"][eventType] = 0
main.counters["local"][name][eventType] += 1
main.counters["global"][eventType] += 1
def getEvents(name=None):
if name == None:
if "global" in main.counters.keys():
return main.counters["global"]
else:
return None
else:
if name in main.counters["local"].keys():
return main.counters["local"][name]
else:
return None