class_docstr: Writes a single pyi file
class_docstr_tok: ["Writes","a","single","pyi","file"]
code: def python_type(self, field: d.FieldDescriptorProto) -> str:
      mapping: Dict[int, Callable[[], str]] = {
          d.FieldDescriptorProto.TYPE_DOUBLE: lambda: "float",
          d.FieldDescriptorProto.TYPE_FLOAT: lambda: "float",
          d.FieldDescriptorProto.TYPE_INT64: lambda: "int",
          d.FieldDescriptorProto.TYPE_UINT64: lambda: "int",
          d.FieldDescriptorProto.TYPE_FIXED64: lambda: "int",
          d.FieldDescriptorProto.TYPE_SFIXED64: lambda: "int",
          d.FieldDescriptorProto.TYPE_SINT64: lambda: "int",
          d.FieldDescriptorProto.TYPE_INT32: lambda: "int",
          d.FieldDescriptorProto.TYPE_UINT32: lambda: "int",
          d.FieldDescriptorProto.TYPE_FIXED32: lambda: "int",
          d.FieldDescriptorProto.TYPE_SFIXED32: lambda: "int",
          d.FieldDescriptorProto.TYPE_SINT32: lambda: "int",
          d.FieldDescriptorProto.TYPE_BOOL: lambda: "bool",
          d.FieldDescriptorProto.TYPE_STRING: lambda: "str",
          d.FieldDescriptorProto.TYPE_BYTES: lambda: "bytes",
          d.FieldDescriptorProto.TYPE_ENUM: lambda: self._import_message(
              field.type_name
          ),
          d.FieldDescriptorProto.TYPE_MESSAGE: lambda: self._import_message(
              field.type_name
          ),
          d.FieldDescriptorProto.TYPE_GROUP: lambda: self._import_message(
              field.type_name
          ),
      }
  
      assert field.type in mapping, "Unrecognized type: " + field.type
      return mapping[field.type]()
  
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 9 for calling the PkgWriter obj's underlying member method code with example usage: obj.python_type(field) and returns: mapping