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