snipy/basic.py
def tuple_args(fn):
    """
    args 파싱 유틸 function
    fun(p1, p2, ...pn, **kwargs) or fun([p1, p2, ..], **kwargs)
    ex) 샘플::

        @tuple_arg
        def f(args, **kwargs):
            for d in args:
                print d
        f(1,2,3) =>  f([1,2,3])
    :param function fn:
    :return:
    """

    @wraps(fn)
    def wrapped(*args, **kwargs):

        if len(args) == 1:
            if isinstance(args[0], tuple):
                return fn(args[0], **kwargs)
            elif isinstance(args[0], list):
                return fn(tuple(args[0]), **kwargs)
        return fn(args, **kwargs)

    return wrapped
def tuple_args(fn):
    """
    args 파싱 유틸 function
    fun(p1, p2, ...pn, **kwargs) or fun([p1, p2, ..], **kwargs)
    ex) 샘플::

        @tuple_arg
        def f(args, **kwargs):
            for d in args:
                print d
        f(1,2,3) =>  f([1,2,3])
    :param function fn:
    :return:
    """

    @wraps(fn)
    def wrapped(*args, **kwargs):

        if len(args) == 1:
            if isinstance(args[0], tuple):
                return fn(args[0], **kwargs)
            elif isinstance(args[0], list):
                return fn(tuple(args[0]), **kwargs)
        return fn(args, **kwargs)

    return wrapped
def tuple_args ( fn ) : @ wraps ( fn ) def wrapped ( * args , * * kwargs ) : if len ( args ) == 1 : if isinstance ( args [ 0 ] , tuple ) : return fn ( args [ 0 ] , * * kwargs ) elif isinstance ( args [ 0 ] , list ) : return fn ( tuple ( args [ 0 ] ) , * * kwargs ) return fn ( args , * * kwargs ) return wrapped
args 파싱 유틸 function
    fun(p1, p2, ...pn, **kwargs) or fun([p1, p2, ..], **kwargs)
    ex) 샘플::

        @tuple_arg
        def f(args, **kwargs):
            for d in args:
                print d
        f(1,2,3) =>  f([1,2,3])
    :param function fn:
    :return:
args 파싱 유틸 function fun ( p1 p2 ... pn ** kwargs ) or fun ( [ p1 p2 .. ] ** kwargs ) ex ) 샘플 ::