|
1 | 1 | import copy
|
2 | 2 | from datetime import timedelta
|
3 | 3 | from textwrap import dedent
|
| 4 | +from typing import Dict, no_type_check |
4 | 5 | import warnings
|
5 | 6 |
|
6 | 7 | import numpy as np
|
|
31 | 32 | from pandas.tseries.frequencies import to_offset
|
32 | 33 | from pandas.tseries.offsets import DateOffset, Day, Nano, Tick
|
33 | 34 |
|
34 |
| -_shared_docs_kwargs = dict() |
| 35 | +_shared_docs_kwargs = dict() # type: Dict[str, str] |
35 | 36 |
|
36 | 37 |
|
37 | 38 | class Resampler(_GroupBy):
|
@@ -873,25 +874,25 @@ def f(self, _method=method, min_count=0, *args, **kwargs):
|
873 | 874 | for method in ['min', 'max', 'first', 'last', 'mean', 'sem',
|
874 | 875 | 'median', 'ohlc']:
|
875 | 876 |
|
876 |
| - def f(self, _method=method, *args, **kwargs): |
| 877 | + def g(self, _method=method, *args, **kwargs): |
877 | 878 | nv.validate_resampler_func(_method, args, kwargs)
|
878 | 879 | return self._downsample(_method)
|
879 |
| - f.__doc__ = getattr(GroupBy, method).__doc__ |
880 |
| - setattr(Resampler, method, f) |
| 880 | + g.__doc__ = getattr(GroupBy, method).__doc__ |
| 881 | + setattr(Resampler, method, g) |
881 | 882 |
|
882 | 883 | # groupby & aggregate methods
|
883 | 884 | for method in ['count']:
|
884 |
| - def f(self, _method=method): |
| 885 | + def h(self, _method=method): |
885 | 886 | return self._downsample(_method)
|
886 |
| - f.__doc__ = getattr(GroupBy, method).__doc__ |
887 |
| - setattr(Resampler, method, f) |
| 887 | + h.__doc__ = getattr(GroupBy, method).__doc__ |
| 888 | + setattr(Resampler, method, h) |
888 | 889 |
|
889 | 890 | # series only methods
|
890 | 891 | for method in ['nunique']:
|
891 |
| - def f(self, _method=method): |
| 892 | + def h(self, _method=method): |
892 | 893 | return self._downsample(_method)
|
893 |
| - f.__doc__ = getattr(SeriesGroupBy, method).__doc__ |
894 |
| - setattr(Resampler, method, f) |
| 894 | + h.__doc__ = getattr(SeriesGroupBy, method).__doc__ |
| 895 | + setattr(Resampler, method, h) |
895 | 896 |
|
896 | 897 |
|
897 | 898 | def _maybe_process_deprecations(r, how=None, fill_method=None, limit=None):
|
@@ -964,6 +965,7 @@ def __init__(self, obj, *args, **kwargs):
|
964 | 965 | self._groupby.grouper.mutated = True
|
965 | 966 | self.groupby = copy.copy(parent.groupby)
|
966 | 967 |
|
| 968 | + @no_type_check |
967 | 969 | def _apply(self, f, grouper=None, *args, **kwargs):
|
968 | 970 | """
|
969 | 971 | Dispatch to _upsample; we are stripping all of the _upsample kwargs and
|
|
0 commit comments