| 1099 | |
| 1100 | |
| 1101 | class _PatchHvplotDocstrings: |
| 1102 | def __init__(self): |
| 1103 | from .plotting.core import hvPlot, hvPlotTabular |
| 1104 | from .converter import HoloViewsConverter |
| 1105 | |
| 1106 | # Store the original signatures because the method signatures |
| 1107 | # are going to be patched every time an extension is changed. |
| 1108 | orig = {} |
| 1109 | for cls in [hvPlot, hvPlotTabular]: |
| 1110 | for _kind in HoloViewsConverter._kind_mapping: |
| 1111 | if hasattr(cls, _kind): |
| 1112 | method = getattr(cls, _kind) |
| 1113 | sig = inspect.signature(method) |
| 1114 | orig[(cls, _kind)] = (sig, method.__doc__) |
| 1115 | self.orig = orig |
| 1116 | |
| 1117 | def __call__(self): |
| 1118 | from .plotting.core import hvPlot, hvPlotTabular |
| 1119 | from .converter import HoloViewsConverter |
| 1120 | |
| 1121 | for cls in [hvPlot, hvPlotTabular]: |
| 1122 | for _kind in HoloViewsConverter._kind_mapping: |
| 1123 | if hasattr(cls, _kind): |
| 1124 | signature = self.orig[(cls, _kind)][0] |
| 1125 | _patch_doc(cls, _kind, signature=signature) |
| 1126 | |
| 1127 | def reset(self): |
| 1128 | """Used for testing purposes mostly.""" |
| 1129 | for (cls, _kind), (osig, odoc) in self.orig.items(): |
| 1130 | obj = getattr(cls, _kind) |
| 1131 | obj.__signature__ = osig |
| 1132 | obj.__doc__ = odoc |
| 1133 | |
| 1134 | |
| 1135 | def _patch_doc(cls, kind, signature=None): |
no outgoing calls
searching dependent graphs…