Răsfoiți Sursa

feat: implement itemgetter and typing placeholders #486

Steve 1 săptămână în urmă
părinte
comite
37780ed884
3 a modificat fișierele cu 8 adăugiri și 0 ștergeri
  1. 6 0
      python/operator.py
  2. 2 0
      python/typing.py
  3. 0 0
      src/common/_generated.c

+ 6 - 0
python/operator.py

@@ -53,3 +53,9 @@ class attrgetter:
         self.attr = attr
     def __call__(self, obj):
         return getattr(obj, self.attr)
+
+class itemgetter:
+    def __init__(self, item):
+        self.item = item
+    def __call__(self, obj):
+        return obj[self.item]

+ 2 - 0
python/typing.py

@@ -57,5 +57,7 @@ assert_never = lambda x: x
 
 TypedDict = dict
 NotRequired = _PLACEHOLDER
+ReadOnly = _PLACEHOLDER
+Required = _PLACEHOLDER
 
 cast = lambda _, val: val

Fișier diff suprimat deoarece este prea mare
+ 0 - 0
src/common/_generated.c


Unele fișiere nu au fost afișate deoarece prea multe fișiere au fost modificate în acest diff