mirror of
https://github.com/SeedSigner/seedsigner.git
synced 2026-10-05 15:08:25 +00:00
14 lines
441 B
Python
14 lines
441 B
Python
class Singleton:
|
|
_instance = None
|
|
|
|
def __init__(self):
|
|
# Singleton pattern must prevent normal instantiation
|
|
raise Exception("Cannot directly instantiate a Singleton. Access via get_instance()")
|
|
|
|
@classmethod
|
|
def get_instance(cls):
|
|
# This is the only way to access the one and only Controller
|
|
if cls._instance is None:
|
|
cls._instance = cls.__new__(cls)
|
|
return cls._instance
|