MCPcopy
hub / github.com/pandas-dev/pandas / get_context

Function get_context

web/pandas_web.py:387–407  ·  view source on GitHub ↗

Load the config yaml as the base context, and enrich it with the information added by the context preprocessors defined in the file.

(config_fname: pathlib.Path, **kwargs)

Source from the content-addressed store, hash-verified

385
386
387def get_context(config_fname: pathlib.Path, **kwargs):
388 """
389 Load the config yaml as the base context, and enrich it with the
390 information added by the context preprocessors defined in the file.
391 """
392 with config_fname.open(encoding="utf-8") as f:
393 context = yaml.safe_load(f)
394
395 context["source_path"] = config_fname.parent
396 context.update(kwargs)
397
398 preprocessors = (
399 get_callable(context_prep)
400 for context_prep in context["main"]["context_preprocessors"]
401 )
402 for preprocessor in preprocessors:
403 context = preprocessor(context)
404 msg = f"{preprocessor.__name__} is missing the return statement"
405 assert context is not None, msg
406
407 return context
408
409
410def get_source_files(source_path: pathlib.Path) -> typing.Generator[str, None, None]:

Callers 1

mainFunction · 0.85

Calls 3

get_callableFunction · 0.85
openMethod · 0.45
updateMethod · 0.45

Tested by

no test coverage detected