vessel/scripts/chunked_example.py
2024-11-02 17:59:25 +02:00

36 lines
837 B
Python

#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""Generates example chunked content"""
from warnings import filterwarnings as filter_warnings
def main() -> int:
"""entry / main function"""
chunks: tuple[bytes, ...] = (
b"H",
b"ell",
b"o, Wor",
b"ld!",
b"HWE",
b" This is a",
b" te",
b"st.E",
b"ND",
b" Proudly presented to you by Vessel :) I hope ",
b"this works fine.",
)
with open("chunked.test", "wb") as fp:
for chunk in chunks:
fp.write(hex(len(chunk))[2:].encode() + b"\r\n" + chunk + b"\r\n")
return 0
if __name__ == "__main__":
assert main.__annotations__.get("return") is int, "main() should return an integer"
filter_warnings("error", category=Warning)
raise SystemExit(main())