def _ConvertFileProtoToFileDescriptor(self, file_proto):

    if file_proto.name not in self._file_descriptors:
      built_deps = list(self._GetDeps(file_proto.dependency))
      direct_deps = [self.FindFileByName(n) for n in file_proto.dependency]

      file_descriptor = descriptor.FileDescriptor(
          name=file_proto.name,
          package=file_proto.package,
          syntax=file_proto.syntax,
          options=file_proto.options,
          serialized_pb=file_proto.SerializeToString(),
          dependencies=direct_deps)
      if _USE_C_DESCRIPTORS:
        # When using C++ descriptors, all objects defined in the file were added
        # to the C++ database when the FileDescriptor was built above.
        # Just add them to this descriptor pool.
        def _AddMessageDescriptor(message_desc):
          self._descriptors[message_desc.full_name] = message_desc
          for nested in message_desc.nested_types:
            _AddMessageDescriptor(nested)
          for enum_type in message_desc.enum_types:
            _AddEnumDescriptor(enum_type)
        def _AddEnumDescriptor(enum_desc):
          self._enum_descriptors[enum_desc.full_name] = enum_desc
        for message_type in list(file_descriptor.message_types_by_name.values()):
          _AddMessageDescriptor(message_type)
        for enum_type in list(file_descriptor.enum_types_by_name.values()):
          _AddEnumDescriptor(enum_type)
      else:
        scope = {}

        # This loop extracts all the message and enum types from all the
        # dependencies of the file_proto. This is necessary to create the
        # scope of available message types when defining the passed in
        # file proto.
        for dependency in built_deps:
          scope.update(self._ExtractSymbols(
              list(dependency.message_types_by_name.values())))
          scope.update((_PrefixWithDot(enum.full_name), enum)
                       for enum in list(dependency.enum_types_by_name.values()))

        for message_type in file_proto.message_type:
          message_desc = self._ConvertMessageDescriptor(
              message_type, file_proto.package, file_descriptor, scope,
              file_proto.syntax)
          file_descriptor.message_types_by_name[message_desc.name] = (
              message_desc)

        for enum_type in file_proto.enum_type:
          file_descriptor.enum_types_by_name[enum_type.name] = (
              self._ConvertEnumDescriptor(enum_type, file_proto.package,
                                          file_descriptor, None, scope))

        for index, extension_proto in enumerate(file_proto.extension):
          extension_desc = self._MakeFieldDescriptor(
              extension_proto, file_proto.package, index, is_extension=True)
          extension_desc.containing_type = self._GetTypeFromScope(
              file_descriptor.package, extension_proto.extendee, scope)
          self._SetFieldType(extension_proto, extension_desc,
                            file_descriptor.package, scope)
          file_descriptor.extensions_by_name[extension_desc.name] = (
              extension_desc)

        for desc_proto in file_proto.message_type:
          self._SetAllFieldTypes(file_proto.package, desc_proto, scope)

        if file_proto.package:
          desc_proto_prefix = _PrefixWithDot(file_proto.package)
        else:
          desc_proto_prefix = ''

        for desc_proto in file_proto.message_type:
          desc = self._GetTypeFromScope(
              desc_proto_prefix, desc_proto.name, scope)
          file_descriptor.message_types_by_name[desc_proto.name] = desc

      self.Add(file_proto)
      self._file_descriptors[file_proto.name] = file_descriptor

    return self._file_descriptors[file_proto.name]
Setting batch size allows control of how often a writeback worker is created.
dataset/ETHPy150Open sklearn-theano/sklearn-theano/sklearn_theano/externals/google/protobuf/descriptor_pool.py/DescriptorPool._ConvertFileProtoToFileDescriptor--crossover with--dataset/ETHPy150Open gregbayer/gae-livecount/livecount/counter.py/load_and_increment_counter