|
137 | 137 | import logging |
138 | 138 | import math |
139 | 139 | import re |
140 | | -import time |
141 | 140 |
|
142 | 141 | from dateutil.rrule import (rrule, MO, TU, WE, TH, FR, SA, SU, YEARLY, |
143 | 142 | MONTHLY, WEEKLY, DAILY, HOURLY, MINUTELY, |
@@ -308,67 +307,6 @@ def _from_ordinalf(x, tz=None): |
308 | 307 | _from_ordinalf_np_vectorized = np.vectorize(_from_ordinalf, otypes="O") |
309 | 308 |
|
310 | 309 |
|
311 | | -@cbook.deprecated( |
312 | | - "3.1", alternative="time.strptime or dateutil.parser.parse or datestr2num") |
313 | | -class strpdate2num: |
314 | | - """ |
315 | | - Use this class to parse date strings to matplotlib datenums when |
316 | | - you know the date format string of the date you are parsing. |
317 | | - """ |
318 | | - def __init__(self, fmt): |
319 | | - """ |
320 | | - Parameters |
321 | | - ---------- |
322 | | - fmt : any valid strptime format |
323 | | - """ |
324 | | - self.fmt = fmt |
325 | | - |
326 | | - def __call__(self, s): |
327 | | - """ |
328 | | - Parameters |
329 | | - ---------- |
330 | | - s : str |
331 | | -
|
332 | | - Returns |
333 | | - ------- |
334 | | - date2num float |
335 | | - """ |
336 | | - return date2num(datetime.datetime(*time.strptime(s, self.fmt)[:6])) |
337 | | - |
338 | | - |
339 | | -@cbook.deprecated( |
340 | | - "3.1", alternative="time.strptime or dateutil.parser.parse or datestr2num") |
341 | | -class bytespdate2num(strpdate2num): |
342 | | - """ |
343 | | - Use this class to parse date strings to matplotlib datenums when |
344 | | - you know the date format string of the date you are parsing. See |
345 | | - :doc:`/gallery/misc/load_converter.py`. |
346 | | - """ |
347 | | - def __init__(self, fmt, encoding='utf-8'): |
348 | | - """ |
349 | | - Parameters |
350 | | - ---------- |
351 | | - fmt : any valid strptime format |
352 | | - encoding : str |
353 | | - Encoding to use on byte input. |
354 | | - """ |
355 | | - super().__init__(fmt) |
356 | | - self.encoding = encoding |
357 | | - |
358 | | - def __call__(self, b): |
359 | | - """ |
360 | | - Parameters |
361 | | - ---------- |
362 | | - b : bytes |
363 | | -
|
364 | | - Returns |
365 | | - ------- |
366 | | - date2num float |
367 | | - """ |
368 | | - s = b.decode(self.encoding) |
369 | | - return super().__call__(s) |
370 | | - |
371 | | - |
372 | 310 | # a version of dateutil.parser.parse that can operate on numpy arrays |
373 | 311 | _dateutil_parser_parse_np_vectorized = np.vectorize(dateutil.parser.parse) |
374 | 312 |
|
|
0 commit comments