We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent c6a1da4 commit bbc6643Copy full SHA for bbc6643
25-class-metaprog/tinyenums/microenum.py
@@ -54,12 +54,10 @@ class MicroEnumMeta(type):
54
def __prepare__(name, bases, **kwargs):
55
return AutoFillDict()
56
57
- def __getitem__(cls, key):
+
58
+class MicroEnum(metaclass=MicroEnumMeta):
59
+ def __class_getitem__(cls, key):
60
for k, v in cls.__dict__.items():
61
if v == key:
62
return k
63
raise KeyError(key)
-
64
-class MicroEnum(metaclass=MicroEnumMeta):
65
- pass
25-class-metaprog/tinyenums/nanoenum.py
@@ -25,7 +25,6 @@
25
26
27
class KeyIsValueDict(dict):
28
29
def __missing__(self, key):
30
if key.startswith('__') and key.endswith('__'):
31
0 commit comments