spdx_tools.spdx.writer.tagvalue.extracted_licensing_info_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.model import ExtractedLicensingInfo 15from spdx_tools.spdx.writer.tagvalue.tagvalue_writer_helper_functions import write_text_value, write_value 16 17 18def write_extracted_licensing_info(extracted_licensing_info: ExtractedLicensingInfo, text_output: TextIO): 19 write_value("LicenseID", extracted_licensing_info.license_id, text_output) 20 write_text_value("ExtractedText", extracted_licensing_info.extracted_text, text_output) 21 write_value("LicenseName", extracted_licensing_info.license_name, text_output) 22 23 for cross_reference in sorted(extracted_licensing_info.cross_references): 24 write_value("LicenseCrossReference", cross_reference, text_output) 25 26 write_text_value("LicenseComment", extracted_licensing_info.comment, text_output)
def
write_extracted_licensing_info( extracted_licensing_info: spdx_tools.spdx.model.extracted_licensing_info.ExtractedLicensingInfo, text_output: <class 'TextIO'>):
19def write_extracted_licensing_info(extracted_licensing_info: ExtractedLicensingInfo, text_output: TextIO): 20 write_value("LicenseID", extracted_licensing_info.license_id, text_output) 21 write_text_value("ExtractedText", extracted_licensing_info.extracted_text, text_output) 22 write_value("LicenseName", extracted_licensing_info.license_name, text_output) 23 24 for cross_reference in sorted(extracted_licensing_info.cross_references): 25 write_value("LicenseCrossReference", cross_reference, text_output) 26 27 write_text_value("LicenseComment", extracted_licensing_info.comment, text_output)