fix missing property decorators
This commit is contained in:
parent
7318c9380d
commit
5f8411d907
5 changed files with 40 additions and 4 deletions
|
@ -40,7 +40,7 @@ class PyTeXSourceFile:
|
||||||
self._file_hash = md5(self._relative_path.path)
|
self._file_hash = md5(self._relative_path.path)
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def relative_path(self):
|
def relative_path(self) -> RelativePath:
|
||||||
return self._relative_path
|
return self._relative_path
|
||||||
|
|
||||||
@property
|
@property
|
||||||
|
|
34
PyTeX/build/build/pytex_output_file.py
Normal file
34
PyTeX/build/build/pytex_output_file.py
Normal file
|
@ -0,0 +1,34 @@
|
||||||
|
from pathlib import Path
|
||||||
|
from typing import Optional, Union, List, Tuple
|
||||||
|
|
||||||
|
from .enums import PyTeXRootDirType
|
||||||
|
from .pytex_config import PyTeXConfig
|
||||||
|
from ...logger import logger
|
||||||
|
from .constants import *
|
||||||
|
from ..versioning.version_info.version_info import VersionInfo, FileVersionInfo
|
||||||
|
from .pytex_file import PyTeXSourceFile
|
||||||
|
from .relative_path import RelativePath
|
||||||
|
from .hashing import md5
|
||||||
|
|
||||||
|
|
||||||
|
class PyTeXOutputFile:
|
||||||
|
def __init__(
|
||||||
|
self,
|
||||||
|
source_file: PyTeXSourceFile,
|
||||||
|
output_file: RelativePath,
|
||||||
|
last_version_info: FileVersionInfo
|
||||||
|
):
|
||||||
|
self.output_file: RelativePath = output_file
|
||||||
|
self.source_file: PyTeXSourceFile = source_file
|
||||||
|
self.last_version_info: FileVersionInfo = last_version_info
|
||||||
|
|
||||||
|
@property
|
||||||
|
def dependencies(self) -> List[str]:
|
||||||
|
return self.source_file.formatter.dependencies
|
||||||
|
|
||||||
|
def is_recent(self) -> bool:
|
||||||
|
return self.last_version_info.file_hash == self.source_file.file_hash
|
||||||
|
|
||||||
|
@property
|
||||||
|
def file_hash(self) -> str:
|
||||||
|
return md5(self.output_file.path)
|
|
@ -22,6 +22,7 @@ class DictFormatter(PyTeXFormatter):
|
||||||
self._dict_name = self.input_file.name.split('.')[0]
|
self._dict_name = self.input_file.name.split('.')[0]
|
||||||
self._translations = None
|
self._translations = None
|
||||||
|
|
||||||
|
@property
|
||||||
def dependencies(self) -> List[str]:
|
def dependencies(self) -> List[str]:
|
||||||
return [] # No dependencies for dictionaries
|
return [] # No dependencies for dictionaries
|
||||||
|
|
||||||
|
|
|
@ -102,9 +102,9 @@ class PyTeXFormatter(FormatterIF, ABC):
|
||||||
or self.config.include_repo_version
|
or self.config.include_repo_version
|
||||||
or self.config.include_repo_info_text
|
or self.config.include_repo_info_text
|
||||||
):
|
):
|
||||||
self._header = GenericText([])
|
self._header = GenericText()
|
||||||
else:
|
else:
|
||||||
self._header = GenericText([])
|
self._header = GenericText()
|
||||||
# TODO: handle license
|
# TODO: handle license
|
||||||
if self.config.include_extra_header:
|
if self.config.include_extra_header:
|
||||||
self._header += self.config.extra_header + ['']
|
self._header += self.config.extra_header + ['']
|
||||||
|
|
|
@ -10,7 +10,7 @@ class SimpleTeXFormatter(TexFormatter):
|
||||||
if out_file.exists():
|
if out_file.exists():
|
||||||
raise NotImplementedError
|
raise NotImplementedError
|
||||||
else:
|
else:
|
||||||
self._output_file = out_file.open()
|
self._output_file = out_file.open('w')
|
||||||
|
|
||||||
def close_output_stream(self):
|
def close_output_stream(self):
|
||||||
self._output_file.close()
|
self._output_file.close()
|
||||||
|
@ -18,6 +18,7 @@ class SimpleTeXFormatter(TexFormatter):
|
||||||
def future_config(self) -> List[Tuple[str, FormattingConfig]]:
|
def future_config(self) -> List[Tuple[str, FormattingConfig]]:
|
||||||
return [] # TODO
|
return [] # TODO
|
||||||
|
|
||||||
|
@property
|
||||||
def dependencies(self) -> List[str]:
|
def dependencies(self) -> List[str]:
|
||||||
return [] # sty / cls file does not depend on anything
|
return [] # sty / cls file does not depend on anything
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue