From 5694f4e8c63576c85db3a957b48ca79eacead3d7 Mon Sep 17 00:00:00 2001 From: Antony Lee Date: Thu, 2 Jan 2020 15:59:04 +0100 Subject: [PATCH] Cleanup category.py docstrings. For the better or (mostly) the worst, we support both bytes and str. AnyStr is the union of both of them (per stdlib typing). --- lib/matplotlib/category.py | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/lib/matplotlib/category.py b/lib/matplotlib/category.py index 9013460311cc..a67d17ef0106 100644 --- a/lib/matplotlib/category.py +++ b/lib/matplotlib/category.py @@ -116,14 +116,17 @@ def __init__(self, units_mapping): """ Parameters ----------- - units_mapping : Dict[str, int] + units_mapping : dict + Mapping of category names (str) to indices (int). """ self._units = units_mapping def __call__(self): + # docstring inherited return list(self._units.values()) def tick_values(self, vmin, vmax): + # docstring inherited return self() @@ -133,19 +136,17 @@ def __init__(self, units_mapping): """ Parameters ---------- - units_mapping : Dict[Str, int] + units_mapping : dict + Mapping of category names (str) to indices (int). """ self._units = units_mapping def __call__(self, x, pos=None): - """ - Return the category label string for tick val *x*. - - The position *pos* is ignored. - """ + # docstring inherited return self.format_ticks([x])[0] def format_ticks(self, values): + # docstring inherited r_mapping = {v: self._text(k) for k, v in self._units.items()} return [r_mapping.get(round(val), '') for val in values]