#!/usr/bin/env python # -*- coding: utf-8 -*- # @Time : 2023/4/12 15:09 # @Author : old tom # @File : fu_function.py # @Project : futool-tiny-datahub # @Desc : def singleton(cls): """ 单例装饰器 :param cls: :return: """ _instance = {} def inner(*args, **kwargs): if cls not in _instance: _instance[cls] = cls(*args, **kwargs) return _instance[cls] return inner