1 from collections import namedtuple
2 from re import compile as RE
5 Snippet = namedtuple('Snippet', 'sha offset length')
28 def _ts(sha, offset, length):
29 return f'{{{sha.decode("ascii")} {offset} {length}}}'
32 def from_string(text):
36 return _fs(**m.groupdict())
39 def _fs(sha, offset, length):
40 return Snippet(sha.encode('ascii'), int(offset), int(length))