We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent df07f1d commit 555ceffCopy full SHA for 555ceff
1 file changed
scratchattach/editor/commons.py
@@ -258,15 +258,15 @@ def get_name_nofldr(name: str) -> str:
258
return name[len(fldr) + 2:]
259
260
class SingletonMeta(EnumMeta):
261
- def __new__(cls, *args, **kwargs):
262
- result = super().__new__(cls, *args, **kwargs)
263
- result.__class__ = EnumMeta
264
- return result
265
-
+
266
def __call__(self, value=0, *args, **kwds):
267
if value != 0:
268
raise ValueError("Value must be 0.")
269
- return super().__call__(value, *args, **kwds)
+ cls = self.__class__
+ self.__class__ = EnumMeta
+ result = super().__call__(value, *args, **kwds)
+ self.__class__ = cls
+ return result
270
271
if TYPE_CHECKING:
272
Singleton = Enum
0 commit comments