MCPcopy
hub / github.com/sphinx-doc/sphinx / _validate_theme_toml

Function _validate_theme_toml

sphinx/theming.py:363–379  ·  view source on GitHub ↗
(cfg: _ThemeToml, name: str)

Source from the content-addressed store, hash-verified

361
362
363def _validate_theme_toml(cfg: _ThemeToml, name: str) -> str:
364 if 'theme' not in cfg:
365 msg = __('theme %r doesn\'t have the "theme" table') % name
366 raise ThemeError(msg)
367 theme = cfg['theme']
368 if not isinstance(theme, dict):
369 msg = __('The %r theme "[theme]" table is not a table') % name
370 raise ThemeError(msg)
371 inherit = theme.get('inherit', '')
372 if not inherit:
373 msg = __('The %r theme must define the "theme.inherit" setting') % name
374 raise ThemeError(msg)
375 if 'options' in cfg:
376 if not isinstance(cfg['options'], dict):
377 msg = __('The %r theme "[options]" table is not a table') % name
378 raise ThemeError(msg)
379 return inherit
380
381
382def _convert_theme_toml(cfg: _ThemeToml, /) -> _ConfigFile:

Callers 1

_load_themeFunction · 0.85

Calls 2

ThemeErrorClass · 0.90
getMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…