Beispiel #1
0
 def wrp_adder(*args, **kwargs):
     if DEBUG_ADDERS or VERB_CONTROL:
         print('+------')
         print('[ADD]: ' + get_funcname(func))
         funccall_str = ut.func_str(func, args, kwargs, packed=True)
         print('\n' + funccall_str + '\n')
         print('L------')
     if VERB_CONTROL:
         print('[ADD]: ' + get_funcname(func))
         builtins.print('\n' + ut.func_str(func, args, kwargs) + '\n')
     return func_(*args, **kwargs)
Beispiel #2
0
 def wrp_adder(*args, **kwargs):
     if DEBUG_ADDERS or VERB_CONTROL:
         print("+------")
         print("[ADD]: " + get_funcname(func))
         funccall_str = ut.func_str(func, args, kwargs, packed=True)
         print("\n" + funccall_str + "\n")
         print("L------")
     if VERB_CONTROL:
         print("[ADD]: " + get_funcname(func))
         builtins.print("\n" + ut.func_str(func, args, kwargs) + "\n")
     return func_(*args, **kwargs)
Beispiel #3
0
 def wrp_adder(*args, **kwargs):
     if DEBUG_ADDERS or VERB_CONTROL:
         print('+------')
         print('[ADD]: ' + get_funcname(func))
         funccall_str = ut.func_str(func, args, kwargs, packed=True)
         print('\n' + funccall_str + '\n')
         print('L------')
     if VERB_CONTROL:
         print('[ADD]: ' + get_funcname(func))
         builtins.print('\n' + ut.func_str(func, args, kwargs) + '\n')
     return func_(*args, **kwargs)
Beispiel #4
0
 def wrp_setter(*args, **kwargs):
     if not utool.QUIET and utool.VERBOSE:
         print('[SET]: ' + func.func_name)
         import __builtin__
         __builtin__.print('\n' + utool.func_str(func, args, kwargs) + '\n')
     #print('set: func_name=%r, args=%r, kwargs=%r' % (func.func_name, args, kwargs))
     return func(*args, **kwargs)
Beispiel #5
0
 def wrp_getter(*args, **kwargs):
     #if ut.DEBUG:
     #    print('[IN GETTER] args=%r' % (args,))
     #    print('[IN GETTER] kwargs=%r' % (kwargs,))
     if DEBUG_GETTERS  or VERB_CONTROL:
         print('+------')
         print('[GET]: ' + get_funcname(func))
         funccall_str = ut.func_str(func, args, kwargs, packed=True)
         print('\n' + funccall_str + '\n')
         print('L------')
     return func_(*args, **kwargs)
Beispiel #6
0
 def wrp_getter(*args, **kwargs):
     # if ut.DEBUG:
     #    print('[IN GETTER] args=%r' % (args,))
     #    print('[IN GETTER] kwargs=%r' % (kwargs,))
     if DEBUG_GETTERS or VERB_CONTROL:
         print("+------")
         print("[GET]: " + get_funcname(func))
         funccall_str = ut.func_str(func, args, kwargs, packed=True)
         print("\n" + funccall_str + "\n")
         print("L------")
     return func_(*args, **kwargs)
Beispiel #7
0
 def wrp_setter(*args, **kwargs):
     if DEBUG_SETTERS or VERB_CONTROL:
         print('+------')
         print('[SET]: ' + get_funcname(func))
         print('[SET]: called by: ' + ut.get_caller_name(range(1, 7)))
         funccall_str = ut.func_str(func, args, kwargs, packed=True)
         print('\n' + funccall_str + '\n')
         print('L------')
         #builtins.print('\n' + funccall_str + '\n')
     #print('set: funcname=%r, args=%r, kwargs=%r' % (get_funcname(func), args, kwargs))
     return func_(*args, **kwargs)
Beispiel #8
0
 def wrp_setter(*args, **kwargs):
     if DEBUG_SETTERS or VERB_CONTROL:
         print("+------")
         print("[SET]: " + get_funcname(func))
         print("[SET]: called by: " + ut.get_caller_name(range(1, 7)))
         funccall_str = ut.func_str(func, args, kwargs, packed=True)
         print("\n" + funccall_str + "\n")
         print("L------")
         # builtins.print('\n' + funccall_str + '\n')
     # print('set: funcname=%r, args=%r, kwargs=%r' % (get_funcname(func), args, kwargs))
     return func_(*args, **kwargs)
Beispiel #9
0
def process_args(r, argv):
    args = tuple()
    if len(argv) > 0:
        cmd_name = argv[0]
        if len(argv) == 1:
            if cmd_name == 'help':
                cmd_name = 'info'
            # cmd = cmd_name + '(r)'
        else:
            args = argv[1:]
            # if cmd_name == 'write_research':
            #     print("WRITING RESEARCH")
            #     arg_str = ',"' + (' '.join(args)).replace('"', '').replace('\'', '') + '"'
            #     print(arg_str)
            # elif cmd_name == 'speak':
            #     rate_of_speach = -5
            #     if is_string_int(args[-1]):
            #         rate_of_speach = int(args[-1])
            #         args[-1] = ''

            #     arg_str = "," + ens(' '.join(args), '"') + "," + str(rate_of_speach)
            #     #arg_str = arg_str + ', -5'
            # else:
            #     arg_str = ''
            #     for a in args:
            #         arg_str = arg_str + ', \'' + a + '\''
            #     #arg_str = ','.join(args)
            # cmd = cmd_name + '(r' + arg_str + ' )'

        class dummy_r(object):
            def __repr__(self):
                return 'r'

        func = getattr(rob_interface, cmd_name)
        import utool as ut
        print('R.O.B. is evaling: ')
        print('    ' + ut.func_str(func, (dummy_r(), ) + tuple(args)))
        print("__________________________________")
        print()

        ret = func(r, *args)
        # py_command = 'rob_interface.' + cmd
        # print('py_command = %r' % (py_command,))
        # ret = eval(py_command)
        if ret is not None:
            print(ret)
Beispiel #10
0
def translate_ibeis_webcall(func, *args, **kwargs):
    r"""
    Called from flask request context

    Args:
        func (function):  live python function

    Returns:
        tuple: (output, True, 200, None, jQuery_callback)

    CommandLine:
        python -m ibeis.control.controller_inject --exec-translate_ibeis_webcall
        python -m ibeis.control.controller_inject --exec-translate_ibeis_webcall --domain http://52.33.105.88

    Example:
        >>> # xdoctest: +REQUIRES(--web)
        >>> from ibeis.control.controller_inject import *  # NOQA
        >>> import ibeis
        >>> import time
        >>> import ibeis.web
        >>> web_ibs = ibeis.opendb_bg_web('testdb1', wait=1, start_job_queue=False)
        >>> aids = web_ibs.send_ibeis_request('/api/annot/', 'get')
        >>> uuid_list = web_ibs.send_ibeis_request('/api/annot/uuids/', aid_list=aids)
        >>> failrsp = web_ibs.send_ibeis_request('/api/annot/uuids/')
        >>> failrsp2 = web_ibs.send_ibeis_request('/api/query/chips/simple_dict//', 'get', qaid_list=[0], daid_list=[0])
        >>> log_text = web_ibs.send_ibeis_request('/api/query/chips/simple_dict/', 'get', qaid_list=[0], daid_list=[0])
        >>> time.sleep(.1)
        >>> print('\n---\nuuid_list = %r' % (uuid_list,))
        >>> print('\n---\nfailrsp =\n%s' % (failrsp,))
        >>> print('\n---\nfailrsp2 =\n%s' % (failrsp2,))
        >>> print('Finished test')
        >>> web_ibs.terminate2()

    Ignore:
        app = get_flask_app()
        with app.app_context():
            #ibs = ibeis.opendb('testdb1')
            func = ibs.get_annot_uuids
            args = tuple()
            kwargs = dict()
    """
    print('Calling: %r with args: %r and kwargs: %r' % (func, args, kwargs, ))
    ibs = flask.current_app.ibs
    funcstr = ut.func_str(func, (ibs,) + args, kwargs=kwargs, truncate=True)
    print('[TRANSLATE] Calling: %s' % (funcstr,))
    assert len(args) == 0, 'There should not be any args=%r' % (args,)

    try:
        # TODO, have better way to differentiate ibs funcs from other funcs
        output = func(**kwargs)
    except TypeError:
        try:
            output = func(ibs=ibs, **kwargs)
        except WebException:
            raise
        except Exception as ex2:
            msg_list = []
            msg_list.append('Error in translate_ibeis_webcall')
            msg_list.append('Expected Function Definition: ' + ut.func_defsig(func))
            msg_list.append('Received Function Definition: %s' % (funcstr,))
            msg_list.append('kwargs = %r' % (kwargs,))
            msg_list.append('args = %r' % (args,))
            msg_list.append('flask.request.args = %r' % (flask.request.args,))
            msg_list.append('flask.request.form = %r' % (flask.request.form,))
            msg = '\n'.join(msg_list)
            error_msg = ut.formatex(ex2, msg, tb=True)
            print(error_msg)
            # error_msg = ut.strip_ansi(error_msg)
            raise Exception(error_msg)
            #raise
    resp_tup = (output, True, 200, None)
    return resp_tup
Beispiel #11
0
def translate_ibeis_webcall(func, *args, **kwargs):
    r"""
    Called from flask request context

    Args:
        func (function):  live python function

    Returns:
        tuple: (output, True, 200, None, jQuery_callback)

    CommandLine:
        python -m ibeis.control.controller_inject --exec-translate_ibeis_webcall
        python -m ibeis.control.controller_inject --exec-translate_ibeis_webcall --domain http://52.33.105.88

    Example:
        >>> # WEB_DOCTEST
        >>> from ibeis.control.controller_inject import *  # NOQA
        >>> import ibeis
        >>> import time
        >>> import ibeis.web
        >>> web_ibs = ibeis.opendb_bg_web('testdb1', wait=1, start_job_queue=False)
        >>> aids = web_ibs.send_ibeis_request('/api/annot/', 'get')
        >>> uuid_list = web_ibs.send_ibeis_request('/api/annot/uuids/', aid_list=aids)
        >>> failrsp = web_ibs.send_ibeis_request('/api/annot/uuids/')
        >>> failrsp2 = web_ibs.send_ibeis_request('/api/query/chips/simple_dict//', 'get', qaid_list=[0], daid_list=[0])
        >>> log_text = web_ibs.send_ibeis_request('/api/query/chips/simple_dict/', 'get', qaid_list=[0], daid_list=[0])
        >>> time.sleep(.1)
        >>> print('\n---\nuuid_list = %r' % (uuid_list,))
        >>> print('\n---\nfailrsp =\n%s' % (failrsp,))
        >>> print('\n---\nfailrsp2 =\n%s' % (failrsp2,))
        >>> print('Finished test')
        >>> web_ibs.terminate2()

    Ignore:
        app = get_flask_app()
        with app.app_context():
            #ibs = ibeis.opendb('testdb1')
            func = ibs.get_annot_uuids
            args = tuple()
            kwargs = dict()
    """
    #print('Calling: %r with args: %r and kwargs: %r' % (func, args, kwargs, ))
    ibs = flask.current_app.ibs
    funcstr = ut.func_str(func, (ibs,) + args, kwargs=kwargs, truncate=True)
    print('[TRANSLATE] Calling: %s' % (funcstr,))
    assert len(args) == 0, 'There should not be any args=%r' % (args,)

    try:
        # TODO, have better way to differentiate ibs funcs from other funcs
        output = func(**kwargs)
    except TypeError:
        try:
            output = func(ibs=ibs, **kwargs)
        except WebException:
            raise
        except Exception as ex2:
            msg_list = []
            msg_list.append('Error in translate_ibeis_webcall')
            msg_list.append('Expected Function Definition: ' + ut.func_defsig(func))
            msg_list.append('Received Function Definition: %s' % (funcstr,))
            msg_list.append('kwargs = %r' % (kwargs,))
            msg_list.append('args = %r' % (args,))
            msg_list.append('flask.request.args = %r' % (flask.request.args,))
            msg_list.append('flask.request.form = %r' % (flask.request.form,))
            msg = '\n'.join(msg_list)
            error_msg = ut.formatex(ex2, msg, tb=True)
            print(error_msg)
            # error_msg = ut.strip_ansi(error_msg)
            raise Exception(error_msg)
            #raise
    resp_tup = (output, True, 200, None)
    return resp_tup
Beispiel #12
0
 def func_wrapper(*args_, **kwargs_):
     # if ut.VERBOSE:
     # if ut.QUIET:
     logger.info('[DEVPRECMD] ' + ut.func_str(func, args_, kwargs_))
     return func(*args_, **kwargs_)
Beispiel #13
0
 def wrp_deleter(*args, **kwargs):
     if VERB_CONTROL:
         print("[DELETE]: " + get_funcname(func))
         builtins.print("\n" + ut.func_str(func, args, kwargs) + "\n")
     return func_(*args, **kwargs)
Beispiel #14
0
def translate_ibeis_webcall(func, *args, **kwargs):
    r"""
    Called from flask request context

    Args:
        func (function):  live python function

    Returns:
        tuple: (output, True, 200, None, jQuery_callback)

    CommandLine:
        python -m ibeis.control.controller_inject --exec-translate_ibeis_webcall
        python -m ibeis.control.controller_inject --exec-translate_ibeis_webcall --domain http://52.33.105.88

    Example:
        >>> # WEB_DOCTEST
        >>> from ibeis.control.controller_inject import *  # NOQA
        >>> import ibeis
        >>> import time
        >>> import ibeis.web
        >>> web_ibs = ibeis.opendb_bg_web('testdb1', wait=1, start_job_queue=False)
        >>> aids = web_ibs.send_ibeis_request('/api/annot/', 'get')
        >>> uuid_list = web_ibs.send_ibeis_request('/api/annot/uuids/', aid_list=aids)
        >>> failrsp = web_ibs.send_ibeis_request('/api/annot/uuids/')
        >>> failrsp2 = web_ibs.send_ibeis_request('/api/query/chips/simple_dict//', 'get', qaid_list=[0], daid_list=[0])
        >>> log_text = web_ibs.send_ibeis_request('/api/query/chips/simple_dict/', 'get', qaid_list=[0], daid_list=[0])
        >>> time.sleep(.1)
        >>> print('\n---\nuuid_list = %r' % (uuid_list,))
        >>> print('\n---\nfailrsp =\n%s' % (failrsp,))
        >>> print('\n---\nfailrsp2 =\n%s' % (failrsp2,))
        >>> print('Finished test')
        >>> web_ibs.terminate2()

    Ignore:
        app = get_flask_app()
        with app.app_context():
            #ibs = ibeis.opendb('testdb1')
            func = ibs.get_annot_uuids
            args = tuple()
            kwargs = dict()
    """
    assert len(args) == 0, 'There should not be any args=%r' % (args, )

    # print('Calling: %r with args: %r and kwargs: %r' % (func, args, kwargs, ))
    ibs = flask.current_app.ibs
    funcstr = ut.func_str(func, (ibs, ) + args, kwargs=kwargs, truncate=True)
    print('[TRANSLATE] Calling: %s' % (funcstr, ))

    try:
        key_list = sorted(list(kwargs.keys()))
        type_list = []
        message_list = []

        for key in key_list:
            try:
                values = kwargs[key]
                type_ = type(values).__name__
                if type_ == 'list':
                    if len(values) == 0:
                        type_ = 'empty list'
                        message_ = '[]'
                    else:
                        value = values[0]
                        type_ += ' of ' + type(value).__name__
                        length1 = len(values)
                        try:
                            length2 = len(set(values))
                        except TypeError:
                            length2 = len(set(map(str, values)))
                        length3 = min(length1, 3)
                        mod = '...' if length1 != length3 else ''
                        message_ = 'length %d with unique %d of %s%s' % (
                            length1,
                            length2,
                            values[:length3],
                            mod,
                        )
                else:
                    message_ = '%s' % (values, )
            except:
                type_ = 'UNKNOWN'
                message_ = 'ERROR IN PARSING'

            type_list.append(type_)
            message_list.append(message_)

        zipped = list(zip(key_list, type_list, message_list))

        if len(zipped) > 0:
            length1 = max(list(map(len, key_list)))
            length2 = max(list(map(len, type_list)))

            for key_, type_, message_ in zipped:
                key_ = key_.rjust(length1)
                type_ = type_.ljust(length2)
                try:
                    print('[TRANSLATE] \t %s (%s) : %s' % (
                        key_,
                        type_,
                        message_,
                    ))
                except UnicodeEncodeError:
                    print('[TRANSLATE] \t %s (%s) : UNICODE ERROR')
    except:
        print('[TRANSLATE] ERROR IN KWARGS PARSING')

    try:
        # TODO, have better way to differentiate ibs funcs from other funcs
        output = func(**kwargs)
    except TypeError:
        try:
            output = func(ibs=ibs, **kwargs)
        except WebException:
            raise
        except Exception as ex2:  # NOQA
            if MICROSOFT_API_ENABLED:
                if isinstance(ex2,
                              TypeError) and 'required positional' in str(ex2):
                    parameter = str(ex2).split(':')[1].strip().strip('\'')
                    raise WebMissingInput('Missing required parameter',
                                          parameter)
                elif isinstance(ex2, WebException):
                    raise
                else:
                    raise WebRuntimeException(
                        'An unknown error has occurred, please contact the API administrator at [email protected].'
                    )
            else:
                msg_list = []
                # msg_list.append('Error in translate_ibeis_webcall')
                msg_list.append('Expected Function Definition: ' +
                                ut.func_defsig(func))
                msg_list.append('Received Function Definition: %s' %
                                (funcstr, ))
                msg_list.append('Received Function Parameters:')
                for key in kwargs:
                    value = kwargs[key]
                    value_str = '%r' % (value, )
                    value_str = ut.truncate_str(value_str, maxlen=256)
                    msg_list.append('\t%r: %s' % (
                        key,
                        value_str,
                    ))
                # msg_list.append('\targs = %r' % (args,))
                # msg_list.append('flask.request.args = %r' % (flask.request.args,))
                # msg_list.append('flask.request.form = %r' % (flask.request.form,))
                msg_list.append('%s: %s' % (
                    type(ex2).__name__,
                    ex2,
                ))
                if WEB_DEBUG_INCLUDE_TRACE:
                    trace = str(traceback.format_exc())
                    msg_list.append(trace)
                msg = '\n'.join(msg_list)
            print(msg)
            # error_msg = ut.formatex(ex2, msg, tb=True)
            # print(error_msg)
            # error_msg = ut.strip_ansi(error_msg)
            # raise Exception(error_msg)
            raise Exception(msg)
            #raise
    resp_tup = (output, True, 200, None)
    return resp_tup
Beispiel #15
0
 def wrp_deleter(*args, **kwargs):
     if VERB_CONTROL:
         print('[DELETE]: ' + get_funcname(func))
         builtins.print('\n' + ut.func_str(func, args, kwargs) + '\n')
     return func_(*args, **kwargs)
Beispiel #16
0
 def func_wrapper(*args_, **kwargs_):
     #if ut.VERBOSE:
     #if ut.QUIET:
     print('[DEVPRECMD] ' + ut.func_str(func, args_, kwargs_))
     return func(*args_, **kwargs_)
Beispiel #17
0
 def wrp_deleter(*args, **kwargs):
     if VERB_CONTROL:
         print('[DELETE]: ' + get_funcname(func))
         builtins.print('\n' + ut.func_str(func, args, kwargs) + '\n')
     return func_(*args, **kwargs)
Beispiel #18
0
 def wrp_adder(*args, **kwargs):
     if not utool.QUIET and utool.VERBOSE:
         print('[DELETE]: ' + func.func_name)
         import __builtin__
         __builtin__.print('\n' + utool.func_str(func, args, kwargs) + '\n')
     return func(*args, **kwargs)
Beispiel #19
0
 def func_wrapper(*args_, **kwargs_):
     #if ut.VERBOSE:
     #if ut.QUIET:
     print('[DEVCMD] ' + ut.func_str(func, args_, kwargs_))
     return func(*args_, **kwargs_)
def make_aidpair_tag_context_options(ibs, aid1, aid2):
    from wbia import tag_funcs

    annotmatch_rowid = ibs.get_annotmatch_rowid_from_undirected_superkey(
        [aid1], [aid2])[0]

    if annotmatch_rowid is None:
        tags = []
    else:
        tags = ibs.get_annotmatch_case_tags([annotmatch_rowid])[0]
        tags = [_.lower() for _ in tags]
    standard, other = tag_funcs.get_cate_categories()
    case_list = standard + other

    # used_chars = gt.find_used_chars(ut.get_list_column(options, 0))
    used_chars = []
    case_hotlink_list = gt.make_word_hotlinks(case_list, used_chars)
    pair_tag_options = []
    if True or ut.VERBOSE:
        logger.info('[inspect_gui] aid1, aid2 = %r, %r' % (
            aid1,
            aid2,
        ))
        logger.info('[inspect_gui] annotmatch_rowid = %r' %
                    (annotmatch_rowid, ))
        logger.info('[inspect_gui] tags = %r' % (tags, ))
    if ut.VERBOSE:
        logger.info('[inspect_gui] Making case hotlist: ' +
                    ut.repr2(case_hotlink_list))

    def _wrap_set_annotmatch_prop(prop, toggle_val):
        if ut.VERBOSE:
            logger.info('[SETTING] Clicked set prop=%r to val=%r' % (
                prop,
                toggle_val,
            ))
        am_rowid = ibs.add_annotmatch_undirected([aid1], [aid2])[0]
        if ut.VERBOSE:
            logger.info('[SETTING] aid1, aid2 = %r, %r' % (
                aid1,
                aid2,
            ))
            logger.info('[SETTING] annotmatch_rowid = %r' % (am_rowid, ))
        ibs.set_annotmatch_prop(prop, [am_rowid], [toggle_val])
        if ut.VERBOSE:
            logger.info('[SETTING] done')
        if True:
            # hack for reporting
            if annotmatch_rowid is None:
                tags = []
            else:
                tags = ibs.get_annotmatch_case_tags([annotmatch_rowid])[0]
                tags = [_.lower() for _ in tags]
            logger.info('[inspect_gui] aid1, aid2 = %r, %r' % (
                aid1,
                aid2,
            ))
            logger.info('[inspect_gui] annotmatch_rowid = %r' %
                        (annotmatch_rowid, ))
            logger.info('[inspect_gui] tags = %r' % (tags, ))

    for case, case_hotlink in zip(case_list, case_hotlink_list):
        toggle_val = case.lower() not in tags
        fmtstr = 'Flag %s case' if toggle_val else 'Unflag %s case'
        pair_tag_options += [
            # (fmtstr % (case_hotlink,), lambda:
            # ibs.set_annotmatch_prop(case, _get_annotmatch_rowid(),
            #                        [toggle_val])),
            # (fmtstr % (case_hotlink,), partial(ibs.set_annotmatch_prop,
            # case, [annotmatch_rowid], [toggle_val])),
            (
                fmtstr % (case_hotlink, ),
                partial(_wrap_set_annotmatch_prop, case, toggle_val),
            ),
        ]
    if ut.VERBOSE:
        logger.info('Partial tag funcs:' + ut.repr2([
            ut.func_str(func, func.args, func.keywords)
            for func in ut.get_list_column(pair_tag_options, 1)
        ]))
    return pair_tag_options
Beispiel #21
0
def translate_wbia_webcall(func, *args, **kwargs):
    r"""
    Called from flask request context

    Args:
        func (function):  live python function

    Returns:
        tuple: (output, True, 200, None, jQuery_callback)

    Example:
        >>> # xdoctest: +REQUIRES(--web-tests)
        >>> from wbia.control.controller_inject import *  # NOQA
        >>> import wbia
        >>> with wbia.opendb_with_web('testdb1') as (ibs, client):
        ...     aids = client.get('/api/annot/').json
        ...     failrsp = client.post('/api/annot/uuids/')
        ...     failrsp2 = client.get('/api/query/chips/simple_dict//', data={'qaid_list': [0], 'daid_list': [0]})
        ...     log_text = client.get('/api/query/chips/simple_dict/', data={'qaid_list': [0], 'daid_list': [0]})
        >>> print('\n---\nfailrsp =\n%s' % (failrsp.data,))
        >>> print('\n---\nfailrsp2 =\n%s' % (failrsp2.data,))
        >>> print('Finished test')
        Finished test

    """
    assert len(args) == 0, 'There should not be any args=%r' % (args,)

    # logger.info('Calling: %r with args: %r and kwargs: %r' % (func, args, kwargs, ))
    ibs = flask.current_app.ibs
    funcstr = ut.func_str(func, (ibs,) + args, kwargs=kwargs, truncate=True)
    if 'heartbeat' in funcstr:
        pass
    elif 'metrics' in funcstr:
        pass
    else:
        logger.info('[TRANSLATE] Calling: %s' % (funcstr,))

    try:
        key_list = sorted(list(kwargs.keys()))
        type_list = []
        message_list = []

        for key in key_list:
            try:
                values = kwargs[key]
                type_ = type(values).__name__
                if type_ == 'list':
                    if len(values) == 0:
                        type_ = 'empty list'
                        message_ = '[]'
                    else:
                        value = values[0]
                        type_ += ' of ' + type(value).__name__
                        length1 = len(values)
                        try:
                            length2 = len(set(values))
                        except TypeError:
                            length2 = len(set(map(str, values)))
                        length3 = min(length1, 3)
                        mod = '...' if length1 != length3 else ''
                        message_ = 'length %d with unique %d of %s%s' % (
                            length1,
                            length2,
                            values[:length3],
                            mod,
                        )
                else:
                    message_ = '%s' % (values,)
            except Exception:
                type_ = 'UNKNOWN'
                message_ = 'ERROR IN PARSING'

            type_list.append(type_)
            message_list.append(message_)

        zipped = list(zip(key_list, type_list, message_list))

        if len(zipped) > 0:
            length1 = max(list(map(len, key_list)))
            length2 = max(list(map(len, type_list)))

            for key_, type_, message_ in zipped:
                key_ = key_.rjust(length1)
                type_ = type_.ljust(length2)
                try:
                    logger.info('[TRANSLATE] \t %s (%s) : %s' % (key_, type_, message_))
                except UnicodeEncodeError:
                    logger.info('[TRANSLATE] \t %s (%s) : UNICODE ERROR')
    except Exception:
        logger.info('[TRANSLATE] ERROR IN KWARGS PARSING')

    try:
        # TODO, have better way to differentiate ibs funcs from other funcs
        output = func(**kwargs)
    except TypeError:
        try:
            output = func(ibs, **kwargs)
        except WebException:
            raise
        except Exception as ex2:  # NOQA
            if MICROSOFT_API_ENABLED:
                if isinstance(ex2, TypeError) and 'required positional' in str(ex2):
                    parameter = str(ex2).split(':')[1].strip().strip("'")
                    raise WebMissingInput('Missing required parameter', parameter)
                elif isinstance(ex2, WebException):
                    raise
                else:
                    raise WebRuntimeException(
                        'An unknown error has occurred, please contact the API administrator at [email protected].'
                    )
            else:
                msg_list = []
                # msg_list.append('Error in translate_wbia_webcall')
                msg_list.append('Expected Function Definition: ' + ut.func_defsig(func))
                msg_list.append('Received Function Definition: %s' % (funcstr,))
                msg_list.append('Received Function Parameters:')
                for key in kwargs:
                    value = kwargs[key]
                    value_str = '%r' % (value,)
                    value_str = ut.truncate_str(value_str, maxlen=256)
                    msg_list.append('\t%r: %s' % (key, value_str))
                # msg_list.append('\targs = %r' % (args,))
                # msg_list.append('flask.request.args = %r' % (flask.request.args,))
                # msg_list.append('flask.request.form = %r' % (flask.request.form,))
                msg_list.append('%s: %s' % (type(ex2).__name__, ex2))
                if WEB_DEBUG_INCLUDE_TRACE:
                    trace = str(traceback.format_exc())
                    msg_list.append(trace)
                msg = '\n'.join(msg_list)
            logger.info(msg)
            # error_msg = ut.formatex(ex2, msg, tb=True)
            # logger.info(error_msg)
            # error_msg = ut.strip_ansi(error_msg)
            # raise Exception(error_msg)
            raise Exception(msg)
            # raise
    resp_tup = (output, True, 200, None)
    return resp_tup