Format function default values as needed for inspect.formatargspec. The interesting part is a hard-coded list of functions used as defaults in pyplot methods.
| 80 | |
| 81 | |
| 82 | class value_formatter: |
| 83 | """ |
| 84 | Format function default values as needed for inspect.formatargspec. |
| 85 | The interesting part is a hard-coded list of functions used |
| 86 | as defaults in pyplot methods. |
| 87 | """ |
| 88 | |
| 89 | def __init__(self, value): |
| 90 | if value is mlab.detrend_none: |
| 91 | self._repr = "mlab.detrend_none" |
| 92 | elif value is mlab.window_hanning: |
| 93 | self._repr = "mlab.window_hanning" |
| 94 | elif value is np.mean: |
| 95 | self._repr = "np.mean" |
| 96 | elif value is _api.deprecation._deprecated_parameter: |
| 97 | self._repr = "_api.deprecation._deprecated_parameter" |
| 98 | elif isinstance(value, Enum): |
| 99 | # Enum str is Class.Name whereas their repr is <Class.Name: value>. |
| 100 | self._repr = f'{type(value).__name__}.{value.name}' |
| 101 | else: |
| 102 | self._repr = repr(value) |
| 103 | |
| 104 | def __repr__(self): |
| 105 | return self._repr |
| 106 | |
| 107 | |
| 108 | class direct_repr: |
no outgoing calls
no test coverage detected
searching dependent graphs…