Skip to content

Commit 2b986f6

Browse files
authored
Aktualisieren von commons.py
1 parent a96423a commit 2b986f6

1 file changed

Lines changed: 1 addition & 34 deletions

File tree

scratchattach/editor/commons.py

Lines changed: 1 addition & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -269,38 +269,5 @@ def __call__(self, value=0, *args, **kwds):
269269
self.__bases__ = old_bases
270270
return result
271271

272+
Singleton = Enum
272273

273-
if TYPE_CHECKING:
274-
Singleton = Enum
275-
else:
276-
class Singleton(metaclass=SingletonMeta):
277-
278-
def __new__(cls, val=None):
279-
if cls is Singleton:
280-
raise TypeError("Singleton cannot be created directly.")
281-
if hasattr(cls, "INSTANCE"):
282-
return getattr(cls, "INSTANCE")
283-
if val == 0:
284-
return super().__new__(cls)
285-
raise TypeError("Has no instance.")
286-
287-
def __init__(self, *args, **kwds):
288-
pass
289-
290-
def __repr__(self):
291-
return self.__class__.__name__
292-
293-
def __str__(self):
294-
return self.__class__.__name__
295-
296-
def __format__(self, format_spec):
297-
return str.__format__(str(self), format_spec)
298-
299-
def __hash__(self):
300-
return hash(self.__class__)
301-
302-
def __reduce_ex__(self, proto):
303-
return self.__class__, ()
304-
305-
def __deepcopy__(self, memo):
306-
return self

0 commit comments

Comments
 (0)