|
1 | 1 | from pandas.compat import callable, signature, PY2
|
2 | 2 | from pandas._libs.properties import cache_readonly # noqa
|
3 | 3 | import inspect
|
4 |
| -import types |
5 | 4 | import warnings
|
6 | 5 | from textwrap import dedent, wrap
|
7 | 6 | from functools import wraps, update_wrapper, WRAPPER_ASSIGNMENTS
|
@@ -339,48 +338,3 @@ def make_signature(func):
|
339 | 338 | if spec.keywords:
|
340 | 339 | args.append('**' + spec.keywords)
|
341 | 340 | return args, spec.args
|
342 |
| - |
343 |
| - |
344 |
| -class docstring_wrapper(object): |
345 |
| - """ |
346 |
| - Decorator to wrap a function and provide |
347 |
| - a dynamically evaluated doc-string. |
348 |
| -
|
349 |
| - Parameters |
350 |
| - ---------- |
351 |
| - func : callable |
352 |
| - creator : callable |
353 |
| - return the doc-string |
354 |
| - default : str, optional |
355 |
| - return this doc-string on error |
356 |
| - """ |
357 |
| - _attrs = ['__module__', '__name__', |
358 |
| - '__qualname__', '__annotations__'] |
359 |
| - |
360 |
| - def __init__(self, func, creator, default=None): |
361 |
| - self.func = func |
362 |
| - self.creator = creator |
363 |
| - self.default = default |
364 |
| - update_wrapper( |
365 |
| - self, func, [attr for attr in self._attrs |
366 |
| - if hasattr(func, attr)]) |
367 |
| - |
368 |
| - def __get__(self, instance, cls=None): |
369 |
| - |
370 |
| - # we are called with a class |
371 |
| - if instance is None: |
372 |
| - return self |
373 |
| - |
374 |
| - # we want to return the actual passed instance |
375 |
| - return types.MethodType(self, instance) |
376 |
| - |
377 |
| - def __call__(self, *args, **kwargs): |
378 |
| - return self.func(*args, **kwargs) |
379 |
| - |
380 |
| - @property |
381 |
| - def __doc__(self): |
382 |
| - try: |
383 |
| - return self.creator() |
384 |
| - except Exception as exc: |
385 |
| - msg = self.default or str(exc) |
386 |
| - return msg |
0 commit comments