class_docstr: Dict-like container for Extension fields on proto instances.
  
  Note that in all cases we expect extension handles to be
  FieldDescriptors.
class_docstr_tok: ["Dict-like","container","for","Extension","fields","on","proto","instances",".","Note","that","in","all","cases","we","expect","extension","handles","to","be","FieldDescriptors","."]
docstr: If extension_handle specifies a non-repeated, scalar extension
  field, sets the value of that field.
docstr_tok: ["If","extension_handle","specifies","a","non-repeated",",","scalar","extension","field",",","sets","the","value","of","that","field","."]
code: def __setitem__(self, extension_handle, value):
      """If extension_handle specifies a non-repeated, scalar extension
      field, sets the value of that field.
      """
  
      _VerifyExtensionHandle(self._extended_message, extension_handle)
  
      if (
          extension_handle.label == FieldDescriptor.LABEL_REPEATED
          or extension_handle.cpp_type
          == FieldDescriptor.CPPTYPE_MESSAGE
      ):
          raise TypeError(
              'Cannot assign to extension "%s" because it is a repeated or '
              "composite type." % extension_handle.full_name
          )
  
      # It's slightly wasteful to lookup the type checker each time,
      # but we expect this to be a vanishingly uncommon case anyway.
      type_checker = type_checkers.GetTypeChecker(extension_handle)
      # pylint: disable=protected-access
      self._extended_message._fields[
          extension_handle
      ] = type_checker.CheckValue(value)
      self._extended_message._Modified()
  
file_path: catboost/contrib/python/protobuf/py3/google/protobuf/internal/extension_dict.py
imports: from google.protobuf.internal import type_checkers
  from google.protobuf.descriptor import FieldDescriptor
label_desc: Use image node_id 7 for calling the _ExtensionDict obj's underlying member method code with example usage: obj.__setitem__(extension_handle, value) without return types