mojo/public/tools/bindings/generators/mojom_mojolpm_generator.py
def _ProtoImports(self):
    """Scans all of the types used in this module to check which of the imports
    are needed for the generated proto files. This is somewhat different to the
    general case, since the generated proto files don't reference response
    parameters.
    """
    all_imports = self.module.imports
    seen_imports = set()
    seen_types = set()

    def AddKind(kind):
      if (mojom.IsIntegralKind(kind) or mojom.IsStringKind(kind)
          or mojom.IsDoubleKind(kind) or mojom.IsFloatKind(kind)):
        pass
      elif (mojom.IsAnyHandleKind(kind)):
        self.needs_mojolpm_proto = True
      elif mojom.IsArrayKind(kind):
        AddKind(kind.kind)
      elif mojom.IsMapKind(kind):
        AddKind(kind.key_kind)
        AddKind(kind.value_kind)
      elif (mojom.IsStructKind(kind) or mojom.IsUnionKind(kind)
            or mojom.IsEnumKind(kind) or mojom.IsInterfaceKind(kind)):
        name = self._GetFullMojomNameForKind(kind)
        if name in seen_types:
          return
        seen_types.add(name)
        if kind.module in all_imports:
          seen_imports.add(kind.module)
      elif (mojom.IsInterfaceRequestKind(kind)
            or mojom.IsAssociatedInterfaceKind(kind)
            or mojom.IsAssociatedInterfaceRequestKind(kind)
            or mojom.IsPendingRemoteKind(kind)
            or mojom.IsPendingReceiverKind(kind)
            or mojom.IsPendingAssociatedRemoteKind(kind)
            or mojom.IsPendingAssociatedReceiverKind(kind)):
        AddKind(kind.kind)

    for kind in self.module.structs + self.module.unions:
      for field in kind.fields:
        AddKind(field.kind)

    for interface in self.module.interfaces:
      for method in interface.methods:
        for parameter in method.parameters:
          AddKind(parameter.kind)
        if method.response_parameters:
          for parameter in method.response_parameters:
            AddKind(parameter.kind)

    import_files = list(
        map(lambda x: '{}.mojolpm.proto'.format(x.path), seen_imports))
    if self.needs_mojolpm_proto:
      import_files.append('mojo/public/tools/fuzzers/mojolpm.proto')
    import_files.sort()

    return import_files
Scans all of the types used in this module to check which of the imports
    are needed for the generated proto files. This is somewhat different to the
    general case, since the generated proto files don't reference response
    parameters.
    
Scans all of the types used in this module to check which of the imports
are needed for the generated proto files. This is somewhat different to the
general case, since the generated proto files don't reference response
parameters.
Scans all of the types used in this module to check which of the imports are needed for the generated proto files . This is somewhat different to the general case since the generated proto files don ' t reference response parameters .
def _ProtoImports(self):
    all_imports = self.module.imports
    seen_imports = set()
    seen_types = set()
    def AddKind(kind):
      if (mojom.IsIntegralKind(kind) or mojom.IsStringKind(kind)
          or mojom.IsDoubleKind(kind) or mojom.IsFloatKind(kind)):
        pass
      elif (mojom.IsAnyHandleKind(kind)):
        self.needs_mojolpm_proto = True
      elif mojom.IsArrayKind(kind):
        AddKind(kind.kind)
      elif mojom.IsMapKind(kind):
        AddKind(kind.key_kind)
        AddKind(kind.value_kind)
      elif (mojom.IsStructKind(kind) or mojom.IsUnionKind(kind)
            or mojom.IsEnumKind(kind) or mojom.IsInterfaceKind(kind)):
        name = self._GetFullMojomNameForKind(kind)
        if name in seen_types:
          return
        seen_types.add(name)
        if kind.module in all_imports:
          seen_imports.add(kind.module)
      elif (mojom.IsInterfaceRequestKind(kind)
            or mojom.IsAssociatedInterfaceKind(kind)
            or mojom.IsAssociatedInterfaceRequestKind(kind)
            or mojom.IsPendingRemoteKind(kind)
            or mojom.IsPendingReceiverKind(kind)
            or mojom.IsPendingAssociatedRemoteKind(kind)
            or mojom.IsPendingAssociatedReceiverKind(kind)):
        AddKind(kind.kind)
    for kind in self.module.structs + self.module.unions:
      for field in kind.fields:
        AddKind(field.kind)
    for interface in self.module.interfaces:
      for method in interface.methods:
        for parameter in method.parameters:
          AddKind(parameter.kind)
        if method.response_parameters:
          for parameter in method.response_parameters:
            AddKind(parameter.kind)
    import_files = list(
        map(lambda x: '{}.mojolpm.proto'.format(x.path), seen_imports))
    if self.needs_mojolpm_proto:
      import_files.append('mojo/public/tools/fuzzers/mojolpm.proto')
    import_files.sort()
    return import_files
def _ProtoImports ( self ) : all_imports = self . module . imports seen_imports = set ( ) seen_types = set ( ) def AddKind ( kind ) : if ( mojom . IsIntegralKind ( kind ) or mojom . IsStringKind ( kind ) or mojom . IsDoubleKind ( kind ) or mojom . IsFloatKind ( kind ) ) : pass elif ( mojom . IsAnyHandleKind ( kind ) ) : self . needs_mojolpm_proto = True elif mojom . IsArrayKind ( kind ) : AddKind ( kind . kind ) elif mojom . IsMapKind ( kind ) : AddKind ( kind . key_kind ) AddKind ( kind . value_kind ) elif ( mojom . IsStructKind ( kind ) or mojom . IsUnionKind ( kind ) or mojom . IsEnumKind ( kind ) or mojom . IsInterfaceKind ( kind ) ) : name = self . _GetFullMojomNameForKind ( kind ) if name in seen_types : return seen_types . add ( name ) if kind . module in all_imports : seen_imports . add ( kind . module ) elif ( mojom . IsInterfaceRequestKind ( kind ) or mojom . IsAssociatedInterfaceKind ( kind ) or mojom . IsAssociatedInterfaceRequestKind ( kind ) or mojom . IsPendingRemoteKind ( kind ) or mojom . IsPendingReceiverKind ( kind ) or mojom . IsPendingAssociatedRemoteKind ( kind ) or mojom . IsPendingAssociatedReceiverKind ( kind ) ) : AddKind ( kind . kind ) for kind in self . module . structs + self . module . unions : for field in kind . fields : AddKind ( field . kind ) for interface in self . module . interfaces : for method in interface . methods : for parameter in method . parameters : AddKind ( parameter . kind ) if method . response_parameters : for parameter in method . response_parameters : AddKind ( parameter . kind ) import_files = list ( map ( lambda x : '{}.mojolpm.proto' . format ( x . path ) , seen_imports ) ) if self . needs_mojolpm_proto : import_files . append ( 'mojo/public/tools/fuzzers/mojolpm.proto' ) import_files . sort ( ) return import_files
Scans all of the types used in this module to check which of the imports
are needed for the generated proto files.
Scans all of the types used in this module to check which of the imports are needed for the generated proto files .
"""Scans all of the types used in this module to check which of the imports
    are needed for the generated proto files. This is somewhat different to the
    general case, since the generated proto files don't reference response
    parameters.
    """
self