@@ -353,26 +353,6 @@ def strip_math(s):
353353 return s
354354
355355
356- @deprecated ('3.1' , alternative = 'np.iterable' )
357- def iterable (obj ):
358- """return true if *obj* is iterable"""
359- try :
360- iter (obj )
361- except TypeError :
362- return False
363- return True
364-
365-
366- @deprecated ("3.1" , alternative = "isinstance(..., collections.abc.Hashable)" )
367- def is_hashable (obj ):
368- """Returns true if *obj* can be hashed"""
369- try :
370- hash (obj )
371- except TypeError :
372- return False
373- return True
374-
375-
376356def is_writable_file_like (obj ):
377357 """Return whether *obj* looks like a file object with a *write* method."""
378358 return callable (getattr (obj , 'write' , None ))
@@ -536,47 +516,6 @@ def get_realpath_and_stat(path):
536516_dedent_regex = {}
537517
538518
539- @deprecated ("3.1" , alternative = "inspect.cleandoc" )
540- def dedent (s ):
541- """
542- Remove excess indentation from docstring *s*.
543-
544- Discards any leading blank lines, then removes up to n whitespace
545- characters from each line, where n is the number of leading
546- whitespace characters in the first line. It differs from
547- textwrap.dedent in its deletion of leading blank lines and its use
548- of the first non-blank line to determine the indentation.
549-
550- It is also faster in most cases.
551- """
552- # This implementation has a somewhat obtuse use of regular
553- # expressions. However, this function accounted for almost 30% of
554- # matplotlib startup time, so it is worthy of optimization at all
555- # costs.
556-
557- if not s : # includes case of s is None
558- return ''
559-
560- match = _find_dedent_regex .match (s )
561- if match is None :
562- return s
563-
564- # This is the number of spaces to remove from the left-hand side.
565- nshift = match .end (1 ) - match .start (1 )
566- if nshift == 0 :
567- return s
568-
569- # Get a regex that will remove *up to* nshift spaces from the
570- # beginning of each line. If it isn't in the cache, generate it.
571- unindent = _dedent_regex .get (nshift , None )
572- if unindent is None :
573- unindent = re .compile ("\n \r ? {0,%d}" % nshift )
574- _dedent_regex [nshift ] = unindent
575-
576- result = unindent .sub ("\n " , s ).strip ()
577- return result
578-
579-
580519class maxdict (dict ):
581520 """
582521 A dictionary with a maximum size.
@@ -736,19 +675,6 @@ def call(command, os_name):
736675 return mem
737676
738677
739- _safezip_msg = 'In safezip, len(args[0])=%d but len(args[%d])=%d'
740-
741-
742- @deprecated ("3.1" )
743- def safezip (* args ):
744- """make sure *args* are equal len before zipping"""
745- Nx = len (args [0 ])
746- for i , arg in enumerate (args [1 :]):
747- if len (arg ) != Nx :
748- raise ValueError (_safezip_msg % (Nx , i + 1 , len (arg )))
749- return list (zip (* args ))
750-
751-
752678def safe_masked_invalid (x , copy = False ):
753679 x = np .array (x , subok = True , copy = copy )
754680 if not x .dtype .isnative :
@@ -1820,14 +1746,6 @@ def normalize_kwargs(kw, alias_mapping=None, required=(), forbidden=(),
18201746 return ret
18211747
18221748
1823- @deprecated ("3.1" )
1824- def get_label (y , default_name ):
1825- try :
1826- return y .name
1827- except AttributeError :
1828- return default_name
1829-
1830-
18311749@contextlib .contextmanager
18321750def _lock_path (path ):
18331751 """
0 commit comments