spdx_tools.spdx.writer.tagvalue.annotation_writer
1# SPDX-License-Identifier: Apache-2.0 2# Copyright (c) 2022 spdx contributors 3# Licensed under the Apache License, Version 2.0 (the "License"); 4# you may not use this file except in compliance with the License. 5# You may obtain a copy of the License at 6# http://www.apache.org/licenses/LICENSE-2.0 7# Unless required by applicable law or agreed to in writing, software 8# distributed under the License is distributed on an "AS IS" BASIS, 9# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 10# See the License for the specific language governing permissions and 11# limitations under the License. 12from beartype.typing import TextIO 13 14from spdx_tools.spdx.datetime_conversions import datetime_to_iso_string 15from spdx_tools.spdx.model import Annotation 16from spdx_tools.spdx.writer.tagvalue.tagvalue_writer_helper_functions import write_text_value, write_value 17 18 19def write_annotation(annotation: Annotation, text_output: TextIO): 20 write_value("Annotator", annotation.annotator.to_serialized_string(), text_output) 21 write_value("AnnotationDate", datetime_to_iso_string(annotation.annotation_date), text_output) 22 write_value("AnnotationType", annotation.annotation_type.name, text_output) 23 write_value("SPDXREF", annotation.spdx_id, text_output) 24 write_text_value("AnnotationComment", annotation.annotation_comment, text_output)
def
write_annotation( annotation: spdx_tools.spdx.model.annotation.Annotation, text_output: <class 'TextIO'>):
20def write_annotation(annotation: Annotation, text_output: TextIO): 21 write_value("Annotator", annotation.annotator.to_serialized_string(), text_output) 22 write_value("AnnotationDate", datetime_to_iso_string(annotation.annotation_date), text_output) 23 write_value("AnnotationType", annotation.annotation_type.name, text_output) 24 write_value("SPDXREF", annotation.spdx_id, text_output) 25 write_text_value("AnnotationComment", annotation.annotation_comment, text_output)