def _parse_simple_yaml(buf: bytes) -> Stats:
data = buf.decode('ascii')
assert data[:4] == '---\n'
data = data[4:] # strip YAML head
stats = {}
for line in data.splitlines():
key, value = line.split(': ', 1)
try:
v = int(value) # type: Union[int, str]
except ValueError:
v = value
stats[key] = v
return stats
评论列表
文章目录