pytex/PyTeX/build/build/pytex_config.py

62 lines
1.7 KiB
Python

from typing import Optional
from PyTeX.build.build import BuildDirSpecification
from PyTeX.format.formatting_config import FormattingConfig
class PyTeXConfig:
def __init__(
self,
build_dir_spec: Optional[BuildDirSpecification] = None
):
self._build_dir_specification: Optional[BuildDirSpecification] = build_dir_spec
self._default_formatting_config: Optional[FormattingConfig] = None
self._recursive: Optional[bool] = None
self._overwrite_existing_files: Optional[bool] = None
self._clean_old_files: Optional[bool] = None
self._allow_dirty: Optional[bool] = None
@property
def build_dir_specification(self):
if self._build_dir_specification is None:
return BuildDirSpecification()
else:
return self._build_dir_specification
@property
def recursive(self) -> bool:
if self._recursive is None:
return True
else:
return self._recursive
@property
def overwrite_existing_files(self) -> bool:
if self._overwrite_existing_files is None:
return False
else:
return self._overwrite_existing_files
@property
def clean_old_files(self) -> bool:
if self._clean_old_files is None:
return False
else:
return self._clean_old_files
@property
def allow_dirty(self) -> bool:
if self._allow_dirty is None:
return False
else:
return self._allow_dirty
@property
def default_formatting_config(self) -> FormattingConfig:
if self._default_formatting_config is None:
return FormattingConfig()
else:
return self._default_formatting_config