pydata/pandas — pull request #7991 by ischwabacher (2014-08-11 21:17:48+00:00)
Title: Allow deprecate_kwarg to transform arguments

This will allow deprecated kwargs to be transformed before being passed to a function. For example, in #7963, one could write

```python

@deprecate_kwarg(old_arg_name='infer_dst', new_arg_name='ambiguous',
mapping={True: 'infer', False: 'raise'})
def tz_localize(self, tz, ambiguous=None):
...

```

Open issues:

- should we test for a bad mapping at creation time? (in this PR: yes)
- how much error checking should we do? (in this PR: pass args unrecognized by a mapping through unchanged; assume a function will do its own error handling)
- should we support both mappings and callables? (in this PR: yes)
- if so, how should we recognize mappings? (in this PR: existence of a `get` method)