From dd444239777a1f58ba6cb655585f29a69d466d3f Mon Sep 17 00:00:00 2001 From: Antony Lee Date: Wed, 12 Feb 2020 10:59:32 +0100 Subject: [PATCH] Remove some APIs deprecated in mpl3.1. --- doc/api/next_api_changes/removals.rst | 3 + .../prev_api_changes/api_changes_3.1.0.rst | 4 +- lib/matplotlib/dates.py | 62 ------------------- lib/matplotlib/pylab.py | 2 +- lib/matplotlib/rcsetup.py | 13 +--- 5 files changed, 8 insertions(+), 76 deletions(-) diff --git a/doc/api/next_api_changes/removals.rst b/doc/api/next_api_changes/removals.rst index bc61fcde4d1f..3df9d032f19a 100644 --- a/doc/api/next_api_changes/removals.rst +++ b/doc/api/next_api_changes/removals.rst @@ -80,6 +80,8 @@ Classes and methods - ``dates.minutes()`` (no replacement) - ``dates.hours()`` (no replacement) - ``dates.weeks()`` (no replacement) +- ``dates.strpdate2num`` and ``dates.bytespdate2num`` (use `time.strptime` or + `dateutil.parser.parse` or `.dates.datestr2num` instead) - ``font_manager.OSXInstalledFonts()`` (no replacement) @@ -150,6 +152,7 @@ rcParams :rc:`savefig.facecolor` to "none" to get a transparent background. - The ``pgf.debug``, ``verbose.fileo`` and ``verbose.verbose.level`` rcParams, which had no effect, have been removed. +- Support for setting :rc:`mathtext.default` to "circled" has been removed. Environment variables ~~~~~~~~~~~~~~~~~~~~~ diff --git a/doc/api/prev_api_changes/api_changes_3.1.0.rst b/doc/api/prev_api_changes/api_changes_3.1.0.rst index 4afb048d0391..9c116088e11b 100644 --- a/doc/api/prev_api_changes/api_changes_3.1.0.rst +++ b/doc/api/prev_api_changes/api_changes_3.1.0.rst @@ -915,8 +915,8 @@ Date related functions - ``dates.minutes()`` - ``dates.hours()`` - ``dates.weeks()`` -- `.dates.strpdate2num` -- `.dates.bytespdate2num` +- ``dates.strpdate2num`` +- ``dates.bytespdate2num`` These are brittle in the presence of locale changes. Use standard datetime parsers such as `time.strptime` or `dateutil.parser.parse`, and additionally diff --git a/lib/matplotlib/dates.py b/lib/matplotlib/dates.py index 8eb1c2c21135..dd136658e7fb 100644 --- a/lib/matplotlib/dates.py +++ b/lib/matplotlib/dates.py @@ -137,7 +137,6 @@ import logging import math import re -import time from dateutil.rrule import (rrule, MO, TU, WE, TH, FR, SA, SU, YEARLY, MONTHLY, WEEKLY, DAILY, HOURLY, MINUTELY, @@ -308,67 +307,6 @@ def _from_ordinalf(x, tz=None): _from_ordinalf_np_vectorized = np.vectorize(_from_ordinalf, otypes="O") -@cbook.deprecated( - "3.1", alternative="time.strptime or dateutil.parser.parse or datestr2num") -class strpdate2num: - """ - Use this class to parse date strings to matplotlib datenums when - you know the date format string of the date you are parsing. - """ - def __init__(self, fmt): - """ - Parameters - ---------- - fmt : any valid strptime format - """ - self.fmt = fmt - - def __call__(self, s): - """ - Parameters - ---------- - s : str - - Returns - ------- - date2num float - """ - return date2num(datetime.datetime(*time.strptime(s, self.fmt)[:6])) - - -@cbook.deprecated( - "3.1", alternative="time.strptime or dateutil.parser.parse or datestr2num") -class bytespdate2num(strpdate2num): - """ - Use this class to parse date strings to matplotlib datenums when - you know the date format string of the date you are parsing. See - :doc:`/gallery/misc/load_converter.py`. - """ - def __init__(self, fmt, encoding='utf-8'): - """ - Parameters - ---------- - fmt : any valid strptime format - encoding : str - Encoding to use on byte input. - """ - super().__init__(fmt) - self.encoding = encoding - - def __call__(self, b): - """ - Parameters - ---------- - b : bytes - - Returns - ------- - date2num float - """ - s = b.decode(self.encoding) - return super().__call__(s) - - # a version of dateutil.parser.parse that can operate on numpy arrays _dateutil_parser_parse_np_vectorized = np.vectorize(dateutil.parser.parse) diff --git a/lib/matplotlib/pylab.py b/lib/matplotlib/pylab.py index 1a1de9d06adc..fddf382ec775 100644 --- a/lib/matplotlib/pylab.py +++ b/lib/matplotlib/pylab.py @@ -16,7 +16,7 @@ import matplotlib as mpl from matplotlib.dates import ( - date2num, num2date, datestr2num, strpdate2num, drange, epoch2num, + date2num, num2date, datestr2num, drange, epoch2num, num2epoch, mx2num, DateFormatter, IndexDateFormatter, DateLocator, RRuleLocator, YearLocator, MonthLocator, WeekdayLocator, DayLocator, HourLocator, MinuteLocator, SecondLocator, rrule, MO, TU, WE, TH, FR, diff --git a/lib/matplotlib/rcsetup.py b/lib/matplotlib/rcsetup.py index 643cead7bf99..4c2ac7db5aab 100644 --- a/lib/matplotlib/rcsetup.py +++ b/lib/matplotlib/rcsetup.py @@ -422,17 +422,8 @@ def validate_font_properties(s): validate_fontset = ValidateInStrings( 'fontset', ['dejavusans', 'dejavuserif', 'cm', 'stix', 'stixsans', 'custom']) - - -def validate_mathtext_default(s): - if s == "circled": - cbook.warn_deprecated( - "3.1", message="Support for setting the mathtext.default rcParam " - "to 'circled' is deprecated since %(since)s and will be removed " - "%(removal)s.") - return ValidateInStrings( - 'default', - "rm cal it tt sf bf default bb frak circled scr regular".split())(s) +validate_mathtext_default = ValidateInStrings( + 'default', "rm cal it tt sf bf default bb frak scr regular".split()) _validate_alignment = ValidateInStrings( pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy