def invoke_template(self, effect: token.TemplateEffect) -> None: source_path = self.source_path(effect) target_path = self.target_path(effect) source_text = SUDO.file_load(source_path) template = jinja2.Template(source_text) target_text = template.render(effect.context) SUDO.files_sync_base(source_path, target_path) # copy attr SUDO.file_save(target_path, target_text) # change content SUDO.files_sync_time(source_path, target_path) # copy time
def image_meta_load(file: str) -> ImageMeta: text = SUDO.file_load(file) return image_meta_decode(text)
def parse_header_file(path: str) -> Mapping[str, str]: text = SUDO.file_load(path) return parse_header_text(text)