{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# ByteEnum Primitive Examples" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "from enum import IntEnum\n", "\n", "from byteclasses.print import byteclass_info, byteclass_inspect\n", "from byteclasses.types.primitives.byte_enum import ByteEnum\n", "from byteclasses.types.primitives.integers import UInt8" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "class TestEnum(IntEnum):\n", " \"\"\"Test Enum class.\"\"\"\n", "\n", " ONE = 0x1\n", " TWO = 0x2\n", " THREE = 0x3" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "known = ByteEnum(TestEnum, UInt8, 3)\n", "byteclass_info(known)\n", "byteclass_inspect(known)" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "unknown = ByteEnum(TestEnum, UInt8, 4)\n", "byteclass_info(unknown)\n", "byteclass_inspect(unknown)" ] } ], "metadata": { "kernelspec": { "display_name": ".venv", "language": "python", "name": "python3" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 3 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.11.9" } }, "nbformat": 4, "nbformat_minor": 2 }