def on_event(self, event: events.KeywordQueryEvent, extension: Extension):
    arg = (event.get_argument() or '')
    value = re.split('\\s+', arg)[0]
    kw = event.get_keyword()
    if (kw == extension.preferences['kw_hex']):
        num = Number.parse(value, Hexadecimal())
        encodings = [Decimal(), Binary()]
    elif (kw == extension.preferences['kw_bin']):
        num = Number.parse(value, Binary())
        encodings = [Decimal(), Hexadecimal()]
    elif (kw == extension.preferences['kw_dec']):
        num = Number.parse(value, Decimal())
        encodings = [Hexadecimal(), Binary()]
    else:
        raise RuntimeError()
    if isinstance(num, ExtensionResultItem):
        items = [num]
    else:
        items = list(map((lambda enc: num.result_item(enc)), encodings))
    return RenderResultListAction(items)
def on_event(self, event: events.KeywordQueryEvent, extension: Extension):
    arg = (event.get_argument() or )
    value = re.split('\\s+', arg)[0]
    kw = event.get_keyword()
    if (kw == extension.preferences['kw_hex']):
        num = Number.parse(value, Hexadecimal())
        encodings = [Decimal(), Binary()]
    elif (kw == extension.preferences['kw_bin']):
        num = Number.parse(value, Binary())
        encodings = [Decimal(), Hexadecimal()]
    elif (kw == extension.preferences['kw_dec']):
        num = Number.parse(value, Decimal())
        encodings = [Hexadecimal(), Binary()]
    else:
        raise RuntimeError()
    if isinstance(num, ExtensionResultItem):
        items = [num]
    else:
        items = list(map((lambda enc: num.result_item(enc)), encodings))
    return RenderResultListAction(items)