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

Function _find_stack_level

hvplot/util.py:1217–1243  ·  view source on GitHub ↗

Find the first place in the stack that is not inside hvplot (tests notwithstanding). Inspired by: pandas.util._exceptions.find_stack_level

()

Source from the content-addressed store, hash-verified

1215
1216
1217def _find_stack_level() -> int:
1218 """
1219 Find the first place in the stack that is not inside hvplot
1220 (tests notwithstanding).
1221 Inspired by: pandas.util._exceptions.find_stack_level
1222 """
1223 import hvplot
1224
1225 pkg_dir = os.path.dirname(hvplot.__file__)
1226 test_dir = os.path.join(pkg_dir, 'tests')
1227
1228 # https://stackoverflow.com/questions/17407119/python-inspect-stack-is-slow
1229 frame = inspect.currentframe()
1230 try:
1231 n = 0
1232 while frame:
1233 filename = inspect.getfile(frame)
1234 if filename.startswith(pkg_dir) and not filename.startswith(test_dir):
1235 frame = frame.f_back
1236 n += 1
1237 else:
1238 break
1239 finally:
1240 # See note in
1241 # https://docs.python.org/3/library/inspect.html#inspect.Traceback
1242 del frame
1243 return n
1244
1245
1246def _generate_unique_name(name: str, names: Sequence[str], suffix: str = '_') -> str:

Callers 3

__init__Method · 0.85
_is_within_latlon_boundsFunction · 0.85
plotFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…