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: Returns the current value of the given extension handle.
docstr_tok: ["Returns","the","current","value","of","the","given","extension","handle","."]
code: def __getitem__(self, extension_handle):
      """Returns the current value of the given extension handle."""
  
      _VerifyExtensionHandle(self._extended_message, extension_handle)
  
      result = self._extended_message._fields.get(extension_handle)
      if result is not None:
          return result
  
      if extension_handle.label == FieldDescriptor.LABEL_REPEATED:
          result = extension_handle._default_constructor(
              self._extended_message
          )
      elif extension_handle.cpp_type == FieldDescriptor.CPPTYPE_MESSAGE:
          message_type = extension_handle.message_type
          if not hasattr(message_type, "_concrete_class"):
              # pylint: disable=protected-access
              self._extended_message._FACTORY.GetPrototype(message_type)
          assert getattr(
              extension_handle.message_type, "_concrete_class", None
          ), (
              "Uninitialized concrete class found for field %r (message type %r)"
              % (
                  extension_handle.full_name,
                  extension_handle.message_type.full_name,
              )
          )
          result = extension_handle.message_type._concrete_class()
          try:
              result._SetListener(
                  self._extended_message._listener_for_children
              )
          except ReferenceError:
              pass
      else:
          # Singular scalar -- just return the default without inserting into the
          # dict.
          return extension_handle.default_value
  
      # Atomically check if another thread has preempted us and, if not, swap
      # in the new object we just created.  If someone has preempted us, we
      # take that object and discard ours.
      # WARNING:  We are relying on setdefault() being atomic.  This is true
      #   in CPython but we haven't investigated others.  This warning appears
      #   in several other locations in this file.
      result = self._extended_message._fields.setdefault(
          extension_handle, result
      )
  
      return result
  
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 2 for calling the _ExtensionDict obj's underlying member method code with example usage: obj.__getitem__(extension_handle) and returns: result, result, extension_handle