INNER CODE UNIT · Python
_output_context_path
koxudaxi/datamodel-code-generator · src/datamodel_code_generator/__init__.py:393
def _output_context_path(output: Path | None, caller_cwd: Path) -> Path:
"""Return the directory observed by legacy output-context consumers."""
if output is None:
return caller_cwd
return (output if output.is_dir() else output.parent).resolve()
def _uses_legacy_process_state(config: GenerateConfig) -> bool:
"""Return whether generation may observe the process working directory."""
return bool(
config.custom_template_dir or getattr(config, "custom_class_name_generator", None) or config.custom_formatters
)
def is_openapi(data: Mapping[str, Any]) -> bool:
"""Check if the data dict is an OpenAPI specification."""
return "openapi" in data