@@ -315,54 +315,6 @@ def __repr__(self):
315
315
return "<an empty list>"
316
316
317
317
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
-
366
318
def _local_over_kwdict (
367
319
local_var , kwargs , * keys , warning_cls = MatplotlibDeprecationWarning ):
368
320
out = local_var
@@ -449,11 +401,6 @@ def to_filehandle(fname, flag='r', return_opened=False, encoding=None):
449
401
"""
450
402
if isinstance (fname , os .PathLike ):
451
403
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" , "" )
457
404
if isinstance (fname , str ):
458
405
if fname .endswith ('.gz' ):
459
406
fh = gzip .open (fname , flag )
@@ -555,15 +502,6 @@ def flatten(seq, scalarp=is_scalar_or_string):
555
502
yield from flatten (item , scalarp )
556
503
557
504
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
- st
1E0A
at = os .stat (realpath )
563
- stat_key = (stat .st_ino , stat .st_dev )
564
- return realpath , stat_key
565
-
566
-
567
505
class maxdict (dict ):
568
506
"""
569
507
A dictionary with a maximum size.
@@ -1711,24 +1649,10 @@ def sanitize_sequence(data):
1711
1649
else data )
1712
1650
1713
1651
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 ):
1719
1653
"""
1720
1654
Helper function to normalize kwarg inputs.
1721
1655
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
-
1732
1656
Parameters
1733
1657
----------
1734
1658
kw : dict or None
@@ -1737,32 +1661,20 @@ def normalize_kwargs(kw, alias_mapping=None, required=(), forbidden=(),
1737
1661
the form ``props=None``.
1738
1662
1739
1663
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.
1742
1666
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.
1745
1669
1746
1670
If an Artist subclass or instance is passed, use its properties alias
1747
1671
mapping.
1748
1672
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
-
1761
1673
Raises
1762
1674
------
1763
1675
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.
1766
1678
"""
1767
1679
from matplotlib .artist import Artist
1768
1680
@@ -1790,25 +1702,6 @@ def normalize_kwargs(kw, alias_mapping=None, required=(), forbidden=(),
1790
1702
canonical_to_seen [canonical ] = k
1791
1703
ret [canonical ] = v
1792
1704
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 c
10000
ontains {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
-
1812
1705
return ret
1813
1706
1814
1707
0 commit comments