@@ -554,7 +554,11 @@ def isinteractive() -> bool:
554
554
return matplotlib .is_interactive ()
555
555
556
556
557
- def ioff () -> ExitStack :
557
+ # Note: The return type of ioff being AbstractContextManager
558
+ # instead of ExitStack is deliberate.
559
+ # See https://github.com/matplotlib/matplotlib/issues/27659
560
+ # and https://github.com/matplotlib/matplotlib/pull/27667 for more info.
561
+ def ioff () -> AbstractContextManager :
558
562
"""
559
563
Disable interactive mode.
560
564
@@ -584,7 +588,7 @@ def ioff() -> ExitStack:
584
588
# ...
585
589
586
590
To enable optional usage as a context manager, this function returns a
587
- `~contextlib.ExitStack` object, which is not intended to be stored or
591
+ context manager object, which is not intended to be stored or
588
592
accessed by the user.
589
593
"""
590
594
stack = ExitStack ()
@@ -594,7 +598,11 @@ def ioff() -> ExitStack:
594
598
return stack
595
599
596
600
597
- def ion () -> ExitStack :
601
+ # Note: The return type of ion being AbstractContextManager
602
+ # instead of ExitStack is deliberate.
603
+ # See https://github.com/matplotlib/matplotlib/issues/27659
604
+ # and https://github.com/matplotlib/matplotlib/pull/27667 for more info.
605
+ def ion () -> AbstractContextManager :
598
606
"""
599
607
Enable interactive mode.
600
608
@@ -624,7 +632,7 @@ def ion() -> ExitStack:
624
632
# ...
625
633
626
634
To enable optional usage as a context manager, this function returns a
627
- `~contextlib.ExitStack` object, which is not intended to be stored or
635
+ context manager object, which is not intended to be stored or
628
636
accessed by the user.
629
637
"""
630
638
stack = ExitStack ()
0 commit comments