class_docstr: Writes a single pyi file
class_docstr_tok: ["Writes","a","single","pyi","file"]
code: def write_enums(self, enums: List[d.EnumDescriptorProto]) -> None:
      line = self._write_line
      for enum in enums:
          line("class {}(int):", enum.name)
          with self._indent():
              line("@classmethod")
              line("def Name(cls, number: int) -> str: ...")
              line("@classmethod")
              line("def Value(cls, name: str) -> int: ...")
              line("@classmethod")
              line(
                  "def keys(cls) -> {}[str]: ...",
                  self._import("typing", "List"),
              )
              line("@classmethod")
              line(
                  "def values(cls) -> {}[int]: ...",
                  self._import("typing", "List"),
              )
              line("@classmethod")
              line(
                  "def items(cls) -> {}[{}[str, int]]: ...",
                  self._import("typing", "List"),
                  self._import("typing", "Tuple"),
              )
  
          for val in enum.value:
              line(
                  "{} = {}({}, {})",
                  val.name,
                  self._import("typing", "cast"),
                  enum.name,
                  val.number,
              )
          line("")
  
file_path: onnx/tools/protoc-gen-mypy.py
imports: import sys
  from collections import defaultdict
  from contextlib import contextmanager
  from typing import Any, Callable, Dict, Generator, List, Optional, Set, cast
label_desc: Use image node_id 6 for calling the PkgWriter obj's underlying member method code with example usage: obj.write_enums(enums) without return types