Przeglądaj źródła

feat: implement itemgetter and typing placeholders #486

Steve 1 tydzień temu
rodzic
commit
37780ed884
3 zmienionych plików z 8 dodań i 0 usunięć
  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

Plik diff jest za duży
+ 0 - 0
src/common/_generated.c


Niektóre pliki nie zostały wyświetlone z powodu dużej ilości zmienionych plików