mirror of
https://github.com/Bw3ll/ShellWasp
synced 2026-06-08 10:31:49 +00:00
18 lines
453 B
Python
18 lines
453 B
Python
from abc import ABCMeta
|
|
from typing import Any
|
|
|
|
|
|
class Singleton(ABCMeta):
|
|
"""
|
|
|
|
This class is a standard implementation of the Single Pattern
|
|
(Note: Has not been tested for Thread Saftey)
|
|
|
|
"""
|
|
|
|
_instances = {}
|
|
|
|
def __call__(cls, *args, **kwargs) -> Any:
|
|
if cls not in cls._instances:
|
|
cls._instances[cls] = super(Singleton, cls).__call__(*args, **kwargs)
|
|
return cls._instances[cls] |