stempl

Simple template language written in python

git clone git://git.janzachar.dev/stempl.git


0from pathlib import Path
1
2class Context:
3    def __init__(self, ctx: Context = None):
4        self.data = {}
5        self.derived = ctx is not None
6        if ctx is not None:
7            self.data.update(ctx.data)
8
9    def __getitem__(self, key):
10        return self.data[key]
11
12    def __setitem__(self, key, value):
13        self.data[key] = value
14
15    def __contains__(self, key):
16        return key in self.data
17