finish implementing reading from yaml / json

This commit is contained in:
Maximilian Keßler 2022-02-07 01:15:14 +01:00
parent 51bf833e1f
commit cbd7ac3d1a

View file

@ -106,6 +106,33 @@ class FormattingConfig(Config):
extra[YAML_PATH] if extra[YAML_PATH] else extra[YAML_TEXT] extra[YAML_PATH] if extra[YAML_PATH] else extra[YAML_TEXT]
) )
repo = header[YAML_REPO]
self._include_repo_info_text = repo[YAML_INCLUDE_INFO_TEXT]
self._include_repo_version = repo[YAML_INCLUDE_VERSION]
self._repo_info_text = GenericText(
repo[YAML_PATH] if repo[YAML_PATH] else repo[YAML_TEXT]
)
pytex = header[YAML_PYTEX]
self._include_pytex_info_text = pytex[YAML_INCLUDE_INFO_TEXT]
self._include_pytex_version = pytex[YAML_INCLUDE_VERSION]
self._pytex_info_text = GenericText(
pytex[YAML_PATH] if pytex[YAML_PATH] else pytex[YAML_TEXT]
)
self._include_time = header[YAML_INCLUDE_TIME]
license = header[YAML_LICENSE]
self._include_license = license[YAML_INCLUDE_LICENSE]
self._license = GenericText(
license[YAML_PATH] if license[YAML_PATH] else license[YAML_TEXT]
)
docstrip = content[YAML_DOCSTRIP]
self._include_drv = docstrip[YAML_INCLUDE_DRV]
self._include_ins = docstrip[YAML_INCLUDE_INS]
self._docstrip_guards = docstrip[YAML_DOCSTRIP_GUARDS]
@classmethod @classmethod
def from_yaml(cls, content: Path): def from_yaml(cls, content: Path):
with open(content, 'r') as config: with open(content, 'r') as config: