def write_fragment()

in tools/asciidoc_to_fragments.py [0:0]


def write_fragment(filename, fragment_timestamp, fragment_dict):
    if not fragment_timestamp:
        fragment_timestamp = str(1000000000 + fragments_counter)

    path = "".join([fragments_path,
                    fragment_timestamp,
                    "-",
                    filename,
                    ".yaml"])

    with open(path, 'w+') as f:
        for k, v in fragment_dict.items():
            f.write(f"{k}: {v}\n")

    # print path and SHA1 of it's content, for verification purposes
    with open(path, 'r') as f:
        content = f.read()
        hash_object = sha1(content.encode('utf-8'))
        print(path, hash_object.hexdigest())