@@ -315,54 +315,6 @@ def __repr__(self):
315315 return "<an empty list>"
316316
317317
318- @_api .deprecated ("3.3" )
319- class IgnoredKeywordWarning (UserWarning ):
320- """
321- A class for issuing warnings about keyword arguments that will be ignored
322- by Matplotlib.
323- """
324- pass
325-
326-
327- @_api .deprecated ("3.3" , alternative = "normalize_kwargs" )
328- def local_over_kwdict (local_var , kwargs , * keys ):
329- """
330- Enforces the priority of a local variable over potentially conflicting
331- argument(s) from a kwargs dict. The following possible output values are
332- considered in order of priority::
333-
334- local_var > kwargs[keys[0]] > ... > kwargs[keys[-1]]
335-
336- The first of these whose value is not None will be returned. If all are
337- None then None will be returned. Each key in keys will be removed from the
338- kwargs dict in place.
339-
340- Parameters
341- ----------
342- local_var : any object
343- The local variable (highest priority).
344-
345- kwargs : dict
346- Dictionary of keyword arguments; modified in place.
347-
348- *keys : str(s)
349- Name(s) of keyword arguments to process, in descending order of
350- priority.
351-
352- Returns
353- -------
354- any object
355- Either local_var or one of kwargs[key] for key in keys.
356-
357- Raises
358- ------
359- IgnoredKeywordWarning
360- For each key in keys that is removed from kwargs but not used as
361- the output value.
362- """
363- return _local_over_kwdict (local_var , kwargs , * keys , IgnoredKeywordWarning )
364-
365-
366318def _local_over_kwdict (
367319 local_var , kwargs , * keys , warning_cls = MatplotlibDeprecationWarning ):
368320 out = local_var
@@ -449,11 +401,6 @@ def to_filehandle(fname, flag='r', return_opened=False, encoding=None):
449401 """
450402 if isinstance (fname , os .PathLike ):
451403 fname = os .fspath (fname )
452- if "U" in flag :
453- _api .warn_deprecated (
454- "3.3" , message = "Passing a flag containing 'U' to to_filehandle() "
455- "is deprecated since %(since)s and will be removed %(removal)s." )
456- flag = flag .replace ("U" , "" )
457404 if isinstance (fname , str ):
458405 if fname .endswith ('.gz' ):
459406 fh = gzip .open (fname , flag )
@@ -555,15 +502,6 @@ def flatten(seq, scalarp=is_scalar_or_string):
555502 yield from flatten (item , scalarp )
556503
557504
558- @_api .deprecated ("3.3" , alternative = "os.path.realpath and os.stat" )
559- @functools .lru_cache ()
560- def get_realpath_and_stat (path ):
561- realpath = os .path .realpath (path )
562- stat = os .stat (realpath )
563- stat_key = (stat .st_ino , stat .st_dev )
564- return realpath , stat_key
565-
566-
567505class maxdict (dict ):
568506 """
569507 A dictionary with a maximum size.
@@ -1711,24 +1649,10 @@ def sanitize_sequence(data):
17111649 else data )
17121650
17131651
1714- @_api .delete_parameter ("3.3" , "required" )
1715- @_api .delete_parameter ("3.3" , "forbidden" )
1716- @_api .delete_parameter ("3.3" , "allowed" )
1717- def normalize_kwargs (kw , alias_mapping = None , required = (), forbidden = (),
1718- allowed = None ):
1652+ def normalize_kwargs (kw , alias_mapping = None ):
17191653 """
17201654 Helper function to normalize kwarg inputs.
17211655
1722- The order they are resolved are:
1723-
1724- 1. aliasing
1725- 2. required
1726- 3. forbidden
1727- 4. allowed
1728-
1729- This order means that only the canonical names need appear in
1730- *allowed*, *forbidden*, *required*.
1731-
17321656 Parameters
17331657 ----------
17341658 kw : dict or None
@@ -1737,32 +1661,20 @@ def normalize_kwargs(kw, alias_mapping=None, required=(), forbidden=(),
17371661 the form ``props=None``.
17381662
17391663 alias_mapping : dict or Artist subclass or Artist instance, optional
1740- A mapping between a canonical name to a list of
1741- aliases, in order of precedence from lowest to highest.
1664+ A mapping between a canonical name to a list of aliases, in order of
1665+ precedence from lowest to highest.
17421666
1743- If the canonical value is not in the list it is assumed to have
1744- the highest priority.
1667+ If the canonical value is not in the list it is assumed to have the
1668+ highest priority.
17451669
17461670 If an Artist subclass or instance is passed, use its properties alias
17471671 mapping.
17481672
1749- required : list of str, optional
1750- A list of keys that must be in *kws*. This parameter is deprecated.
1751-
1752- forbidden : list of str, optional
1753- A list of keys which may not be in *kw*. This parameter is deprecated.
1754-
1755- allowed : list of str, optional
1756- A list of allowed fields. If this not None, then raise if
1757- *kw* contains any keys not in the union of *required*
1758- and *allowed*. To allow only the required fields pass in
1759- an empty tuple ``allowed=()``. This parameter is deprecated.
1760-
17611673 Raises
17621674 ------
17631675 TypeError
1764- To match what python raises if invalid args/kwargs are passed to
1765- a callable.
1676+ To match what Python raises if invalid arguments/keyword arguments are
1677+ passed to a callable.
17661678 """
17671679 from matplotlib .artist import Artist
17681680
@@ -1790,25 +1702,6 @@ def normalize_kwargs(kw, alias_mapping=None, required=(), forbidden=(),
17901702 canonical_to_seen [canonical ] = k
17911703 ret [canonical ] = v
17921704
1793- fail_keys = [k for k in required if k not in ret ]
1794- if fail_keys :
1795- raise TypeError ("The required keys {keys!r} "
1796- "are not in kwargs" .format (keys = fail_keys ))
1797-
1798- fail_keys = [k for k in forbidden if k in ret ]
1799- if fail_keys :
1800- raise TypeError ("The forbidden keys {keys!r} "
1801- "are in kwargs" .format (keys = fail_keys ))
1802-
1803- if allowed is not None :
1804- allowed_set = {* required , * allowed }
1805- fail_keys = [k for k in ret if k not in allowed_set ]
1806- if fail_keys :
1807- raise TypeError (
1808- "kwargs contains {keys!r} which are not in the required "
1809- "{req!r} or allowed {allow!r} keys" .format (
1810- keys = fail_keys , req = required , allow = allowed ))
1811-
18121705 return ret
18131706
18141707
0 commit comments