|
172 | 172 | import datetime
|
173 | 173 | import functools
|
174 | 174 | import logging
|
175 |
| -import math |
176 | 175 | import re
|
177 | 176 |
|
178 | 177 | from dateutil.rrule import (rrule, MO, TU, WE, TH, FR, SA, SU, YEARLY,
|
@@ -1779,50 +1778,6 @@ def _get_interval(self):
|
1779 | 1778 | return self._interval
|
1780 | 1779 |
|
1781 | 1780 |
|
1782 |
| -@_api.deprecated("3.6", alternative="`AutoDateLocator` and `AutoDateFormatter`" |
1783 |
| - " or vendor the code") |
1784 |
| -def date_ticker_factory(span, tz=None, numticks=5): |
1785 |
| - """ |
1786 |
| - Create a date locator with *numticks* (approx) and a date formatter |
1787 |
| - for *span* in days. Return value is (locator, formatter). |
1788 |
| - """ |
1789 |
| - |
1790 |
| - if span == 0: |
1791 |
| - span = 1 / HOURS_PER_DAY |
1792 |
| - |
1793 |
| - mins = span * MINUTES_PER_DAY |
1794 |
| - hrs = span * HOURS_PER_DAY |
1795 |
| - days = span |
1796 |
| - wks = span / DAYS_PER_WEEK |
1797 |
| - months = span / DAYS_PER_MONTH # Approx |
1798 |
| - years = span / DAYS_PER_YEAR # Approx |
1799 |
| - |
1800 |
| - if years > numticks: |
1801 |
| - locator = YearLocator(int(years / numticks), tz=tz) # define |
1802 |
| - fmt = '%Y' |
1803 |
| - elif months > numticks: |
1804 |
| - locator = MonthLocator(tz=tz) |
1805 |
| - fmt = '%b %Y' |
1806 |
| - elif wks > numticks: |
1807 |
| - locator = WeekdayLocator(tz=tz) |
1808 |
| - fmt = '%a, %b %d' |
1809 |
| - elif days > numticks: |
1810 |
| - locator = DayLocator(interval=math.ceil(days / numticks), tz=tz) |
1811 |
| - fmt = '%b %d' |
1812 |
| - elif hrs > numticks: |
1813 |
| - locator = HourLocator(interval=math.ceil(hrs / numticks), tz=tz) |
1814 |
| - fmt = '%H:%M\n%b %d' |
1815 |
| - elif mins > numticks: |
1816 |
| - locator = MinuteLocator(interval=math.ceil(mins / numticks), tz=tz) |
1817 |
| - fmt = '%H:%M:%S' |
1818 |
| - else: |
1819 |
| - locator = MinuteLocator(tz=tz) |
1820 |
| - fmt = '%H:%M:%S' |
1821 |
| - |
1822 |
| - formatter = DateFormatter(fmt, tz=tz) |
1823 |
| - return locator, formatter |
1824 |
| - |
1825 |
| - |
1826 | 1781 | class DateConverter(units.ConversionInterface):
|
1827 | 1782 | """
|
1828 | 1783 | Converter for `datetime.date` and `datetime.datetime` data, or for
|
|
0 commit comments