class CreateItem(Task): def __init__(self, num): self._output_path = Path('item_%d_price.txt' % num) def target(self): return self._output_path def build(self): with self._output_path.open('w', encoding='UTF-8') as f: f.write('100')
class AddTaxToItem(Task): def __init__(self, num): self._output_path = Path('item_%d_tax.txt' % num) def target(self): return self._output_path def build(self, input_path): with input_path.open(encoding='UTF-8') as f: price = int(f.read()) with self._output_path.open('w', encoding='UTF-8') as f: f.write('%d' % int(price * 1.3))