spdx_tools.spdx3.writer.console.software.file_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.software import File
 7from spdx_tools.spdx3.writer.console.artifact_writer import write_artifact_properties
 8from spdx_tools.spdx3.writer.console.console import write_value
 9
10
11def write_file(file: File, text_output: TextIO):
12    text_output.write("## File\n")
13    write_artifact_properties(file, text_output)
14
15    for property_name in File.__annotations__.keys():
16        if property_name == "file_purpose":
17            write_value(
18                property_name, ", ".join([purpose.name for purpose in getattr(file, property_name)]), text_output
19            )
20            continue
21        write_value(property_name, getattr(file, property_name), text_output)
def write_file( file: spdx_tools.spdx3.model.software.file.File, text_output: <class 'TextIO'>):
12def write_file(file: File, text_output: TextIO):
13    text_output.write("## File\n")
14    write_artifact_properties(file, text_output)
15
16    for property_name in File.__annotations__.keys():
17        if property_name == "file_purpose":
18            write_value(
19                property_name, ", ".join([purpose.name for purpose in getattr(file, property_name)]), text_output
20            )
21            continue
22        write_value(property_name, getattr(file, property_name), text_output)