Beispiel #1
0
    def RenderArtifacts(self, artifacts, custom_artifacts=None):
        if custom_artifacts is None:
            custom_artifacts = set()

        result = []
        for artifact_val in artifacts:
            descriptor = artifact_registry.ArtifactDescriptor(
                artifact=artifact_val,
                artifact_source=artifact_val.ToPrettyJson(extended=True),
                dependencies=sorted(artifact_val.GetArtifactDependencies()),
                path_dependencies=sorted(
                    artifact_val.GetArtifactPathDependencies()),
                is_custom=artifact_val.name in custom_artifacts)

            for processor in parsers.Parser.GetClassesByArtifact(
                    artifact_val.name):
                descriptor.processors.append(
                    artifact_registry.ArtifactProcessorDescriptor(
                        name=processor.__name__,
                        output_types=processor.output_types,
                        description=processor.GetDescription()))

            result.append(api_value_renderers.RenderValue(descriptor))

        return result
Beispiel #2
0
  def RenderArtifacts(self, artifacts):
    result = []
    for artifact_val in artifacts:
      descriptor = artifact_registry.ArtifactDescriptor(
          artifact=artifact_val,
          artifact_source=artifact_val.ToPrettyJson(extended=True),
          dependencies=sorted(artifact_val.GetArtifactDependencies()),
          path_dependencies=sorted(artifact_val.GetArtifactPathDependencies()),
          error_message=artifact_val.error_message,
          is_custom=artifact_val.loaded_from.startswith("datastore:"))

      for processor in parsers.Parser.GetClassesByArtifact(artifact_val.name):
        descriptor.processors.append(
            artifact_registry.ArtifactProcessorDescriptor(
                name=processor.__name__,
                output_types=processor.output_types,
                description=processor.GetDescription()))

      result.append(api_value_renderers.RenderValue(descriptor))

    return result