spdx_tools.spdx3.writer.console.external_map_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 ExternalMap
 7from spdx_tools.spdx3.writer.console.console import write_value
 8from spdx_tools.spdx3.writer.console.hash_writer import write_hash
 9from spdx_tools.spdx.writer.tagvalue.tagvalue_writer_helper_functions import write_optional_heading
10
11
12def write_external_map(external_map: ExternalMap, text_output: TextIO):
13    write_value("external_id", external_map.external_id, text_output)
14    write_optional_heading(external_map.verified_using, "verified using\n", text_output)
15    for integrity_method in external_map.verified_using:
16        # for now Hash is the only child class of the abstract class IntegrityMethod,
17        # as soon as there are more inherited classes we need to implement a logic
18        # that determines the correct write function for the "integrity_method" object
19        write_hash(integrity_method, text_output, heading=False)
20    write_value("location_hint", external_map.location_hint, text_output)
def write_external_map( external_map: spdx_tools.spdx3.model.external_map.ExternalMap, text_output: <class 'TextIO'>):
13def write_external_map(external_map: ExternalMap, text_output: TextIO):
14    write_value("external_id", external_map.external_id, text_output)
15    write_optional_heading(external_map.verified_using, "verified using\n", text_output)
16    for integrity_method in external_map.verified_using:
17        # for now Hash is the only child class of the abstract class IntegrityMethod,
18        # as soon as there are more inherited classes we need to implement a logic
19        # that determines the correct write function for the "integrity_method" object
20        write_hash(integrity_method, text_output, heading=False)
21    write_value("location_hint", external_map.location_hint, text_output)