Bopytex/bopytex/planner.py

58 lines
1004 B
Python

""" Produce tasks to do
It essentially place things at the right place.
"""
from dataclasses import dataclass
@dataclass
class Task:
action: str
args: dict
deps: list
def generate(template: str, meta: dict):
"""Create a task to generate a subject"""
return Task(
action="GENERATE",
args=meta,
deps=[template],
)
def activate_corr_on(src: str):
"""Create a task to activate correction for src"""
return Task(
action="ACTIVATE_CORR",
args={},
deps=[src],
)
def compile_pdf(src: str):
"""Create a task to compile src"""
return Task(
action="COMPILE",
args={},
deps=[src],
)
def join_pdfs(pdfs: list):
""" Create task to join pdf together """
return Task(
action="JOIN",
args={},
deps=pdfs,
)
def clean(files: list):
""" Create task to clean files"""
return Task(
action="CLEAN",
args={},
deps=files,
)