@@ -397,90 +397,148 @@ def __contains__(self, item) -> bool:
397
397
return item in self .value # type: ignore
398
398
399
399
def __add__ (self , other ) -> A :
400
+ if isinstance (other , Variable ):
401
+ other = other .value
400
402
return self .value .__add__ (other ) # type: ignore
401
403
402
404
def __sub__ (self , other ) -> A :
405
+ if isinstance (other , Variable ):
406
+ other = other .value
403
407
return self .value .__sub__ (other ) # type: ignore
404
408
405
409
def __mul__ (self , other ) -> A :
410
+ if isinstance (other , Variable ):
411
+ other = other .value
406
412
return self .value .__mul__ (other ) # type: ignore
407
413
408
414
def __matmul__ (self , other ) -> A :
415
+ if isinstance (other , Variable ):
416
+ other = other .value
409
417
return self .value .__matmul__ (other ) # type: ignore
410
418
411
419
def __truediv__ (self , other ) -> A :
420
+ if isinstance (other , Variable ):
421
+ other = other .value
412
422
return self .value .__truediv__ (other ) # type: ignore
413
423
414
424
def __floordiv__ (self , other ) -> A :
425
+ if isinstance (other , Variable ):
426
+ other = other .value
415
427
return self .value .__floordiv__ (other ) # type: ignore
416
428
417
429
def __mod__ (self , other ) -> A :
430
+ if isinstance (other , Variable ):
431
+ other = other .value
418
432
return self .value .__mod__ (other ) # type: ignore
419
433
420
434
def __divmod__ (self , other ) -> A :
435
+ if isinstance (other , Variable ):
436
+ other = other .value
421
437
return self .value .__divmod__ (other ) # type: ignore
422
438
423
439
def __pow__ (self , other ) -> A :
440
+ if isinstance (other , Variable ):
441
+ other = other .value
424
442
return self .value .__pow__ (other ) # type: ignore
425
443
426
444
def __lshift__ (self , other ) -> A :
445
+ if isinstance (other , Variable ):
446
+ other = other .value
427
447
return self .value .__lshift__ (other ) # type: ignore
428
448
429
449
def __rshift__ (self , other ) -> A :
450
+ if isinstance (other , Variable ):
451
+ other = other .value
430
452
return self .value .__rshift__ (other ) # type: ignore
431
453
432
454
def __and__ (self , other ) -> A :
455
+ if isinstance (other , Variable ):
456
+ other = other .value
433
457
return self .value .__and__ (other ) # type: ignore
434
458
435
459
def __xor__ (self , other ) -> A :
460
+ if isinstance (other , Variable ):
461
+ other = other .value
436
462
return self .value .__xor__ (other ) # type: ignore
437
463
438
464
def __or__ (self , other ) -> A :
465
+ if isinstance (other , Variable ):
466
+ other = other .value
439
467
return self .value .__or__ (other ) # type: ignore
440
468
441
469
def __radd__ (self , other ) -> A :
470
+ if isinstance (other , Variable ):
471
+ other = other .value
442
472
return self .value .__radd__ (other ) # type: ignore
443
473
444
474
def __rsub__ (self , other ) -> A :
475
+ if isinstance (other , Variable ):
476
+ other = other .value
445
477
return self .value .__rsub__ (other ) # type: ignore
446
478
447
479
def __rmul__ (self , other ) -> A :
480
+ if isinstance (other , Variable ):
481
+ other = other .value
448
482
return self .value .__rmul__ (other ) # type: ignore
449
483
450
484
def __rmatmul__ (self , other ) -> A :
485
+ if isinstance (other , Variable ):
486
+ other = other .value
451
487
return self .value .__rmatmul__ (other ) # type: ignore
452
488
453
489
def __rtruediv__ (self , other ) -> A :
490
+ if isinstance (other , Variable ):
491
+ other = other .value
454
492
return self .value .__rtruediv__ (other ) # type: ignore
455
493
456
494
def __rfloordiv__ (self , other ) -> A :
495
+ if isinstance (other , Variable ):
496
+ other = other .value
457
497
return self .value .__rfloordiv__ (other ) # type: ignore
458
498
459
499
def __rmod__ (self , other ) -> A :
500
+ if isinstance (other , Variable ):
501
+ other = other .value
460
502
return self .value .__rmod__ (other ) # type: ignore
461
503
462
504
def __rdivmod__ (self , other ) -> A :
505
+ if isinstance (other , Variable ):
506
+ other = other .value
463
507
return self .value .__rdivmod__ (other ) # type: ignore
464
508
465
509
def __rpow__ (self , other ) -> A :
510
+ if isinstance (other , Variable ):
511
+ other = other .value
466
512
return self .value .__rpow__ (other ) # type: ignore
467
513
468
514
def __rlshift__ (self , other ) -> A :
515
+ if isinstance (other , Variable ):
516
+ other = other .value
469
517
return self .value .__rlshift__ (other ) # type: ignore
470
518
471
519
def __rrshift__ (self , other ) -> A :
520
+ if isinstance (other , Variable ):
521
+ other = other .value
472
522
return self .value .__rrshift__ (other ) # type: ignore
473
523
474
524
def __rand__ (self , other ) -> A :
525
+ if isinstance (other , Variable ):
526
+ other = other .value
475
527
return self .value .__rand__ (other ) # type: ignore
476
528
477
529
def __rxor__ (self , other ) -> A :
530
+ if isinstance (other , Variable ):
531
+ other = other .value
478
532
return self .value .__rxor__ (other ) # type: ignore
479
533
480
534
def __ror__ (self , other ) -> A :
535
+ if isinstance (other , Variable ):
536
+ other = other .value
481
537
return self .value .__ror__ (other ) # type: ignore
482
538
483
539
def __iadd__ (self : V , other ) -> V :
540
+ if isinstance (other , Variable ):
541
+ other = other .value
484
542
value = self .value
485
543
if hasattr (value , '__iadd__' ):
486
544
value .__iadd__ (other )
@@ -489,6 +547,8 @@ def __iadd__(self: V, other) -> V:
489
547
return self
490
548
491
549
def __isub__ (self : V , other ) -> V :
550
+ if isinstance (other , Variable ):
551
+ other = other .value
492
552
value = self .value
493
553
if hasattr (value , '__isub__' ):
494
554
value .__isub__ (other )
@@ -497,6 +557,8 @@ def __isub__(self: V, other) -> V:
497
557
return self
498
558
499
559
def __imul__ (self : V , other ) -> V :
560
+ if isinstance (other , Variable ):
561
+ other = other .value
500
562
value = self .value
501
563
if hasattr (value , '__imul__' ):
502
564
value .__imul__ (other )
@@ -505,6 +567,8 @@ def __imul__(self: V, other) -> V:
505
567
return self
506
568
507
569
def __imatmul__ (self : V , other ) -> V :
570
+ if isinstance (other , Variable ):
571
+ other = other .value
508
572
value = self .value
509
573
if hasattr (value , '__imatmul__' ):
510
574
value .__imatmul__ (other )
@@ -513,6 +577,8 @@ def __imatmul__(self: V, other) -> V:
513
577
return self
514
578
515
579
def __itruediv__ (self : V , other ) -> V :
580
+ if isinstance (other , Variable ):
581
+ other = other .value
516
582
value = self .value
517
583
if hasattr (value , '__itruediv__' ):
518
584
value .__itruediv__ (other )
@@ -521,6 +587,8 @@ def __itruediv__(self: V, other) -> V:
521
587
return self
522
588
523
589
def __ifloordiv__ (self : V , other ) -> V :
590
+ if isinstance (other , Variable ):
591
+ other = other .value
524
592
value = self .value
525
593
if hasattr (value , '__ifloordiv__' ):
526
594
value .__ifloordiv__ (other )
@@ -529,6 +597,8 @@ def __ifloordiv__(self: V, other) -> V:
529
597
return self
530
598
531
599
def __imod__ (self : V , other ) -> V :
600
+ if isinstance (other , Variable ):
601
+ other = other .value
532
602
value = self .value
533
603
if hasattr (value , '__imod__' ):
534
604
value .__imod__ (other )
@@ -537,6 +607,8 @@ def __imod__(self: V, other) -> V:
537
607
return self
538
608
539
609
def __ipow__ (self : V , other ) -> V :
610
+ if isinstance (other , Variable ):
611
+ other = other .value
540
612
value = self .value
541
613
if hasattr (value , '__ipow__' ):
542
614
value .__ipow__ (other )
@@ -545,6 +617,8 @@ def __ipow__(self: V, other) -> V:
545
617
return self
546
618
547
619
def __ilshift__ (self : V , other ) -> V :
620
+ if isinstance (other , Variable ):
621
+ other = other .value
548
622
value = self .value
549
623
if hasattr (value , '__ilshift__' ):
550
624
value .__ilshift__ (other )
@@ -553,6 +627,8 @@ def __ilshift__(self: V, other) -> V:
553
627
return self
554
628
555
629
def __irshift__ (self : V , other ) -> V :
630
+ if isinstance (other , Variable ):
631
+ other = other .value
556
632
value = self .value
557
633
if hasattr (value , '__irshift__' ):
558
634
value .__irshift__ (other )
@@ -561,6 +637,8 @@ def __irshift__(self: V, other) -> V:
561
637
return self
562
638
563
639
def __iand__ (self : V , other ) -> V :
640
+ if isinstance (other , Variable ):
641
+ other = other .value
564
642
value = self .value
565
643
if hasattr (value , '__iand__' ):
566
644
value .__iand__ (other )
@@ -569,6 +647,8 @@ def __iand__(self: V, other) -> V:
569
647
return self
570
648
571
649
def __ixor__ (self : V , other ) -> V :
650
+ if isinstance (other , Variable ):
651
+ other = other .value
572
652
value = self .value
573
653
if hasattr (value , '__ixor__' ):
574
654
value .__ixor__ (other )
@@ -577,6 +657,8 @@ def __ixor__(self: V, other) -> V:
577
657
return self
578
658
579
659
def __ior__ (self : V , other ) -> V :
660
+ if isinstance (other , Variable ):
661
+ other = other .value
580
662
value = self .value
581
663
if hasattr (value , '__ior__' ):
582
664
value .__ior__ (other )
0 commit comments