File tree Expand file tree Collapse file tree 1 file changed +24
-0
lines changed Expand file tree Collapse file tree 1 file changed +24
-0
lines changed Original file line number Diff line number Diff line change @@ -413,3 +413,27 @@ def _unpack_sizes_element_type(sizes_element_type):
413
413
element_type = sizes_element_type [- 1 ]
414
414
sizes = sizes_element_type [:- 1 ]
415
415
return sizes , element_type
416
+
417
+
418
+ class getitemproperty :
419
+ def __init__ (self , f ):
420
+ self .f = f
421
+ self .instance = None
422
+
423
+ def __get__ (self , instance , _class ):
424
+ self .instance = instance
425
+ return self
426
+
427
+ def __getitem__ (self , item ):
428
+ kwargs = {}
429
+ if len (item ) > 2 :
430
+ # not sure how but you don't need two backs here
431
+ previous_frame = inspect .currentframe ().f_back
432
+ for kwarg in item [2 :]:
433
+ k = _get_previous_frame_idents (kwarg , previous_frame )
434
+ assert len (k ) == 1 , f"{ len (k )= } "
435
+ kwargs [k [0 ]] = kwarg
436
+ item = item [:2 ]
437
+
438
+ # f is not a bound method since it was decorated...
439
+ return self .f (self .instance , item , ** kwargs )
You can’t perform that action at this time.
0 commit comments