2
2
import datetime as pydt
3
3
from datetime import datetime , timedelta , tzinfo
4
4
import functools
5
- from typing import Optional , Tuple
5
+ from typing import Any , List , Optional , Tuple
6
6
7
7
from dateutil .relativedelta import relativedelta
8
8
import matplotlib .dates as dates
@@ -144,7 +144,7 @@ def convert(value, unit, axis):
144
144
return value
145
145
146
146
@staticmethod
147
- def axisinfo (unit , axis ):
147
+ def axisinfo (unit , axis ) -> Optional [ units . AxisInfo ] :
148
148
if unit != "time" :
149
149
return None
150
150
@@ -294,7 +294,7 @@ def try_parse(values):
294
294
return values
295
295
296
296
@staticmethod
297
- def axisinfo (unit , axis ):
297
+ def axisinfo (unit : Optional [ tzinfo ] , axis ) -> units . AxisInfo :
298
298
"""
299
299
Return the :class:`~matplotlib.units.AxisInfo` for *unit*.
300
300
@@ -473,7 +473,7 @@ def _get_default_annual_spacing(nyears) -> Tuple[int, int]:
473
473
return (min_spacing , maj_spacing )
474
474
475
475
476
- def period_break (dates , period ) :
476
+ def period_break (dates : PeriodIndex , period : str ) -> np . ndarray :
477
477
"""
478
478
Returns the indices where the given period changes.
479
479
@@ -489,7 +489,7 @@ def period_break(dates, period):
489
489
return np .nonzero (current - previous )[0 ]
490
490
491
491
492
- def has_level_label (label_flags , vmin ) :
492
+ def has_level_label (label_flags : np . ndarray , vmin : float ) -> bool :
493
493
"""
494
494
Returns true if the ``label_flags`` indicate there is at least one label
495
495
for this level.
@@ -984,18 +984,24 @@ class TimeSeries_DateFormatter(Formatter):
984
984
----------
985
985
freq : {int, string}
986
986
Valid frequency specifier.
987
- minor_locator : {False, True}
987
+ minor_locator : bool, default False
988
988
Whether the current formatter should apply to minor ticks (True) or
989
989
major ticks (False).
990
- dynamic_mode : {True, False}
990
+ dynamic_mode : bool, default True
991
991
Whether the formatter works in dynamic mode or not.
992
992
"""
993
993
994
- def __init__ (self , freq , minor_locator = False , dynamic_mode = True , plot_obj = None ):
994
+ def __init__ (
995
+ self ,
996
+ freq ,
997
+ minor_locator : bool = False ,
998
+ dynamic_mode : bool = True ,
999
+ plot_obj = None ,
1000
+ ):
995
1001
freq = to_offset (freq )
996
1002
self .format = None
997
1003
self .freq = freq
998
- self .locs = []
1004
+ self .locs : List [ Any ] = [] # unused, for matplotlib compat
999
1005
self .formatdict = None
1000
1006
self .isminor = minor_locator
1001
1007
self .isdynamic = dynamic_mode
0 commit comments