def __init__(self, protocols): self.non_global_names = { wlu.GetConstructedInterface(m) for _, _, m in wlu.AllMessages(protocols) } - {None} self.interfaces_with_listeners = { i.attrib['name'] for p, i in wlu.AllInterfaces(protocols) if wlu.NeedsListener(i) } self.counts = {}
def GetInterface(interface, context): name = interface.attrib['name'] return { 'name': name, 'idx': context.GetAndIncrementCount('interface_index'), 'is_global': name not in context.non_global_names, 'events': [GetMessage(m, context) for m in interface.findall('event')], 'requests': [GetMessage(m, context) for m in interface.findall('request')], 'has_listener': wlu.NeedsListener(interface) }