from typing import Callable
import time


def timer(function: Callable) -> object:
    """计时函数 - 执行之后显示执行时间"""

    def wrapper(*arg, **kwargs):
        """参数接收器"""
        # 计时并执行函数
        start = time.time()
        result = function(*arg, **kwargs)
        end = time.time()

        # 显示时间
        used = (end - start) * 1000
        print("-> elapsed time: %.2f ms" % used)
        return result

    return wrapper