8000 [issue-402] drop spdx version as input argument as it is automaticall… · HarshvMahawar/tools-python@d1c01f8 · GitHub
[go: up one dir, main page]

Skip to content

Commit d1c01f8

Browse files
committed
[issue-402] drop spdx version as input argument as it is automatically inferred from the creation_info
Signed-off-by: Meret Behrens <meret.behrens@tngtech.com>
1 parent 9f998b9 commit d1c01f8

File tree

4 files changed

+8
-10
lines changed

4 files changed

+8
-10
lines changed

src/spdx/writer/rdf/rdf_writer.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,7 @@
2828

2929
def write_document_to_file(document: Document, file_name: str, validate: bool):
3030
if validate:
31-
validation_messages: List[ValidationMessage] = validate_full_spdx_document(document,
32-
document.creation_info.spdx_version)
31+
validation_messages: List[ValidationMessage] = validate_full_spdx_document(document)
3332
if validation_messages:
3433
raise ValueError(f"Document is not valid. The following errors were detected: {validation_messages}")
3534

src/spdx/writer/tagvalue/tagvalue_writer.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,7 @@
2626

2727
def write_document_to_file(document: Document, file_name: str, validate: bool = True):
2828
if validate:
29-
validation_messages: List[ValidationMessage] = validate_full_spdx_document(document,
30-
document.creation_info.spdx_version)
29+
validation_messages: List[ValidationMessage] = validate_full_spdx_document(document)
3130
if validation_messages:
3231
raise ValueError(f"Document is not valid. The following errors were detected: {validation_messages}")
3332

src/spdx/writer/xml/xml_writer.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,15 +18,15 @@
1818
from spdx.validation.validation_message import ValidationMessage
1919

2020

21-
def write_document_to_file(document: Document, file_name: str, validate: bool = True, converter: DocumentConverter = None):
21+
def write_document_to_file(document: Document, file_name: str, validate: bool = True,
22+
converter: DocumentConverter = None):
2223
"""
2324
Serializes the provided document to XML and writes it to a file with the provided name. Unless validate is set
2425
to False, validates the document before serialization. Unless a DocumentConverter instance is provided,
2526
a new one is created.
2627
"""
2728
if validate:
28-
validation_messages: List[ValidationMessage] = validate_full_spdx_document(document,
29-
document.creation_info.spdx_version)
29+
validation_messages: List[ValidationMessage] = validate_full_spdx_document(document)
3030
if validation_messages:
3131
raise ValueError(f"Document is not valid. The following errors were detected: {validation_messages}")
3232
if converter is None:

src/spdx/writer/yaml/yaml_writer.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,15 +18,15 @@
1818
from spdx.validation.validation_message import ValidationMessage
1919

2020

21-
def write_document_to_file(document: Document, file_name: str, validate: bool = True, converter: DocumentConverter = None):
21+
def write_document_to_file(document: Document, file_name: str, validate: bool = True,
22+
converter: DocumentConverter = None):
2223
"""
2324
Serializes the provided document to yaml and writes it to a file with the provided name. Unless validate is set
2425
to False, validates the document before serialization. Unless a DocumentConverter instance is provided,
2526
a new one is created.
2627
"""
2728
if validate:
28-
validation_messages: List[ValidationMessage] = validate_full_spdx_document(document,
29-
document.creation_info.spdx_version)
29+
validation_messages: List[ValidationMessage] = validate_full_spdx_document(document)
3030
if validation_messages:
3131
raise ValueError(f"Document is not valid. The following errors were detected: {validation_messages}")
3232
if converter is None:

0 commit comments

Comments
 (0)
0