moved utils --> libs

This commit is contained in:
2024-01-11 19:35:04 -06:00
parent 7e9dd31d01
commit 1876ba3fd0
24 changed files with 17 additions and 17 deletions

24
src/libs/singleton.py Normal file
View File

@@ -0,0 +1,24 @@
# Python imports
# Lib imports
# Application imports
class SingletonError(Exception):
pass
class Singleton:
ccount = 0
def __new__(cls, *args, **kwargs):
obj = super(Singleton, cls).__new__(cls)
cls.ccount += 1
if cls.ccount == 2:
raise SingletonError(f"Exceeded {cls.__name__} instantiation limit...")
return obj