refactor formatting config to exclude git version info

This commit is contained in:
Maximilian Keßler 2022-02-06 21:25:52 +01:00
parent 85a32a19cc
commit 66b597d90c

View file

@ -5,6 +5,26 @@ from .formatterif import Config
from .git_version_info import GitVersionInfo from .git_version_info import GitVersionInfo
class VersionInfo:
def __init__(self):
self._repo_version: Optional[GitVersionInfo] = None
self._pytex_version: Optional[GitVersionInfo] = None
@property
def pytex_version(self) -> Optional[GitVersionInfo]:
if self._pytex_version is None:
return None
else:
return self._pytex_version
@property
def repo_version(self) -> Optional[GitVersionInfo]:
if self._repo_version is None:
return None
else:
return self._repo_version
class FormattingConfig(Config): class FormattingConfig(Config):
def __init__(self): def __init__(self):
self._naming_scheme: Optional[Union[NamingScheme, str]] = None self._naming_scheme: Optional[Union[NamingScheme, str]] = None
@ -22,9 +42,7 @@ class FormattingConfig(Config):
self._author: Optional[str] = None self._author: Optional[str] = None
self._licenses = Optional[List[GenericText]] self._licenses = Optional[List[GenericText]]
self._version: Optional[str] = None self._version: Optional[str] = None
self._pytex_version: Optional[GitVersionInfo] = None
self._pytex_info_text: Optional[GenericText] = None self._pytex_info_text: Optional[GenericText] = None
self._repo_version: Optional[GitVersionInfo] = None
self._repo_info_text: Optional[GenericText] = None self._repo_info_text: Optional[GenericText] = None
self._include_drv: Optional[bool] = None self._include_drv: Optional[bool] = None
@ -134,9 +152,6 @@ class FormattingConfig(Config):
else: else:
return self._version return self._version
@property
def pytex_version(self) -> Optional[GitVersionInfo]:
return self._pytex_version
@property @property
def pytex_info_text(self) -> GenericText: def pytex_info_text(self) -> GenericText:
@ -145,12 +160,6 @@ class FormattingConfig(Config):
else: else:
return self._pytex_info_text return self._pytex_info_text
@property
def repo_version(self) -> Optional[GitVersionInfo]:
if self._repo_version is None:
return None
else:
return self._repo_version
@property @property
def repo_info_text(self) -> GenericText: def repo_info_text(self) -> GenericText: