@@ -543,9 +543,7 @@ def is_scalar_or_string(val):
543
543
return isinstance (val , str ) or not np .iterable (val )
544
544
545
545
546
- @_api .delete_parameter (
547
- "3.8" , "np_load" , alternative = "open(get_sample_data(..., asfileobj=False))" )
548
- def get_sample_data (fname , asfileobj = True , * , np_load = True ):
546
+ def get_sample_data (fname , asfileobj = True ):
549
547
"""
550
548
Return a sample data file. *fname* is a path relative to the
551
549
:file:`mpl-data/sample_data` directory. If *asfileobj* is `True`
@@ -564,10 +562,7 @@ def get_sample_data(fname, asfileobj=True, *, np_load=True):
564
562
if suffix == '.gz' :
565
563
return gzip .open (path )
566
564
elif suffix in ['.npy' , '.npz' ]:
567
- if np_load :
568
- return np .load (path )
569
- else :
570
- return path .open ('rb' )
565
+ return np .load (path )
571
566
elif suffix in ['.csv' , '.xrc' , '.txt' ]:
572
567
return path .open ('r' )
573
568
else :
@@ -607,113 +602,6 @@ def flatten(seq, scalarp=is_scalar_or_string):
607
602
yield from flatten (item , scalarp )
608
603
609
604
610
- @_api .deprecated ("3.8" )
611
- class Stack :
612
- """
613
- Stack of elements with a movable cursor.
614
-
615
- Mimics home/back/forward in a web browser.
616
- """
617
-
618
- def __init__ (self , default = None ):
619
- self .clear ()
620
- self ._default = default
621
-
622
- def __call__ (self ):
623
- """Return the current element, or None."""
624
- if not self ._elements :
625
- return self ._default
626
- else :
627
- return self ._elements [self ._pos ]
628
-
629
- def __len__ (self ):
630
- return len (self ._elements )
631
-
632
- def __getitem__ (self , ind ):
633
- return self ._elements [ind ]
634
-
635
- def forward (self ):
636
- """Move the position forward and return the current element."""
637
- self ._pos = min (self ._pos + 1 , len (self ._elements ) - 1 )
638
- return self ()
639
-
640
- def back (self ):
641
- """Move the position back and return the current element."""
642
- if self ._pos > 0 :
643
- self ._pos -= 1
644
- return self ()
645
-
646
- def push (self , o ):
647
- """
648
- Push *o* to the stack at current position. Discard all later elements.
649
-
650
- *o* is returned.
651
- """
652
- self ._elements = self ._elements [:self ._pos + 1 ] + [o ]
653
- self ._pos = len (self ._elements ) - 1
654
- return self ()
655
-
656
- def home (self ):
657
- """
658
- Push the first element onto the top of the stack.
659
-
660
- The first element is returned.
661
- """
662
- if not self ._elements :
663
- return
664
- self .push (self ._elements [0 ])
665
- return self ()
666
-
667
- def empty (self ):
668
- """Return whether the stack is empty."""
669
- return len (self ._elements ) == 0
670
-
671
- def clear (self ):
672
- """Empty the stack."""
673
- self ._pos = - 1
674
- self ._elements = []
675
-
676
- def bubble (self , o ):
677
- """
678
- Raise all references of *o* to the top of the stack, and return it.
679
-
680
- Raises
681
- ------
682
- ValueError
683
- If *o* is not in the stack.
684
- """
685
- if o not in self ._elements :
686
- raise ValueError ('Given element not contained in the stack' )
687
- old_elements = self ._elements .copy ()
688
- self .clear ()
689
- top_elements = []
690
- for elem in old_elements :
691
- if elem == o :
692
- top_elements .append (elem )
693
- else :
694
- self .push (elem )
695
- for _ in top_elements :
696
- self .push (o )
697
- return o
698
-
699
- def remove (self , o ):
700
- """
701
- Remove *o* from the stack.
702
-
703
- Raises
704
- ------
705
- ValueError
706
- If *o* is not in the stack.
707
- """
708
- if o not in self ._elements :
709
- raise ValueError ('Given element not contained in the stack' )
710
- old_elements = self ._elements .copy ()
711
- self .clear ()
712
- for elem in old_elements :
713
- if elem != o :
714
- self .push (elem )
715
-
716
-
717
605
class _Stack :
718
606
"""
719
607
Stack of elements with a movable cursor.
@@ -913,10 +801,6 @@ def __setstate__(self, state):
913
801
def __contains__ (self , item ):
914
802
return item in self ._mapping
915
803
916
- @_api .deprecated ("3.8" , alternative = "none, you no longer need to clean a Grouper" )
917
- def clean (self ):
918
- """Clean dead weak references from the dictionary."""
919
-
920
804
def join (self , a , * args ):
921
805
"""
922
806
Join given arguments into the same set. Accepts one or more arguments.
0 commit comments