MCPcopy Create free account
hub / github.com/holoviz/hvplot / _PatchHvplotDocstrings

Class _PatchHvplotDocstrings

hvplot/util.py:1101–1132  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1099
1100
1101class _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
1135def _patch_doc(cls, kind, signature=None):

Callers 2

__init__.pyFile · 0.85

Calls

no outgoing calls

Tested by 1

Used in the wild real call sites across dependent graphs

searching dependent graphs…