spdx_tools.spdx3.writer.console.spdx_collection_writer
1# SPDX-FileCopyrightText: 2023 spdx contributors 2# 3# SPDX-License-Identifier: Apache-2.0 4from beartype.typing import TextIO 5 6from spdx_tools.spdx3.model import ElementCollection 7from spdx_tools.spdx3.writer.console.element_writer import write_element_properties 8from spdx_tools.spdx3.writer.console.external_map_writer import write_external_map 9from spdx_tools.spdx3.writer.console.namespace_map_writer import write_namespace_map 10from spdx_tools.spdx.writer.tagvalue.tagvalue_writer_helper_functions import write_optional_heading 11 12 13def write_collection(collection: ElementCollection, text_output: TextIO): 14 write_element_properties(collection, text_output) 15 text_output.write(f"elements: {', '.join(collection.element)}\n") 16 write_optional_heading(collection.namespaces, "# Namespaces\n", text_output) 17 for namespace_map in collection.namespaces: 18 write_namespace_map(namespace_map, text_output) 19 write_optional_heading(collection.imports, "# Imports\n", text_output) 20 for external_map in collection.imports: 21 write_external_map(external_map, text_output)
def
write_collection( collection: spdx_tools.spdx3.model.spdx_collection.ElementCollection, text_output: <class 'TextIO'>):
14def write_collection(collection: ElementCollection, text_output: TextIO): 15 write_element_properties(collection, text_output) 16 text_output.write(f"elements: {', '.join(collection.element)}\n") 17 write_optional_heading(collection.namespaces, "# Namespaces\n", text_output) 18 for namespace_map in collection.namespaces: 19 write_namespace_map(namespace_map, text_output) 20 write_optional_heading(collection.imports, "# Imports\n", text_output) 21 for external_map in collection.imports: 22 write_external_map(external_map, text_output)