snipy/decotool.py
def deco_optional(decorator):
    """
    optional argument 를 포함하는 decorator를 만드는 decorator
    """

    @functools.wraps(decorator)
    def dispatcher(*args, **kwargs):
        one_arg = len(args) == 1 and not kwargs
        if one_arg and inspect.isfunction(args[0]):
            decor_obj = decorator()
            return decor_obj(args[0])
        else:
            return decorator(*args, **kwargs)

    return dispatcher
def deco_optional(decorator):
    """
    optional argument 를 포함하는 decorator를 만드는 decorator
    """

    @functools.wraps(decorator)
    def dispatcher(*args, **kwargs):
        one_arg = len(args) == 1 and not kwargs
        if one_arg and inspect.isfunction(args[0]):
            decor_obj = decorator()
            return decor_obj(args[0])
        else:
            return decorator(*args, **kwargs)

    return dispatcher
optional argument 를 포함하는 decorator를 만드는 decorator