diff --git a/.github/workflows/install_and_test.yml b/.github/workflows/install_and_test.yml index 14842b008..eb3539380 100644 --- a/.github/workflows/install_and_test.yml +++ b/.github/workflows/install_and_test.yml @@ -26,3 +26,5 @@ jobs: shell: bash - name: Run tests run: pytest + - name: Run CLI + run: pyspdxtools -i ./tests/data/formats/SPDXJSONExample-v2.3.spdx.json diff --git a/pyproject.toml b/pyproject.toml index 4d03a65d2..352933462 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -31,7 +31,7 @@ dynamic = ["version"] test = ["pytest"] [project.scripts] -pyspdxtools = "src.clitools.pyspdxtools:main" +pyspdxtools = "spdx.clitools.pyspdxtools:main" [tool.setuptools] zip-safe = false # because of the uses of __file__: https://github.com/spdx/tools-python/issues/257 diff --git a/src/__init__.py b/src/spdx/__init__.py similarity index 100% rename from src/__init__.py rename to src/spdx/__init__.py diff --git a/src/clitools/__init__.py b/src/spdx/clitools/__init__.py similarity index 100% rename from src/clitools/__init__.py rename to src/spdx/clitools/__init__.py diff --git a/src/clitools/pyspdxtools.py b/src/spdx/clitools/pyspdxtools.py similarity index 89% rename from src/clitools/pyspdxtools.py rename to src/spdx/clitools/pyspdxtools.py index d9dbed945..1f98b624a 100644 --- a/src/clitools/pyspdxtools.py +++ b/src/spdx/clitools/pyspdxtools.py @@ -15,12 +15,12 @@ import click -from src.model.document import Document -from src.parser.parse_anything import parse_file -from src.validation.document_validator import validate_full_spdx_document -from src.validation.validation_message import ValidationMessage -from src.writer.tagvalue import tagvalue_writer -from src.writer.write_anything import write_file +from spdx.model.document import Document +from spdx.parser.parse_anything import parse_file +from spdx.validation.document_validator import validate_full_spdx_document +from spdx.validation.validation_message import ValidationMessage +from spdx.writer.tagvalue import tagvalue_writer +from spdx.writer.write_anything import write_file @click.command() diff --git a/src/config.py b/src/spdx/config.py similarity index 98% rename from src/config.py rename to src/spdx/config.py index e48aacdfa..3830fbfe3 100644 --- a/src/config.py +++ b/src/spdx/config.py @@ -13,7 +13,7 @@ import json import os -from src.model.version import Version +from spdx.model.version import Version _base_dir = os.path.dirname(__file__) _licenses = os.path.join(_base_dir, "licenses.json") diff --git a/src/datetime_conversions.py b/src/spdx/datetime_conversions.py similarity index 100% rename from src/datetime_conversions.py rename to src/spdx/datetime_conversions.py diff --git a/src/document_utils.py b/src/spdx/document_utils.py similarity index 95% rename from src/document_utils.py rename to src/spdx/document_utils.py index 2f727bbe4..10947a719 100644 --- a/src/document_utils.py +++ b/src/spdx/document_utils.py @@ -10,7 +10,7 @@ # limitations under the License. from typing import List -from src.model.document import Document +from spdx.model.document import Document def get_contained_spdx_element_ids(document: Document) -> List[str]: diff --git a/src/exceptions.json b/src/spdx/exceptions.json similarity index 100% rename from src/exceptions.json rename to src/spdx/exceptions.json diff --git a/src/formats.py b/src/spdx/formats.py similarity index 96% rename from src/formats.py rename to src/spdx/formats.py index 2c1aa72f9..2b6b2d64c 100644 --- a/src/formats.py +++ b/src/spdx/formats.py @@ -10,7 +10,7 @@ # limitations under the License. from enum import Enum, auto -from src.parser.error import SPDXParsingError +from spdx.parser.error import SPDXParsingError class FileFormat(Enum): diff --git a/src/jsonschema/__init__.py b/src/spdx/jsonschema/__init__.py similarity index 100% rename from src/jsonschema/__init__.py rename to src/spdx/jsonschema/__init__.py diff --git a/src/jsonschema/annotation_converter.py b/src/spdx/jsonschema/annotation_converter.py similarity index 82% rename from src/jsonschema/annotation_converter.py rename to src/spdx/jsonschema/annotation_converter.py index 65bd3a889..c4bf4277e 100644 --- a/src/jsonschema/annotation_converter.py +++ b/src/spdx/jsonschema/annotation_converter.py @@ -10,12 +10,12 @@ # limitations under the License. from typing import Type, Any -from src.datetime_conversions import datetime_to_iso_string -from src.jsonschema.annotation_properties import AnnotationProperty -from src.jsonschema.converter import TypedConverter -from src.jsonschema.json_property import JsonProperty -from src.model.annotation import Annotation -from src.model.document import Document +from spdx.datetime_conversions import datetime_to_iso_string +from spdx.jsonschema.annotation_properties import AnnotationProperty +from spdx.jsonschema.converter import TypedConverter +from spdx.jsonschema.json_property import JsonProperty +from spdx.model.annotation import Annotation +from spdx.model.document import Document class AnnotationConverter(TypedConverter[Annotation]): diff --git a/src/jsonschema/annotation_properties.py b/src/spdx/jsonschema/annotation_properties.py similarity index 93% rename from src/jsonschema/annotation_properties.py rename to src/spdx/jsonschema/annotation_properties.py index 24b6121bf..ffed44494 100644 --- a/src/jsonschema/annotation_properties.py +++ b/src/spdx/jsonschema/annotation_properties.py @@ -10,7 +10,7 @@ # limitations under the License. from enum import auto -from src.jsonschema.json_property import JsonProperty +from spdx.jsonschema.json_property import JsonProperty class AnnotationProperty(JsonProperty): diff --git a/src/jsonschema/checksum_converter.py b/src/spdx/jsonschema/checksum_converter.py similarity index 84% rename from src/jsonschema/checksum_converter.py rename to src/spdx/jsonschema/checksum_converter.py index 8eb5f3172..6782adba2 100644 --- a/src/jsonschema/checksum_converter.py +++ b/src/spdx/jsonschema/checksum_converter.py @@ -10,11 +10,11 @@ # limitations under the License. from typing import Type -from src.jsonschema.checksum_properties import ChecksumProperty -from src.jsonschema.converter import TypedConverter -from src.jsonschema.json_property import JsonProperty -from src.model.checksum import Checksum, ChecksumAlgorithm -from src.model.document import Document +from spdx.jsonschema.checksum_properties import ChecksumProperty +from spdx.jsonschema.converter import TypedConverter +from spdx.jsonschema.json_property import JsonProperty +from spdx.model.checksum import Checksum, ChecksumAlgorithm +from spdx.model.document import Document class ChecksumConverter(TypedConverter[Checksum]): diff --git a/src/jsonschema/checksum_properties.py b/src/spdx/jsonschema/checksum_properties.py similarity index 92% rename from src/jsonschema/checksum_properties.py rename to src/spdx/jsonschema/checksum_properties.py index 9f975f64c..d0733fa65 100644 --- a/src/jsonschema/checksum_properties.py +++ b/src/spdx/jsonschema/checksum_properties.py @@ -10,7 +10,7 @@ # limitations under the License. from enum import auto -from src.jsonschema.json_property import JsonProperty +from spdx.jsonschema.json_property import JsonProperty class ChecksumProperty(JsonProperty): diff --git a/src/jsonschema/converter.py b/src/spdx/jsonschema/converter.py similarity index 95% rename from src/jsonschema/converter.py rename to src/spdx/jsonschema/converter.py index 2016d943d..e6f362568 100644 --- a/src/jsonschema/converter.py +++ b/src/spdx/jsonschema/converter.py @@ -11,9 +11,9 @@ from abc import ABC, abstractmethod from typing import Any, Type, Dict, TypeVar, Generic -from src.jsonschema.json_property import JsonProperty -from src.model.document import Document -from src.writer.casing_tools import snake_case_to_camel_case +from spdx.jsonschema.json_property import JsonProperty +from spdx.model.document import Document +from spdx.writer.casing_tools import snake_case_to_camel_case MISSING_IMPLEMENTATION_MESSAGE = "Must be implemented" diff --git a/src/jsonschema/creation_info_converter.py b/src/spdx/jsonschema/creation_info_converter.py similarity index 81% rename from src/jsonschema/creation_info_converter.py rename to src/spdx/jsonschema/creation_info_converter.py index fc51ba83e..c4896659a 100644 --- a/src/jsonschema/creation_info_converter.py +++ b/src/spdx/jsonschema/creation_info_converter.py @@ -10,12 +10,12 @@ # limitations under the License. from typing import Type, Any -from src.datetime_conversions import datetime_to_iso_string -from src.jsonschema.converter import TypedConverter -from src.jsonschema.creation_info_properties import CreationInfoProperty -from src.jsonschema.json_property import JsonProperty -from src.jsonschema.optional_utils import apply_if_present -from src.model.document import CreationInfo, Document +from spdx.datetime_conversions import datetime_to_iso_string +from spdx.jsonschema.converter import TypedConverter +from spdx.jsonschema.creation_info_properties import CreationInfoProperty +from spdx.jsonschema.json_property import JsonProperty +from spdx.jsonschema.optional_utils import apply_if_present +from spdx.model.document import CreationInfo, Document class CreationInfoConverter(TypedConverter[CreationInfo]): diff --git a/src/jsonschema/creation_info_properties.py b/src/spdx/jsonschema/creation_info_properties.py similarity index 93% rename from src/jsonschema/creation_info_properties.py rename to src/spdx/jsonschema/creation_info_properties.py index ccd52f58c..35acc20ba 100644 --- a/src/jsonschema/creation_info_properties.py +++ b/src/spdx/jsonschema/creation_info_properties.py @@ -10,7 +10,7 @@ # limitations under the License. from enum import auto -from src.jsonschema.json_property import JsonProperty +from spdx.jsonschema.json_property import JsonProperty class CreationInfoProperty(JsonProperty): diff --git a/src/jsonschema/document_converter.py b/src/spdx/jsonschema/document_converter.py similarity index 86% rename from src/jsonschema/document_converter.py rename to src/spdx/jsonschema/document_converter.py index 7730a3842..71a3c76c5 100644 --- a/src/jsonschema/document_converter.py +++ b/src/spdx/jsonschema/document_converter.py @@ -10,21 +10,21 @@ # limitations under the License. from typing import Type, Any -from src.document_utils import get_contained_spdx_element_ids -from src.jsonschema.annotation_converter import AnnotationConverter -from src.jsonschema.converter import TypedConverter -from src.jsonschema.creation_info_converter import CreationInfoConverter -from src.jsonschema.document_properties import DocumentProperty -from src.jsonschema.external_document_ref_converter import ExternalDocumentRefConverter -from src.jsonschema.extracted_licensing_info_converter import ExtractedLicensingInfoConverter -from src.jsonschema.file_converter import FileConverter -from src.jsonschema.json_property import JsonProperty -from src.jsonschema.package_converter import PackageConverter -from src.jsonschema.relationship_converter import RelationshipConverter -from src.jsonschema.snippet_converter import SnippetConverter -from src.model.document import Document -from src.model.relationship import RelationshipType -from src.model.relationship_filters import filter_by_type_and_origin, filter_by_type_and_target, \ +from spdx.document_utils import get_contained_spdx_element_ids +from spdx.jsonschema.annotation_converter import AnnotationConverter +from spdx.jsonschema.converter import TypedConverter +from spdx.jsonschema.creation_info_converter import CreationInfoConverter +from spdx.jsonschema.document_properties import DocumentProperty +from spdx.jsonschema.external_document_ref_converter import ExternalDocumentRefConverter +from spdx.jsonschema.extracted_licensing_info_converter import ExtractedLicensingInfoConverter +from spdx.jsonschema.file_converter import FileConverter +from spdx.jsonschema.json_property import JsonProperty +from spdx.jsonschema.package_converter import PackageConverter +from spdx.jsonschema.relationship_converter import RelationshipConverter +from spdx.jsonschema.snippet_converter import SnippetConverter +from spdx.model.document import Document +from spdx.model.relationship import RelationshipType +from spdx.model.relationship_filters import filter_by_type_and_origin, filter_by_type_and_target, \ find_package_contains_file_relationships, \ find_file_contained_by_package_relationships diff --git a/src/jsonschema/document_properties.py b/src/spdx/jsonschema/document_properties.py similarity index 94% rename from src/jsonschema/document_properties.py rename to src/spdx/jsonschema/document_properties.py index 52eefa836..7acd02520 100644 --- a/src/jsonschema/document_properties.py +++ b/src/spdx/jsonschema/document_properties.py @@ -10,7 +10,7 @@ # limitations under the License. from enum import auto -from src.jsonschema.json_property import JsonProperty +from spdx.jsonschema.json_property import JsonProperty class DocumentProperty(JsonProperty): diff --git a/src/jsonschema/external_document_ref_converter.py b/src/spdx/jsonschema/external_document_ref_converter.py similarity index 82% rename from src/jsonschema/external_document_ref_converter.py rename to src/spdx/jsonschema/external_document_ref_converter.py index 9e022a4ab..023b38136 100644 --- a/src/jsonschema/external_document_ref_converter.py +++ b/src/spdx/jsonschema/external_document_ref_converter.py @@ -10,12 +10,12 @@ # limitations under the License. from typing import Type, Any -from src.jsonschema.checksum_converter import ChecksumConverter -from src.jsonschema.converter import TypedConverter -from src.jsonschema.external_document_ref_properties import ExternalDocumentRefProperty -from src.jsonschema.json_property import JsonProperty -from src.model.document import Document -from src.model.external_document_ref import ExternalDocumentRef +from spdx.jsonschema.checksum_converter import ChecksumConverter +from spdx.jsonschema.converter import TypedConverter +from spdx.jsonschema.external_document_ref_properties import ExternalDocumentRefProperty +from spdx.jsonschema.json_property import JsonProperty +from spdx.model.document import Document +from spdx.model.external_document_ref import ExternalDocumentRef class ExternalDocumentRefConverter(TypedConverter[ExternalDocumentRef]): diff --git a/src/jsonschema/external_document_ref_properties.py b/src/spdx/jsonschema/external_document_ref_properties.py similarity index 93% rename from src/jsonschema/external_document_ref_properties.py rename to src/spdx/jsonschema/external_document_ref_properties.py index ac76b9e03..d014e4e77 100644 --- a/src/jsonschema/external_document_ref_properties.py +++ b/src/spdx/jsonschema/external_document_ref_properties.py @@ -10,7 +10,7 @@ # limitations under the License. from enum import auto -from src.jsonschema.json_property import JsonProperty +from spdx.jsonschema.json_property import JsonProperty class ExternalDocumentRefProperty(JsonProperty): diff --git a/src/jsonschema/external_package_ref_converter.py b/src/spdx/jsonschema/external_package_ref_converter.py similarity index 84% rename from src/jsonschema/external_package_ref_converter.py rename to src/spdx/jsonschema/external_package_ref_converter.py index 38047b6d9..f1374c7c2 100644 --- a/src/jsonschema/external_package_ref_converter.py +++ b/src/spdx/jsonschema/external_package_ref_converter.py @@ -10,11 +10,11 @@ # limitations under the License. from typing import Type, Any -from src.jsonschema.converter import TypedConverter -from src.jsonschema.external_package_ref_properties import ExternalPackageRefProperty -from src.jsonschema.json_property import JsonProperty -from src.model.document import Document -from src.model.package import ExternalPackageRef +from spdx.jsonschema.converter import TypedConverter +from spdx.jsonschema.external_package_ref_properties import ExternalPackageRefProperty +from spdx.jsonschema.json_property import JsonProperty +from spdx.model.document import Document +from spdx.model.package import ExternalPackageRef class ExternalPackageRefConverter(TypedConverter[ExternalPackageRef]): diff --git a/src/jsonschema/external_package_ref_properties.py b/src/spdx/jsonschema/external_package_ref_properties.py similarity index 93% rename from src/jsonschema/external_package_ref_properties.py rename to src/spdx/jsonschema/external_package_ref_properties.py index fceee06ba..9c90f3317 100644 --- a/src/jsonschema/external_package_ref_properties.py +++ b/src/spdx/jsonschema/external_package_ref_properties.py @@ -10,7 +10,7 @@ # limitations under the License. from enum import auto -from src.jsonschema.json_property import JsonProperty +from spdx.jsonschema.json_property import JsonProperty class ExternalPackageRefProperty(JsonProperty): diff --git a/src/jsonschema/extracted_licensing_info_converter.py b/src/spdx/jsonschema/extracted_licensing_info_converter.py similarity index 83% rename from src/jsonschema/extracted_licensing_info_converter.py rename to src/spdx/jsonschema/extracted_licensing_info_converter.py index 32a523bcd..3d198e3d6 100644 --- a/src/jsonschema/extracted_licensing_info_converter.py +++ b/src/spdx/jsonschema/extracted_licensing_info_converter.py @@ -10,12 +10,12 @@ # limitations under the License. from typing import Type, Any -from src.jsonschema.converter import TypedConverter -from src.jsonschema.extracted_licensing_info_properties import ExtractedLicensingInfoProperty -from src.jsonschema.json_property import JsonProperty -from src.jsonschema.optional_utils import apply_if_present -from src.model.document import Document -from src.model.extracted_licensing_info import ExtractedLicensingInfo +from spdx.jsonschema.converter import TypedConverter +from spdx.jsonschema.extracted_licensing_info_properties import ExtractedLicensingInfoProperty +from spdx.jsonschema.json_property import JsonProperty +from spdx.jsonschema.optional_utils import apply_if_present +from spdx.model.document import Document +from spdx.model.extracted_licensing_info import ExtractedLicensingInfo class ExtractedLicensingInfoConverter(TypedConverter[ExtractedLicensingInfo]): diff --git a/src/jsonschema/extracted_licensing_info_properties.py b/src/spdx/jsonschema/extracted_licensing_info_properties.py similarity index 93% rename from src/jsonschema/extracted_licensing_info_properties.py rename to src/spdx/jsonschema/extracted_licensing_info_properties.py index 97e97ed5e..f1b793fbe 100644 --- a/src/jsonschema/extracted_licensing_info_properties.py +++ b/src/spdx/jsonschema/extracted_licensing_info_properties.py @@ -10,7 +10,7 @@ # limitations under the License. from enum import auto -from src.jsonschema.json_property import JsonProperty +from spdx.jsonschema.json_property import JsonProperty class ExtractedLicensingInfoProperty(JsonProperty): diff --git a/src/jsonschema/file_converter.py b/src/spdx/jsonschema/file_converter.py similarity index 88% rename from src/jsonschema/file_converter.py rename to src/spdx/jsonschema/file_converter.py index 7aecbea02..78af0b90f 100644 --- a/src/jsonschema/file_converter.py +++ b/src/spdx/jsonschema/file_converter.py @@ -10,14 +10,14 @@ # limitations under the License. from typing import Type, Any -from src.jsonschema.annotation_converter import AnnotationConverter -from src.jsonschema.checksum_converter import ChecksumConverter -from src.jsonschema.converter import TypedConverter -from src.jsonschema.file_properties import FileProperty -from src.jsonschema.json_property import JsonProperty -from src.jsonschema.optional_utils import apply_if_present -from src.model.document import Document -from src.model.file import File +from spdx.jsonschema.annotation_converter import AnnotationConverter +from spdx.jsonschema.checksum_converter import ChecksumConverter +from spdx.jsonschema.converter import TypedConverter +from spdx.jsonschema.file_properties import FileProperty +from spdx.jsonschema.json_property import JsonProperty +from spdx.jsonschema.optional_utils import apply_if_present +from spdx.model.document import Document +from spdx.model.file import File class FileConverter(TypedConverter[File]): diff --git a/src/jsonschema/file_properties.py b/src/spdx/jsonschema/file_properties.py similarity index 94% rename from src/jsonschema/file_properties.py rename to src/spdx/jsonschema/file_properties.py index c4101aeef..8706a092f 100644 --- a/src/jsonschema/file_properties.py +++ b/src/spdx/jsonschema/file_properties.py @@ -10,7 +10,7 @@ # limitations under the License. from enum import auto -from src.jsonschema.json_property import JsonProperty +from spdx.jsonschema.json_property import JsonProperty class FileProperty(JsonProperty): diff --git a/src/jsonschema/json_property.py b/src/spdx/jsonschema/json_property.py similarity index 100% rename from src/jsonschema/json_property.py rename to src/spdx/jsonschema/json_property.py diff --git a/src/jsonschema/optional_utils.py b/src/spdx/jsonschema/optional_utils.py similarity index 100% rename from src/jsonschema/optional_utils.py rename to src/spdx/jsonschema/optional_utils.py diff --git a/src/jsonschema/package_converter.py b/src/spdx/jsonschema/package_converter.py similarity index 88% rename from src/jsonschema/package_converter.py rename to src/spdx/jsonschema/package_converter.py index 3f569c8a8..5929f7794 100644 --- a/src/jsonschema/package_converter.py +++ b/src/spdx/jsonschema/package_converter.py @@ -10,19 +10,19 @@ # limitations under the License. from typing import Type, Any -from src.datetime_conversions import datetime_to_iso_string -from src.jsonschema.annotation_converter import AnnotationConverter -from src.jsonschema.checksum_converter import ChecksumConverter -from src.jsonschema.converter import TypedConverter -from src.jsonschema.external_package_ref_converter import ExternalPackageRefConverter -from src.jsonschema.json_property import JsonProperty -from src.jsonschema.optional_utils import apply_if_present -from src.jsonschema.package_properties import PackageProperty -from src.jsonschema.package_verification_code_converter import PackageVerificationCodeConverter -from src.model.actor import Actor -from src.model.document import Document -from src.model.package import Package -from src.model.relationship_filters import find_package_contains_file_relationships, \ +from spdx.datetime_conversions import datetime_to_iso_string +from spdx.jsonschema.annotation_converter import AnnotationConverter +from spdx.jsonschema.checksum_converter import ChecksumConverter +from spdx.jsonschema.converter import TypedConverter +from spdx.jsonschema.external_package_ref_converter import ExternalPackageRefConverter +from spdx.jsonschema.json_property import JsonProperty +from spdx.jsonschema.optional_utils import apply_if_present +from spdx.jsonschema.package_properties import PackageProperty +from spdx.jsonschema.package_verification_code_converter import PackageVerificationCodeConverter +from spdx.model.actor import Actor +from spdx.model.document import Document +from spdx.model.package import Package +from spdx.model.relationship_filters import find_package_contains_file_relationships, \ find_file_contained_by_package_relationships diff --git a/src/jsonschema/package_properties.py b/src/spdx/jsonschema/package_properties.py similarity index 96% rename from src/jsonschema/package_properties.py rename to src/spdx/jsonschema/package_properties.py index 4d5319718..b59d94723 100644 --- a/src/jsonschema/package_properties.py +++ b/src/spdx/jsonschema/package_properties.py @@ -10,7 +10,7 @@ # limitations under the License. from enum import auto -from src.jsonschema.json_property import JsonProperty +from spdx.jsonschema.json_property import JsonProperty class PackageProperty(JsonProperty): diff --git a/src/jsonschema/package_verification_code_converter.py b/src/spdx/jsonschema/package_verification_code_converter.py similarity index 82% rename from src/jsonschema/package_verification_code_converter.py rename to src/spdx/jsonschema/package_verification_code_converter.py index e9e24dcde..a45bf1727 100644 --- a/src/jsonschema/package_verification_code_converter.py +++ b/src/spdx/jsonschema/package_verification_code_converter.py @@ -10,11 +10,11 @@ # limitations under the License. from typing import Type, Any -from src.jsonschema.converter import TypedConverter -from src.jsonschema.json_property import JsonProperty -from src.jsonschema.package_verification_code_properties import PackageVerificationCodeProperty -from src.model.document import Document -from src.model.package import PackageVerificationCode +from spdx.jsonschema.converter import TypedConverter +from spdx.jsonschema.json_property import JsonProperty +from spdx.jsonschema.package_verification_code_properties import PackageVerificationCodeProperty +from spdx.model.document import Document +from spdx.model.package import PackageVerificationCode class PackageVerificationCodeConverter(TypedConverter[PackageVerificationCode]): diff --git a/src/jsonschema/package_verification_code_properties.py b/src/spdx/jsonschema/package_verification_code_properties.py similarity index 93% rename from src/jsonschema/package_verification_code_properties.py rename to src/spdx/jsonschema/package_verification_code_properties.py index 88e4aa50d..845058469 100644 --- a/src/jsonschema/package_verification_code_properties.py +++ b/src/spdx/jsonschema/package_verification_code_properties.py @@ -10,7 +10,7 @@ # limitations under the License. from enum import auto -from src.jsonschema.json_property import JsonProperty +from spdx.jsonschema.json_property import JsonProperty class PackageVerificationCodeProperty(JsonProperty): diff --git a/src/jsonschema/relationship_converter.py b/src/spdx/jsonschema/relationship_converter.py similarity index 84% rename from src/jsonschema/relationship_converter.py rename to src/spdx/jsonschema/relationship_converter.py index 264d83c57..f6d8d8d97 100644 --- a/src/jsonschema/relationship_converter.py +++ b/src/spdx/jsonschema/relationship_converter.py @@ -10,11 +10,11 @@ # limitations under the License. from typing import Type, Any -from src.jsonschema.converter import TypedConverter -from src.jsonschema.json_property import JsonProperty -from src.jsonschema.relationship_properties import RelationshipProperty -from src.model.document import Document -from src.model.relationship import Relationship +from spdx.jsonschema.converter import TypedConverter +from spdx.jsonschema.json_property import JsonProperty +from spdx.jsonschema.relationship_properties import RelationshipProperty +from spdx.model.document import Document +from spdx.model.relationship import Relationship class RelationshipConverter(TypedConverter[Relationship]): diff --git a/src/jsonschema/relationship_properties.py b/src/spdx/jsonschema/relationship_properties.py similarity index 93% rename from src/jsonschema/relationship_properties.py rename to src/spdx/jsonschema/relationship_properties.py index 2bac5ac5b..f5461f1ce 100644 --- a/src/jsonschema/relationship_properties.py +++ b/src/spdx/jsonschema/relationship_properties.py @@ -10,7 +10,7 @@ # limitations under the License. from enum import auto -from src.jsonschema.json_property import JsonProperty +from spdx.jsonschema.json_property import JsonProperty class RelationshipProperty(JsonProperty): diff --git a/src/jsonschema/snippet_converter.py b/src/spdx/jsonschema/snippet_converter.py similarity index 91% rename from src/jsonschema/snippet_converter.py rename to src/spdx/jsonschema/snippet_converter.py index 68289b618..0d3013e53 100644 --- a/src/jsonschema/snippet_converter.py +++ b/src/spdx/jsonschema/snippet_converter.py @@ -10,13 +10,13 @@ # limitations under the License. from typing import Type, Any, Tuple, Dict -from src.jsonschema.annotation_converter import AnnotationConverter -from src.jsonschema.converter import TypedConverter -from src.jsonschema.json_property import JsonProperty -from src.jsonschema.optional_utils import apply_if_present -from src.jsonschema.snippet_properties import SnippetProperty -from src.model.document import Document -from src.model.snippet import Snippet +from spdx.jsonschema.annotation_converter import AnnotationConverter +from spdx.jsonschema.converter import TypedConverter +from spdx.jsonschema.json_property import JsonProperty +from spdx.jsonschema.optional_utils import apply_if_present +from spdx.jsonschema.snippet_properties import SnippetProperty +from spdx.model.document import Document +from spdx.model.snippet import Snippet class SnippetConverter(TypedConverter[Snippet]): diff --git a/src/jsonschema/snippet_properties.py b/src/spdx/jsonschema/snippet_properties.py similarity index 94% rename from src/jsonschema/snippet_properties.py rename to src/spdx/jsonschema/snippet_properties.py index f9cb12918..2fd5eadd8 100644 --- a/src/jsonschema/snippet_properties.py +++ b/src/spdx/jsonschema/snippet_properties.py @@ -10,7 +10,7 @@ # limitations under the License. from enum import auto -from src.jsonschema.json_property import JsonProperty +from spdx.jsonschema.json_property import JsonProperty class SnippetProperty(JsonProperty): diff --git a/src/licenses.json b/src/spdx/licenses.json similarity index 100% rename from src/licenses.json rename to src/spdx/licenses.json diff --git a/src/model/__init__.py b/src/spdx/model/__init__.py similarity index 100% rename from src/model/__init__.py rename to src/spdx/model/__init__.py diff --git a/src/model/actor.py b/src/spdx/model/actor.py similarity index 89% rename from src/model/actor.py rename to src/spdx/model/actor.py index a44da8939..f058b0b03 100644 --- a/src/model/actor.py +++ b/src/spdx/model/actor.py @@ -11,8 +11,8 @@ from enum import Enum, auto from typing import Optional -from src.model.typing.dataclass_with_properties import dataclass_with_properties -from src.model.typing.type_checks import check_types_and_set_values +from spdx.model.typing.dataclass_with_properties import dataclass_with_properties +from spdx.model.typing.type_checks import check_types_and_set_values class ActorType(Enum): diff --git a/src/model/annotation.py b/src/spdx/model/annotation.py similarity index 85% rename from src/model/annotation.py rename to src/spdx/model/annotation.py index 02e92aae5..0e9d2e66b 100644 --- a/src/model/annotation.py +++ b/src/spdx/model/annotation.py @@ -11,9 +11,9 @@ from datetime import datetime from enum import Enum, auto -from src.model.actor import Actor -from src.model.typing.dataclass_with_properties import dataclass_with_properties -from src.model.typing.type_checks import check_types_and_set_values +from spdx.model.actor import Actor +from spdx.model.typing.dataclass_with_properties import dataclass_with_properties +from spdx.model.typing.type_checks import check_types_and_set_values class AnnotationType(Enum): diff --git a/src/model/checksum.py b/src/spdx/model/checksum.py similarity index 88% rename from src/model/checksum.py rename to src/spdx/model/checksum.py index 3555fa45b..775892b08 100644 --- a/src/model/checksum.py +++ b/src/spdx/model/checksum.py @@ -10,8 +10,8 @@ # limitations under the License. from enum import auto, Enum -from src.model.typing.dataclass_with_properties import dataclass_with_properties -from src.model.typing.type_checks import check_types_and_set_values +from spdx.model.typing.dataclass_with_properties import dataclass_with_properties +from spdx.model.typing.type_checks import check_types_and_set_values class ChecksumAlgorithm(Enum): diff --git a/src/model/document.py b/src/spdx/model/document.py similarity index 83% rename from src/model/document.py rename to src/spdx/model/document.py index a11f1c615..1dfac798e 100644 --- a/src/model/document.py +++ b/src/spdx/model/document.py @@ -12,17 +12,17 @@ from datetime import datetime from typing import List, Optional -from src.model.actor import Actor -from src.model.annotation import Annotation -from src.model.typing.dataclass_with_properties import dataclass_with_properties -from src.model.external_document_ref import ExternalDocumentRef -from src.model.extracted_licensing_info import ExtractedLicensingInfo -from src.model.file import File -from src.model.package import Package -from src.model.relationship import Relationship -from src.model.snippet import Snippet -from src.model.typing.type_checks import check_types_and_set_values -from src.model.version import Version +from spdx.model.actor import Actor +from spdx.model.annotation import Annotation +from spdx.model.typing.dataclass_with_properties import dataclass_with_properties +from spdx.model.external_document_ref import ExternalDocumentRef +from spdx.model.extracted_licensing_info import ExtractedLicensingInfo +from spdx.model.file import File +from spdx.model.package import Package +from spdx.model.relationship import Relationship +from spdx.model.snippet import Snippet +from spdx.model.typing.type_checks import check_types_and_set_values +from spdx.model.version import Version @dataclass_with_properties diff --git a/src/model/external_document_ref.py b/src/spdx/model/external_document_ref.py similarity index 82% rename from src/model/external_document_ref.py rename to src/spdx/model/external_document_ref.py index 52010c938..6e3b807bb 100644 --- a/src/model/external_document_ref.py +++ b/src/spdx/model/external_document_ref.py @@ -9,9 +9,9 @@ # See the License for the specific language governing permissions and # limitations under the License. -from src.model.checksum import Checksum -from src.model.typing.dataclass_with_properties import dataclass_with_properties -from src.model.typing.type_checks import check_types_and_set_values +from spdx.model.checksum import Checksum +from spdx.model.typing.dataclass_with_properties import dataclass_with_properties +from spdx.model.typing.type_checks import check_types_and_set_values @dataclass_with_properties diff --git a/src/model/extracted_licensing_info.py b/src/spdx/model/extracted_licensing_info.py similarity index 86% rename from src/model/extracted_licensing_info.py rename to src/spdx/model/extracted_licensing_info.py index 659f996c8..97574b4a0 100644 --- a/src/model/extracted_licensing_info.py +++ b/src/spdx/model/extracted_licensing_info.py @@ -11,9 +11,9 @@ from dataclasses import field from typing import Optional, List, Union -from src.model.spdx_no_assertion import SpdxNoAssertion -from src.model.typing.dataclass_with_properties import dataclass_with_properties -from src.model.typing.type_checks import check_types_and_set_values +from spdx.model.spdx_no_assertion import SpdxNoAssertion +from spdx.model.typing.dataclass_with_properties import dataclass_with_properties +from spdx.model.typing.type_checks import check_types_and_set_values @dataclass_with_properties diff --git a/src/model/file.py b/src/spdx/model/file.py similarity index 89% rename from src/model/file.py rename to src/spdx/model/file.py index 6fd15ed4a..fa23f54e5 100644 --- a/src/model/file.py +++ b/src/spdx/model/file.py @@ -12,12 +12,12 @@ from enum import Enum, auto from typing import Optional, List, Union -from src.model.checksum import Checksum -from src.model.typing.dataclass_with_properties import dataclass_with_properties -from src.model.license_expression import LicenseExpression -from src.model.spdx_no_assertion import SpdxNoAssertion -from src.model.spdx_none import SpdxNone -from src.model.typing.type_checks import check_types_and_set_values +from spdx.model.checksum import Checksum +from spdx.model.typing.dataclass_with_properties import dataclass_with_properties +from spdx.model.license_expression import LicenseExpression +from spdx.model.spdx_no_assertion import SpdxNoAssertion +from spdx.model.spdx_none import SpdxNone +from spdx.model.typing.type_checks import check_types_and_set_values class FileType(Enum): diff --git a/src/model/license.py b/src/spdx/model/license.py similarity index 98% rename from src/model/license.py rename to src/spdx/model/license.py index dce4cbee5..f0ea53ac1 100644 --- a/src/model/license.py +++ b/src/spdx/model/license.py @@ -10,7 +10,7 @@ # limitations under the License. -from src import config +from spdx import config def determine_full_name(identifier: str, full_name: str): diff --git a/src/model/license_expression.py b/src/spdx/model/license_expression.py similarity index 86% rename from src/model/license_expression.py rename to src/spdx/model/license_expression.py index 226b5e438..291242b63 100644 --- a/src/model/license_expression.py +++ b/src/spdx/model/license_expression.py @@ -9,8 +9,8 @@ # See the License for the specific language governing permissions and # limitations under the License. -from src.model.typing.dataclass_with_properties import dataclass_with_properties -from src.model.typing.type_checks import check_types_and_set_values +from spdx.model.typing.dataclass_with_properties import dataclass_with_properties +from spdx.model.typing.type_checks import check_types_and_set_values @dataclass_with_properties diff --git a/src/model/package.py b/src/spdx/model/package.py similarity index 93% rename from src/model/package.py rename to src/spdx/model/package.py index b9ab7e0a0..6a1836fdd 100644 --- a/src/model/package.py +++ b/src/spdx/model/package.py @@ -13,13 +13,13 @@ from enum import Enum, auto from typing import Optional, Union, List -from src.model.actor import Actor -from src.model.checksum import Checksum -from src.model.typing.dataclass_with_properties import dataclass_with_properties -from src.model.license_expression import LicenseExpression -from src.model.spdx_no_assertion import SpdxNoAssertion -from src.model.spdx_none import SpdxNone -from src.model.typing.type_checks import check_types_and_set_values +from spdx.model.actor import Actor +from spdx.model.checksum import Checksum +from spdx.model.typing.dataclass_with_properties import dataclass_with_properties +from spdx.model.license_expression import LicenseExpression +from spdx.model.spdx_no_assertion import SpdxNoAssertion +from spdx.model.spdx_none import SpdxNone +from spdx.model.typing.type_checks import check_types_and_set_values class PackagePurpose(Enum): diff --git a/src/model/relationship.py b/src/spdx/model/relationship.py similarity index 90% rename from src/model/relationship.py rename to src/spdx/model/relationship.py index 88026c9fd..6e639af70 100644 --- a/src/model/relationship.py +++ b/src/spdx/model/relationship.py @@ -11,10 +11,10 @@ from enum import auto, Enum from typing import Optional, Union -from src.model.spdx_no_assertion import SpdxNoAssertion -from src.model.spdx_none import SpdxNone -from src.model.typing.dataclass_with_properties import dataclass_with_properties -from src.model.typing.type_checks import check_types_and_set_values +from spdx.model.spdx_no_assertion import SpdxNoAssertion +from spdx.model.spdx_none import SpdxNone +from spdx.model.typing.dataclass_with_properties import dataclass_with_properties +from spdx.model.typing.type_checks import check_types_and_set_values class RelationshipType(Enum): diff --git a/src/model/relationship_filters.py b/src/spdx/model/relationship_filters.py similarity index 94% rename from src/model/relationship_filters.py rename to src/spdx/model/relationship_filters.py index 7b075dd6a..f981578e3 100644 --- a/src/model/relationship_filters.py +++ b/src/spdx/model/relationship_filters.py @@ -10,9 +10,9 @@ # limitations under the License. from typing import List -from src.model.document import Document -from src.model.package import Package -from src.model.relationship import Relationship, RelationshipType +from spdx.model.document import Document +from spdx.model.package import Package +from spdx.model.relationship import Relationship, RelationshipType def find_package_contains_file_relationships(document: Document, package: Package) -> List[Relationship]: diff --git a/src/model/snippet.py b/src/spdx/model/snippet.py similarity index 86% rename from src/model/snippet.py rename to src/spdx/model/snippet.py index 690647fad..5fba0c69d 100644 --- a/src/model/snippet.py +++ b/src/spdx/model/snippet.py @@ -11,11 +11,11 @@ from dataclasses import field from typing import Tuple, Optional, List, Union -from src.model.typing.dataclass_with_properties import dataclass_with_properties -from src.model.license_expression import LicenseExpression -from src.model.spdx_no_assertion import SpdxNoAssertion -from src.model.spdx_none import SpdxNone -from src.model.typing.type_checks import check_types_and_set_values +from spdx.model.typing.dataclass_with_properties import dataclass_with_properties +from spdx.model.license_expression import LicenseExpression +from spdx.model.spdx_no_assertion import SpdxNoAssertion +from spdx.model.spdx_none import SpdxNone +from spdx.model.typing.type_checks import check_types_and_set_values @dataclass_with_properties diff --git a/src/model/spdx_no_assertion.py b/src/spdx/model/spdx_no_assertion.py similarity index 100% rename from src/model/spdx_no_assertion.py rename to src/spdx/model/spdx_no_assertion.py diff --git a/src/model/spdx_none.py b/src/spdx/model/spdx_none.py similarity index 100% rename from src/model/spdx_none.py rename to src/spdx/model/spdx_none.py diff --git a/src/model/typing/__init__.py b/src/spdx/model/typing/__init__.py similarity index 100% rename from src/model/typing/__init__.py rename to src/spdx/model/typing/__init__.py diff --git a/src/model/typing/constructor_type_errors.py b/src/spdx/model/typing/constructor_type_errors.py similarity index 100% rename from src/model/typing/constructor_type_errors.py rename to src/spdx/model/typing/constructor_type_errors.py diff --git a/src/model/typing/dataclass_with_properties.py b/src/spdx/model/typing/dataclass_with_properties.py similarity index 100% rename from src/model/typing/dataclass_with_properties.py rename to src/spdx/model/typing/dataclass_with_properties.py diff --git a/src/model/typing/type_checks.py b/src/spdx/model/typing/type_checks.py similarity index 93% rename from src/model/typing/type_checks.py rename to src/spdx/model/typing/type_checks.py index ab3b39fe4..b06ab5d34 100644 --- a/src/model/typing/type_checks.py +++ b/src/spdx/model/typing/type_checks.py @@ -1,6 +1,6 @@ from typing import Any, Dict -from src.model.typing.constructor_type_errors import ConstructorTypeErrors +from spdx.model.typing.constructor_type_errors import ConstructorTypeErrors def check_types_and_set_values(instance_under_construction: Any, local_variables: Dict) -> None: diff --git a/src/model/version.py b/src/spdx/model/version.py similarity index 100% rename from src/model/version.py rename to src/spdx/model/version.py diff --git a/src/parser/__init__.py b/src/spdx/parser/__init__.py similarity index 100% rename from src/parser/__init__.py rename to src/spdx/parser/__init__.py diff --git a/src/parser/error.py b/src/spdx/parser/error.py similarity index 100% rename from src/parser/error.py rename to src/spdx/parser/error.py diff --git a/src/parser/json/__init__.py b/src/spdx/parser/json/__init__.py similarity index 100% rename from src/parser/json/__init__.py rename to src/spdx/parser/json/__init__.py diff --git a/src/parser/json/json_parser.py b/src/spdx/parser/json/json_parser.py similarity index 87% rename from src/parser/json/json_parser.py rename to src/spdx/parser/json/json_parser.py index 290c896d7..9ee169b3c 100644 --- a/src/parser/json/json_parser.py +++ b/src/spdx/parser/json/json_parser.py @@ -11,8 +11,8 @@ import json from typing import Dict -from src.model.document import Document -from src.parser.jsonlikedict.json_like_dict_parser import JsonLikeDictParser +from spdx.model.document import Document +from spdx.parser.jsonlikedict.json_like_dict_parser import JsonLikeDictParser def parse_from_file(file_name: str) -> Document: diff --git a/src/parser/jsonlikedict/__init__.py b/src/spdx/parser/jsonlikedict/__init__.py similarity index 100% rename from src/parser/jsonlikedict/__init__.py rename to src/spdx/parser/jsonlikedict/__init__.py diff --git a/src/parser/jsonlikedict/actor_parser.py b/src/spdx/parser/jsonlikedict/actor_parser.py similarity index 92% rename from src/parser/jsonlikedict/actor_parser.py rename to src/spdx/parser/jsonlikedict/actor_parser.py index 907233aa7..9126782a4 100644 --- a/src/parser/jsonlikedict/actor_parser.py +++ b/src/spdx/parser/jsonlikedict/actor_parser.py @@ -11,9 +11,9 @@ import re from typing import Pattern, Match, Optional -from src.model.actor import Actor, ActorType -from src.parser.error import SPDXParsingError -from src.parser.jsonlikedict.dict_parsing_functions import construct_or_raise_parsing_error +from spdx.model.actor import Actor, ActorType +from spdx.parser.error import SPDXParsingError +from spdx.parser.jsonlikedict.dict_parsing_functions import construct_or_raise_parsing_error class ActorParser: diff --git a/src/parser/jsonlikedict/annotation_parser.py b/src/spdx/parser/jsonlikedict/annotation_parser.py similarity index 93% rename from src/parser/jsonlikedict/annotation_parser.py rename to src/spdx/parser/jsonlikedict/annotation_parser.py index 8fa928228..bdfd5e3df 100644 --- a/src/parser/jsonlikedict/annotation_parser.py +++ b/src/spdx/parser/jsonlikedict/annotation_parser.py @@ -11,14 +11,14 @@ from datetime import datetime from typing import Dict, Optional, List -from src.model.actor import Actor -from src.model.annotation import Annotation, AnnotationType -from src.parser.error import SPDXParsingError -from src.parser.jsonlikedict.actor_parser import ActorParser -from src.parser.jsonlikedict.dict_parsing_functions import construct_or_raise_parsing_error, \ +from spdx.model.actor import Actor +from spdx.model.annotation import Annotation, AnnotationType +from spdx.parser.error import SPDXParsingError +from spdx.parser.jsonlikedict.actor_parser import ActorParser +from spdx.parser.jsonlikedict.dict_parsing_functions import construct_or_raise_parsing_error, \ parse_field_or_log_error, append_parsed_field_or_log_error, raise_parsing_error_if_logger_has_messages -from src.datetime_conversions import datetime_from_str -from src.parser.logger import Logger +from spdx.datetime_conversions import datetime_from_str +from spdx.parser.logger import Logger class AnnotationParser: diff --git a/src/parser/jsonlikedict/checksum_parser.py b/src/spdx/parser/jsonlikedict/checksum_parser.py similarity index 86% rename from src/parser/jsonlikedict/checksum_parser.py rename to src/spdx/parser/jsonlikedict/checksum_parser.py index a73a9d443..bd03b57a6 100644 --- a/src/parser/jsonlikedict/checksum_parser.py +++ b/src/spdx/parser/jsonlikedict/checksum_parser.py @@ -10,10 +10,10 @@ # limitations under the License. from typing import Dict, Optional -from src.model.checksum import Checksum, ChecksumAlgorithm -from src.parser.jsonlikedict.dict_parsing_functions import raise_parsing_error_if_logger_has_messages, json_str_to_enum_name, \ +from spdx.model.checksum import Checksum, ChecksumAlgorithm +from spdx.parser.jsonlikedict.dict_parsing_functions import raise_parsing_error_if_logger_has_messages, json_str_to_enum_name, \ construct_or_raise_parsing_error -from src.parser.logger import Logger +from spdx.parser.logger import Logger class ChecksumParser: diff --git a/src/parser/jsonlikedict/creation_info_parser.py b/src/spdx/parser/jsonlikedict/creation_info_parser.py similarity index 91% rename from src/parser/jsonlikedict/creation_info_parser.py rename to src/spdx/parser/jsonlikedict/creation_info_parser.py index 4b51056ad..c628bdc89 100644 --- a/src/parser/jsonlikedict/creation_info_parser.py +++ b/src/spdx/parser/jsonlikedict/creation_info_parser.py @@ -11,19 +11,19 @@ from datetime import datetime from typing import Dict, Optional, List -from src.model.actor import Actor -from src.model.checksum import Checksum -from src.model.document import CreationInfo -from src.model.external_document_ref import ExternalDocumentRef -from src.model.version import Version -from src.parser.error import SPDXParsingError -from src.parser.jsonlikedict.actor_parser import ActorParser -from src.parser.jsonlikedict.checksum_parser import ChecksumParser -from src.parser.jsonlikedict.dict_parsing_functions import append_parsed_field_or_log_error, \ +from spdx.model.actor import Actor +from spdx.model.checksum import Checksum +from spdx.model.document import CreationInfo +from spdx.model.external_document_ref import ExternalDocumentRef +from spdx.model.version import Version +from spdx.parser.error import SPDXParsingError +from spdx.parser.jsonlikedict.actor_parser import ActorParser +from spdx.parser.jsonlikedict.checksum_parser import ChecksumParser +from spdx.parser.jsonlikedict.dict_parsing_functions import append_parsed_field_or_log_error, \ raise_parsing_error_if_logger_has_messages, construct_or_raise_parsing_error, parse_field_or_log_error, \ parse_field_or_no_assertion -from src.datetime_conversions import datetime_from_str -from src.parser.logger import Logger +from spdx.datetime_conversions import datetime_from_str +from spdx.parser.logger import Logger class CreationInfoParser: diff --git a/src/parser/jsonlikedict/dict_parsing_functions.py b/src/spdx/parser/jsonlikedict/dict_parsing_functions.py similarity index 93% rename from src/parser/jsonlikedict/dict_parsing_functions.py rename to src/spdx/parser/jsonlikedict/dict_parsing_functions.py index 2f7359924..f5d361067 100644 --- a/src/parser/jsonlikedict/dict_parsing_functions.py +++ b/src/spdx/parser/jsonlikedict/dict_parsing_functions.py @@ -10,11 +10,11 @@ # limitations under the License. from typing import Any, Callable, Dict, List, Optional -from src.model.spdx_no_assertion import SpdxNoAssertion -from src.model.spdx_none import SpdxNone -from src.model.typing.constructor_type_errors import ConstructorTypeErrors -from src.parser.error import SPDXParsingError -from src.parser.logger import Logger +from spdx.model.spdx_no_assertion import SpdxNoAssertion +from spdx.model.spdx_none import SpdxNone +from spdx.model.typing.constructor_type_errors import ConstructorTypeErrors +from spdx.parser.error import SPDXParsingError +from spdx.parser.logger import Logger def json_str_to_enum_name(json_str: str) -> str: diff --git a/src/parser/jsonlikedict/extracted_licensing_info_parser.py b/src/spdx/parser/jsonlikedict/extracted_licensing_info_parser.py similarity index 87% rename from src/parser/jsonlikedict/extracted_licensing_info_parser.py rename to src/spdx/parser/jsonlikedict/extracted_licensing_info_parser.py index 1c6b51e85..0d70ccaba 100644 --- a/src/parser/jsonlikedict/extracted_licensing_info_parser.py +++ b/src/spdx/parser/jsonlikedict/extracted_licensing_info_parser.py @@ -10,10 +10,10 @@ # limitations under the License. from typing import Dict, List, Optional, Union -from src.model.extracted_licensing_info import ExtractedLicensingInfo -from src.model.spdx_no_assertion import SpdxNoAssertion -from src.parser.jsonlikedict.dict_parsing_functions import construct_or_raise_parsing_error, parse_field_or_no_assertion -from src.parser.logger import Logger +from spdx.model.extracted_licensing_info import ExtractedLicensingInfo +from spdx.model.spdx_no_assertion import SpdxNoAssertion +from spdx.parser.jsonlikedict.dict_parsing_functions import construct_or_raise_parsing_error, parse_field_or_no_assertion +from spdx.parser.logger import Logger class ExtractedLicensingInfoParser: diff --git a/src/parser/jsonlikedict/file_parser.py b/src/spdx/parser/jsonlikedict/file_parser.py similarity index 88% rename from src/parser/jsonlikedict/file_parser.py rename to src/spdx/parser/jsonlikedict/file_parser.py index 0c63c7f24..44a62b5ab 100644 --- a/src/parser/jsonlikedict/file_parser.py +++ b/src/spdx/parser/jsonlikedict/file_parser.py @@ -10,17 +10,17 @@ # limitations under the License. from typing import Dict, List, Optional, Union -from src.model.checksum import Checksum -from src.model.file import File, FileType -from src.model.license_expression import LicenseExpression -from src.model.spdx_no_assertion import SpdxNoAssertion -from src.model.spdx_none import SpdxNone -from src.parser.jsonlikedict.checksum_parser import ChecksumParser -from src.parser.jsonlikedict.dict_parsing_functions import raise_parsing_error_if_logger_has_messages, \ +from spdx.model.checksum import Checksum +from spdx.model.file import File, FileType +from spdx.model.license_expression import LicenseExpression +from spdx.model.spdx_no_assertion import SpdxNoAssertion +from spdx.model.spdx_none import SpdxNone +from spdx.parser.jsonlikedict.checksum_parser import ChecksumParser +from spdx.parser.jsonlikedict.dict_parsing_functions import raise_parsing_error_if_logger_has_messages, \ construct_or_raise_parsing_error, parse_field_or_log_error, \ parse_field_or_no_assertion_or_none -from src.parser.jsonlikedict.license_expression_parser import LicenseExpressionParser -from src.parser.logger import Logger +from spdx.parser.jsonlikedict.license_expression_parser import LicenseExpressionParser +from spdx.parser.logger import Logger class FileParser: diff --git a/src/parser/jsonlikedict/json_like_dict_parser.py b/src/spdx/parser/jsonlikedict/json_like_dict_parser.py similarity index 84% rename from src/parser/jsonlikedict/json_like_dict_parser.py rename to src/spdx/parser/jsonlikedict/json_like_dict_parser.py index db78629bb..213f9da50 100644 --- a/src/parser/jsonlikedict/json_like_dict_parser.py +++ b/src/spdx/parser/jsonlikedict/json_like_dict_parser.py @@ -11,18 +11,18 @@ import json from typing import Dict -from src.model.document import Document -from src.parser.error import SPDXParsingError -from src.parser.jsonlikedict.annotation_parser import AnnotationParser -from src.parser.jsonlikedict.creation_info_parser import CreationInfoParser -from src.parser.jsonlikedict.dict_parsing_functions import raise_parsing_error_if_logger_has_messages, \ +from spdx.model.document import Document +from spdx.parser.error import SPDXParsingError +from spdx.parser.jsonlikedict.annotation_parser import AnnotationParser +from spdx.parser.jsonlikedict.creation_info_parser import CreationInfoParser +from spdx.parser.jsonlikedict.dict_parsing_functions import raise_parsing_error_if_logger_has_messages, \ construct_or_raise_parsing_error, parse_list_of_elements -from src.parser.jsonlikedict.extracted_licensing_info_parser import ExtractedLicensingInfoParser -from src.parser.jsonlikedict.file_parser import FileParser -from src.parser.logger import Logger -from src.parser.jsonlikedict.package_parser import PackageParser -from src.parser.jsonlikedict.relationship_parser import RelationshipParser -from src.parser.jsonlikedict.snippet_parser import SnippetParser +from spdx.parser.jsonlikedict.extracted_licensing_info_parser import ExtractedLicensingInfoParser +from spdx.parser.jsonlikedict.file_parser import FileParser +from spdx.parser.logger import Logger +from spdx.parser.jsonlikedict.package_parser import PackageParser +from spdx.parser.jsonlikedict.relationship_parser import RelationshipParser +from spdx.parser.jsonlikedict.snippet_parser import SnippetParser class JsonLikeDictParser: diff --git a/src/parser/jsonlikedict/license_expression_parser.py b/src/spdx/parser/jsonlikedict/license_expression_parser.py similarity index 87% rename from src/parser/jsonlikedict/license_expression_parser.py rename to src/spdx/parser/jsonlikedict/license_expression_parser.py index b1ce2468a..663d53af8 100644 --- a/src/parser/jsonlikedict/license_expression_parser.py +++ b/src/spdx/parser/jsonlikedict/license_expression_parser.py @@ -10,11 +10,11 @@ # limitations under the License. from typing import Union, List -from src.model.license_expression import LicenseExpression -from src.parser.error import SPDXParsingError -from src.parser.jsonlikedict.dict_parsing_functions import construct_or_raise_parsing_error, append_parsed_field_or_log_error, \ +from spdx.model.license_expression import LicenseExpression +from spdx.parser.error import SPDXParsingError +from spdx.parser.jsonlikedict.dict_parsing_functions import construct_or_raise_parsing_error, append_parsed_field_or_log_error, \ raise_parsing_error_if_logger_has_messages -from src.parser.logger import Logger +from spdx.parser.logger import Logger class LicenseExpressionParser: diff --git a/src/parser/jsonlikedict/package_parser.py b/src/spdx/parser/jsonlikedict/package_parser.py similarity index 93% rename from src/parser/jsonlikedict/package_parser.py rename to src/spdx/parser/jsonlikedict/package_parser.py index 45ab46b3f..d2677f5c3 100644 --- a/src/parser/jsonlikedict/package_parser.py +++ b/src/spdx/parser/jsonlikedict/package_parser.py @@ -11,21 +11,21 @@ from datetime import datetime from typing import Dict, List, Optional, Union -from src.model.actor import Actor -from src.model.license_expression import LicenseExpression -from src.model.package import Package, ExternalPackageRef, PackageVerificationCode, PackagePurpose, \ +from spdx.model.actor import Actor +from spdx.model.license_expression import LicenseExpression +from spdx.model.package import Package, ExternalPackageRef, PackageVerificationCode, PackagePurpose, \ ExternalPackageRefCategory -from src.model.spdx_no_assertion import SpdxNoAssertion -from src.model.spdx_none import SpdxNone -from src.parser.error import SPDXParsingError -from src.parser.jsonlikedict.actor_parser import ActorParser -from src.parser.jsonlikedict.checksum_parser import ChecksumParser -from src.parser.jsonlikedict.dict_parsing_functions import append_parsed_field_or_log_error, \ +from spdx.model.spdx_no_assertion import SpdxNoAssertion +from spdx.model.spdx_none import SpdxNone +from spdx.parser.error import SPDXParsingError +from spdx.parser.jsonlikedict.actor_parser import ActorParser +from spdx.parser.jsonlikedict.checksum_parser import ChecksumParser +from spdx.parser.jsonlikedict.dict_parsing_functions import append_parsed_field_or_log_error, \ raise_parsing_error_if_logger_has_messages, json_str_to_enum_name, construct_or_raise_parsing_error, \ parse_field_or_log_error, parse_field_or_no_assertion_or_none, parse_field_or_no_assertion -from src.datetime_conversions import datetime_from_str -from src.parser.jsonlikedict.license_expression_parser import LicenseExpressionParser -from src.parser.logger import Logger +from spdx.datetime_conversions import datetime_from_str +from spdx.parser.jsonlikedict.license_expression_parser import LicenseExpressionParser +from spdx.parser.logger import Logger class PackageParser: diff --git a/src/parser/jsonlikedict/relationship_parser.py b/src/spdx/parser/jsonlikedict/relationship_parser.py similarity index 96% rename from src/parser/jsonlikedict/relationship_parser.py rename to src/spdx/parser/jsonlikedict/relationship_parser.py index 5221f1c15..f17a63738 100644 --- a/src/parser/jsonlikedict/relationship_parser.py +++ b/src/spdx/parser/jsonlikedict/relationship_parser.py @@ -10,13 +10,13 @@ # limitations under the License. from typing import Dict, List, Optional -from src.model.relationship import Relationship, RelationshipType -from src.model.typing.constructor_type_errors import ConstructorTypeErrors -from src.parser.error import SPDXParsingError -from src.parser.jsonlikedict.dict_parsing_functions import raise_parsing_error_if_logger_has_messages, json_str_to_enum_name, \ +from spdx.model.relationship import Relationship, RelationshipType +from spdx.model.typing.constructor_type_errors import ConstructorTypeErrors +from spdx.parser.error import SPDXParsingError +from spdx.parser.jsonlikedict.dict_parsing_functions import raise_parsing_error_if_logger_has_messages, json_str_to_enum_name, \ construct_or_raise_parsing_error, \ parse_field_or_log_error, parse_field_or_no_assertion_or_none -from src.parser.logger import Logger +from spdx.parser.logger import Logger class RelationshipParser: diff --git a/src/parser/jsonlikedict/snippet_parser.py b/src/spdx/parser/jsonlikedict/snippet_parser.py similarity index 92% rename from src/parser/jsonlikedict/snippet_parser.py rename to src/spdx/parser/jsonlikedict/snippet_parser.py index 778defc9f..f0a8fef9c 100644 --- a/src/parser/jsonlikedict/snippet_parser.py +++ b/src/spdx/parser/jsonlikedict/snippet_parser.py @@ -11,16 +11,16 @@ from enum import auto, Enum from typing import Dict, Tuple, List, Optional, Union -from src.model.license_expression import LicenseExpression -from src.model.snippet import Snippet -from src.model.spdx_no_assertion import SpdxNoAssertion -from src.model.spdx_none import SpdxNone -from src.parser.error import SPDXParsingError -from src.parser.jsonlikedict.dict_parsing_functions import construct_or_raise_parsing_error, parse_field_or_log_error, \ +from spdx.model.license_expression import LicenseExpression +from spdx.model.snippet import Snippet +from spdx.model.spdx_no_assertion import SpdxNoAssertion +from spdx.model.spdx_none import SpdxNone +from spdx.parser.error import SPDXParsingError +from spdx.parser.jsonlikedict.dict_parsing_functions import construct_or_raise_parsing_error, parse_field_or_log_error, \ parse_field_or_no_assertion_or_none -from src.parser.jsonlikedict.license_expression_parser import LicenseExpressionParser -from src.parser.logger import Logger +from spdx.parser.jsonlikedict.license_expression_parser import LicenseExpressionParser +from spdx.parser.logger import Logger class RangeType(Enum): diff --git a/src/parser/logger.py b/src/spdx/parser/logger.py similarity index 100% rename from src/parser/logger.py rename to src/spdx/parser/logger.py diff --git a/src/parser/parse_anything.py b/src/spdx/parser/parse_anything.py similarity index 87% rename from src/parser/parse_anything.py rename to src/spdx/parser/parse_anything.py index eae23db85..0180abe92 100644 --- a/src/parser/parse_anything.py +++ b/src/spdx/parser/parse_anything.py @@ -8,10 +8,10 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. -from src.formats import file_name_to_format, FileFormat -from src.parser.json import json_parser -from src.parser.xml import xml_parser -from src.parser.yaml import yaml_parser +from spdx.formats import file_name_to_format, FileFormat +from spdx.parser.json import json_parser +from spdx.parser.xml import xml_parser +from spdx.parser.yaml import yaml_parser def parse_file(file_name: str): diff --git a/src/parser/xml/__init__.py b/src/spdx/parser/xml/__init__.py similarity index 100% rename from src/parser/xml/__init__.py rename to src/spdx/parser/xml/__init__.py diff --git a/src/parser/xml/xml_parser.py b/src/spdx/parser/xml/xml_parser.py similarity index 93% rename from src/parser/xml/xml_parser.py rename to src/spdx/parser/xml/xml_parser.py index f1e6b8d20..ccccd15d3 100644 --- a/src/parser/xml/xml_parser.py +++ b/src/spdx/parser/xml/xml_parser.py @@ -12,9 +12,9 @@ import xmltodict -from src.model.document import Document -from src.parser.error import SPDXParsingError -from src.parser.jsonlikedict.json_like_dict_parser import JsonLikeDictParser +from spdx.model.document import Document +from spdx.parser.error import SPDXParsingError +from spdx.parser.jsonlikedict.json_like_dict_parser import JsonLikeDictParser LIST_LIKE_FIELDS = [ diff --git a/src/parser/yaml/__init__.py b/src/spdx/parser/yaml/__init__.py similarity index 100% rename from src/parser/yaml/__init__.py rename to src/spdx/parser/yaml/__init__.py diff --git a/src/parser/yaml/yaml_parser.py b/src/spdx/parser/yaml/yaml_parser.py similarity index 87% rename from src/parser/yaml/yaml_parser.py rename to src/spdx/parser/yaml/yaml_parser.py index e0595f065..b3750938d 100644 --- a/src/parser/yaml/yaml_parser.py +++ b/src/spdx/parser/yaml/yaml_parser.py @@ -12,8 +12,8 @@ import yaml -from src.model.document import Document -from src.parser.jsonlikedict.json_like_dict_parser import JsonLikeDictParser +from spdx.model.document import Document +from spdx.parser.jsonlikedict.json_like_dict_parser import JsonLikeDictParser def parse_from_file(file_name: str) -> Document: diff --git a/src/validation/__init__.py b/src/spdx/validation/__init__.py similarity index 100% rename from src/validation/__init__.py rename to src/spdx/validation/__init__.py diff --git a/src/validation/actor_validator.py b/src/spdx/validation/actor_validator.py similarity index 90% rename from src/validation/actor_validator.py rename to src/spdx/validation/actor_validator.py index 4c596a440..033d2e94c 100644 --- a/src/validation/actor_validator.py +++ b/src/spdx/validation/actor_validator.py @@ -11,8 +11,8 @@ from typing import List -from src.model.actor import Actor, ActorType -from src.validation.validation_message import ValidationMessage, ValidationContext, SpdxElementType +from spdx.model.actor import Actor, ActorType +from spdx.validation.validation_message import ValidationMessage, ValidationContext, SpdxElementType def validate_actors(actors: List[Actor], parent_id: str) -> List[ValidationMessage]: diff --git a/src/validation/annotation_validator.py b/src/spdx/validation/annotation_validator.py similarity index 82% rename from src/validation/annotation_validator.py rename to src/spdx/validation/annotation_validator.py index 2b11fb498..407b2f7b5 100644 --- a/src/validation/annotation_validator.py +++ b/src/spdx/validation/annotation_validator.py @@ -11,11 +11,11 @@ from typing import List -from src.model.annotation import Annotation -from src.model.document import Document -from src.validation.actor_validator import validate_actor -from src.validation.spdx_id_validators import validate_spdx_id -from src.validation.validation_message import ValidationMessage, ValidationContext, SpdxElementType +from spdx.model.annotation import Annotation +from spdx.model.document import Document +from spdx.validation.actor_validator import validate_actor +from spdx.validation.spdx_id_validators import validate_spdx_id +from spdx.validation.validation_message import ValidationMessage, ValidationContext, SpdxElementType def validate_annotations(annotations: List[Annotation], document: Document) -> List[ValidationMessage]: diff --git a/src/validation/checksum_validator.py b/src/spdx/validation/checksum_validator.py similarity index 94% rename from src/validation/checksum_validator.py rename to src/spdx/validation/checksum_validator.py index 72962d7e4..b5f3f8078 100644 --- a/src/validation/checksum_validator.py +++ b/src/spdx/validation/checksum_validator.py @@ -12,8 +12,8 @@ import re from typing import List, Dict -from src.model.checksum import Checksum, ChecksumAlgorithm -from src.validation.validation_message import ValidationMessage, ValidationContext, SpdxElementType +from spdx.model.checksum import Checksum, ChecksumAlgorithm +from spdx.validation.validation_message import ValidationMessage, ValidationContext, SpdxElementType # in hexadecimal digits algorithm_length: Dict = { diff --git a/src/validation/creation_info_validator.py b/src/spdx/validation/creation_info_validator.py similarity index 83% rename from src/validation/creation_info_validator.py rename to src/spdx/validation/creation_info_validator.py index 3fce083f9..f4bfc81ed 100644 --- a/src/validation/creation_info_validator.py +++ b/src/spdx/validation/creation_info_validator.py @@ -12,11 +12,11 @@ import re from typing import List -from src.model.document import CreationInfo -from src.validation.actor_validator import validate_actors -from src.validation.external_document_ref_validator import validate_external_document_refs -from src.validation.uri_validators import validate_uri -from src.validation.validation_message import ValidationMessage, ValidationContext, SpdxElementType +from spdx.model.document import CreationInfo +from spdx.validation.actor_validator import validate_actors +from spdx.validation.external_document_ref_validator import validate_external_document_refs +from spdx.validation.uri_validators import validate_uri +from spdx.validation.validation_message import ValidationMessage, ValidationContext, SpdxElementType def validate_creation_info(creation_info: CreationInfo) -> List[ValidationMessage]: diff --git a/src/validation/document_validator.py b/src/spdx/validation/document_validator.py similarity index 81% rename from src/validation/document_validator.py rename to src/spdx/validation/document_validator.py index 014f5d6ba..a3fa00758 100644 --- a/src/validation/document_validator.py +++ b/src/spdx/validation/document_validator.py @@ -11,17 +11,17 @@ import re from typing import List -from src.model.document import Document -from src.model.relationship import RelationshipType -from src.model.relationship_filters import filter_by_type_and_origin, filter_by_type_and_target -from src.validation.annotation_validator import validate_annotations -from src.validation.creation_info_validator import validate_creation_info -from src.validation.extracted_licensing_info_validator import validate_extracted_licensing_infos -from src.validation.file_validator import validate_files -from src.validation.package_validator import validate_packages -from src.validation.relationship_validator import validate_relationships -from src.validation.snippet_validator import validate_snippets -from src.validation.validation_message import ValidationMessage, ValidationContext, SpdxElementType +from spdx.model.document import Document +from spdx.model.relationship import RelationshipType +from spdx.model.relationship_filters import filter_by_type_and_origin, filter_by_type_and_target +from spdx.validation.annotation_validator import validate_annotations +from spdx.validation.creation_info_validator import validate_creation_info +from spdx.validation.extracted_licensing_info_validator import validate_extracted_licensing_infos +from spdx.validation.file_validator import validate_files +from spdx.validation.package_validator import validate_packages +from spdx.validation.relationship_validator import validate_relationships +from spdx.validation.snippet_validator import validate_snippets +from spdx.validation.validation_message import ValidationMessage, ValidationContext, SpdxElementType def validate_full_spdx_document(document: Document, spdx_version: str = None) -> List[ValidationMessage]: diff --git a/src/validation/external_document_ref_validator.py b/src/spdx/validation/external_document_ref_validator.py similarity index 84% rename from src/validation/external_document_ref_validator.py rename to src/spdx/validation/external_document_ref_validator.py index 71fd2d44f..3d35434a7 100644 --- a/src/validation/external_document_ref_validator.py +++ b/src/spdx/validation/external_document_ref_validator.py @@ -11,11 +11,11 @@ from typing import List -from src.model.external_document_ref import ExternalDocumentRef -from src.validation.checksum_validator import validate_checksum -from src.validation.spdx_id_validators import is_valid_external_doc_ref_id -from src.validation.uri_validators import validate_uri -from src.validation.validation_message import ValidationMessage, ValidationContext, SpdxElementType +from spdx.model.external_document_ref import ExternalDocumentRef +from spdx.validation.checksum_validator import validate_checksum +from spdx.validation.spdx_id_validators import is_valid_external_doc_ref_id +from spdx.validation.uri_validators import validate_uri +from spdx.validation.validation_message import ValidationMessage, ValidationContext, SpdxElementType def validate_external_document_refs(external_document_refs: List[ExternalDocumentRef], parent_id: str) -> List[ diff --git a/src/validation/external_package_ref_validator.py b/src/spdx/validation/external_package_ref_validator.py similarity index 90% rename from src/validation/external_package_ref_validator.py rename to src/spdx/validation/external_package_ref_validator.py index 5e245a539..10ff0ee15 100644 --- a/src/validation/external_package_ref_validator.py +++ b/src/spdx/validation/external_package_ref_validator.py @@ -11,8 +11,8 @@ from typing import List -from src.model.package import ExternalPackageRef -from src.validation.validation_message import ValidationMessage +from spdx.model.package import ExternalPackageRef +from spdx.validation.validation_message import ValidationMessage def validate_external_package_refs(external_package_refs: List[ExternalPackageRef], parent_id: str) -> List[ diff --git a/src/validation/extracted_licensing_info_validator.py b/src/spdx/validation/extracted_licensing_info_validator.py similarity index 90% rename from src/validation/extracted_licensing_info_validator.py rename to src/spdx/validation/extracted_licensing_info_validator.py index 7797f03b8..92cd7c395 100644 --- a/src/validation/extracted_licensing_info_validator.py +++ b/src/spdx/validation/extracted_licensing_info_validator.py @@ -12,9 +12,9 @@ import re from typing import List, Optional -from src.model.extracted_licensing_info import ExtractedLicensingInfo -from src.validation.uri_validators import validate_url -from src.validation.validation_message import ValidationMessage, ValidationContext, SpdxElementType +from spdx.model.extracted_licensing_info import ExtractedLicensingInfo +from spdx.validation.uri_validators import validate_url +from spdx.validation.validation_message import ValidationMessage, ValidationContext, SpdxElementType def validate_extracted_licensing_infos(extracted_licensing_infos: Optional[List[ExtractedLicensingInfo]]) -> List[ValidationMessage]: diff --git a/src/validation/file_validator.py b/src/spdx/validation/file_validator.py similarity index 85% rename from src/validation/file_validator.py rename to src/spdx/validation/file_validator.py index 0b1104c61..33cc73242 100644 --- a/src/validation/file_validator.py +++ b/src/spdx/validation/file_validator.py @@ -11,13 +11,13 @@ from typing import List, Optional -from src.model.checksum import ChecksumAlgorithm -from src.model.document import Document -from src.model.file import File -from src.validation.checksum_validator import validate_checksums -from src.validation.license_expression_validator import validate_license_expressions, validate_license_expression -from src.validation.spdx_id_validators import validate_spdx_id -from src.validation.validation_message import ValidationMessage, ValidationContext, SpdxElementType +from spdx.model.checksum import ChecksumAlgorithm +from spdx.model.document import Document +from spdx.model.file import File +from spdx.validation.checksum_validator import validate_checksums +from spdx.validation.license_expression_validator import validate_license_expressions, validate_license_expression +from spdx.validation.spdx_id_validators import validate_spdx_id +from spdx.validation.validation_message import ValidationMessage, ValidationContext, SpdxElementType def validate_files(files: List[File], document: Optional[Document] = None) -> List[ValidationMessage]: diff --git a/src/validation/license_expression_validator.py b/src/spdx/validation/license_expression_validator.py similarity index 85% rename from src/validation/license_expression_validator.py rename to src/spdx/validation/license_expression_validator.py index 503044eb3..3146e6f00 100644 --- a/src/validation/license_expression_validator.py +++ b/src/spdx/validation/license_expression_validator.py @@ -11,10 +11,10 @@ from typing import List, Optional, Union -from src.model.license_expression import LicenseExpression -from src.model.spdx_no_assertion import SpdxNoAssertion -from src.model.spdx_none import SpdxNone -from src.validation.validation_message import ValidationMessage +from spdx.model.license_expression import LicenseExpression +from spdx.model.spdx_no_assertion import SpdxNoAssertion +from spdx.model.spdx_none import SpdxNone +from spdx.validation.validation_message import ValidationMessage def validate_license_expressions(license_expressions: Optional[ diff --git a/src/validation/package_validator.py b/src/spdx/validation/package_validator.py similarity index 87% rename from src/validation/package_validator.py rename to src/spdx/validation/package_validator.py index 68c6a1d59..5131d39e4 100644 --- a/src/validation/package_validator.py +++ b/src/spdx/validation/package_validator.py @@ -11,16 +11,16 @@ from typing import List, Optional -from src.model.document import Document -from src.model.package import Package -from src.model.relationship import RelationshipType -from src.validation.checksum_validator import validate_checksums -from src.validation.external_package_ref_validator import validate_external_package_refs -from src.validation.license_expression_validator import validate_license_expression, validate_license_expressions -from src.validation.package_verification_code_validator import validate_verification_code -from src.validation.spdx_id_validators import validate_spdx_id -from src.validation.uri_validators import validate_url, validate_download_location -from src.validation.validation_message import ValidationMessage, ValidationContext, SpdxElementType +from spdx.model.document import Document +from spdx.model.package import Package +from spdx.model.relationship import RelationshipType +from spdx.validation.checksum_validator import validate_checksums +from spdx.validation.external_package_ref_validator import validate_external_package_refs +from spdx.validation.license_expression_validator import validate_license_expression, validate_license_expressions +from spdx.validation.package_verification_code_validator import validate_verification_code +from spdx.validation.spdx_id_validators import validate_spdx_id +from spdx.validation.uri_validators import validate_url, validate_download_location +from spdx.validation.validation_message import ValidationMessage, ValidationContext, SpdxElementType def validate_packages(packages: List[Package], document: Optional[Document] = None) -> List[ValidationMessage]: diff --git a/src/validation/package_verification_code_validator.py b/src/spdx/validation/package_verification_code_validator.py similarity index 91% rename from src/validation/package_verification_code_validator.py rename to src/spdx/validation/package_verification_code_validator.py index aaf858da7..2b86520cc 100644 --- a/src/validation/package_verification_code_validator.py +++ b/src/spdx/validation/package_verification_code_validator.py @@ -12,8 +12,8 @@ import re from typing import List -from src.model.package import PackageVerificationCode -from src.validation.validation_message import ValidationMessage, ValidationContext, SpdxElementType +from spdx.model.package import PackageVerificationCode +from spdx.validation.validation_message import ValidationMessage, ValidationContext, SpdxElementType # TODO: make test for this (https://github.com/spdx/tools-python/issues/386) diff --git a/src/validation/relationship_validator.py b/src/spdx/validation/relationship_validator.py similarity index 85% rename from src/validation/relationship_validator.py rename to src/spdx/validation/relationship_validator.py index e1b48358f..f919ebaae 100644 --- a/src/validation/relationship_validator.py +++ b/src/spdx/validation/relationship_validator.py @@ -11,12 +11,12 @@ from typing import List -from src.model.document import Document -from src.model.relationship import Relationship, RelationshipType -from src.model.spdx_no_assertion import SpdxNoAssertion -from src.model.spdx_none import SpdxNone -from src.validation.spdx_id_validators import validate_spdx_id -from src.validation.validation_message import ValidationMessage, ValidationContext, SpdxElementType +from spdx.model.document import Document +from spdx.model.relationship import Relationship, RelationshipType +from spdx.model.spdx_no_assertion import SpdxNoAssertion +from spdx.model.spdx_none import SpdxNone +from spdx.validation.spdx_id_validators import validate_spdx_id +from spdx.validation.validation_message import ValidationMessage, ValidationContext, SpdxElementType def validate_relationships(relationships: List[Relationship], document: Document, spdx_version: str) -> List[ValidationMessage]: diff --git a/src/validation/snippet_validator.py b/src/spdx/validation/snippet_validator.py similarity index 91% rename from src/validation/snippet_validator.py rename to src/spdx/validation/snippet_validator.py index c17928108..3140a85a9 100644 --- a/src/validation/snippet_validator.py +++ b/src/spdx/validation/snippet_validator.py @@ -11,12 +11,12 @@ from typing import List, Optional -from src.model.document import Document -from src.model.snippet import Snippet -from src.validation.license_expression_validator import validate_license_expression, \ +from spdx.model.document import Document +from spdx.model.snippet import Snippet +from spdx.validation.license_expression_validator import validate_license_expression, \ validate_license_expressions -from src.validation.spdx_id_validators import validate_spdx_id -from src.validation.validation_message import ValidationMessage, ValidationContext, SpdxElementType +from spdx.validation.spdx_id_validators import validate_spdx_id +from spdx.validation.validation_message import ValidationMessage, ValidationContext, SpdxElementType def validate_snippets(snippets: List[Snippet], document: Optional[Document] = None) -> List[ValidationMessage]: diff --git a/src/validation/spdx_id_validators.py b/src/spdx/validation/spdx_id_validators.py similarity index 96% rename from src/validation/spdx_id_validators.py rename to src/spdx/validation/spdx_id_validators.py index d161e4e82..dfe25f416 100644 --- a/src/validation/spdx_id_validators.py +++ b/src/spdx/validation/spdx_id_validators.py @@ -12,9 +12,9 @@ import re from typing import List -from src.document_utils import get_contained_spdx_element_ids -from src.model.document import Document -from src.model.file import File +from spdx.document_utils import get_contained_spdx_element_ids +from spdx.model.document import Document +from spdx.model.file import File def is_valid_internal_spdx_id(spdx_id: str) -> bool: diff --git a/src/validation/uri_validators.py b/src/spdx/validation/uri_validators.py similarity index 100% rename from src/validation/uri_validators.py rename to src/spdx/validation/uri_validators.py diff --git a/src/validation/validation_message.py b/src/spdx/validation/validation_message.py similarity index 100% rename from src/validation/validation_message.py rename to src/spdx/validation/validation_message.py diff --git a/src/writer/__init__.py b/src/spdx/writer/__init__.py similarity index 100% rename from src/writer/__init__.py rename to src/spdx/writer/__init__.py diff --git a/src/writer/casing_tools.py b/src/spdx/writer/casing_tools.py similarity index 100% rename from src/writer/casing_tools.py rename to src/spdx/writer/casing_tools.py diff --git a/src/writer/json/__init__.py b/src/spdx/writer/json/__init__.py similarity index 100% rename from src/writer/json/__init__.py rename to src/spdx/writer/json/__init__.py diff --git a/src/writer/json/json_writer.py b/src/spdx/writer/json/json_writer.py similarity index 85% rename from src/writer/json/json_writer.py rename to src/spdx/writer/json/json_writer.py index 347f2d622..4cfef383a 100644 --- a/src/writer/json/json_writer.py +++ b/src/spdx/writer/json/json_writer.py @@ -11,10 +11,10 @@ import json from typing import List -from src.jsonschema.document_converter import DocumentConverter -from src.model.document import Document -from src.validation.document_validator import validate_full_spdx_document -from src.validation.validation_message import ValidationMessage +from spdx.jsonschema.document_converter import DocumentConverter +from spdx.model.document import Document +from spdx.validation.document_validator import validate_full_spdx_document +from spdx.validation.validation_message import ValidationMessage def write_document(document: Document, file_name: str, validate: bool = True, converter: DocumentConverter = None): diff --git a/src/writer/tagvalue/__init__.py b/src/spdx/writer/tagvalue/__init__.py similarity index 100% rename from src/writer/tagvalue/__init__.py rename to src/spdx/writer/tagvalue/__init__.py diff --git a/src/writer/tagvalue/annotation_writer.py b/src/spdx/writer/tagvalue/annotation_writer.py similarity index 84% rename from src/writer/tagvalue/annotation_writer.py rename to src/spdx/writer/tagvalue/annotation_writer.py index 5cb7b8b46..231a7f5ea 100644 --- a/src/writer/tagvalue/annotation_writer.py +++ b/src/spdx/writer/tagvalue/annotation_writer.py @@ -10,9 +10,9 @@ # limitations under the License. from typing import TextIO -from src.datetime_conversions import datetime_to_iso_string -from src.model.annotation import Annotation -from src.writer.tagvalue.tagvalue_writer_helper_functions import write_value, write_text_value +from spdx.datetime_conversions import datetime_to_iso_string +from spdx.model.annotation import Annotation +from spdx.writer.tagvalue.tagvalue_writer_helper_functions import write_value, write_text_value def write_annotation(annotation: Annotation, text_output: TextIO): diff --git a/src/writer/tagvalue/checksum_writer.py b/src/spdx/writer/tagvalue/checksum_writer.py similarity index 95% rename from src/writer/tagvalue/checksum_writer.py rename to src/spdx/writer/tagvalue/checksum_writer.py index 7a31cad6a..80df31e35 100644 --- a/src/writer/tagvalue/checksum_writer.py +++ b/src/spdx/writer/tagvalue/checksum_writer.py @@ -8,7 +8,7 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. -from src.model.checksum import Checksum, ChecksumAlgorithm +from spdx.model.checksum import Checksum, ChecksumAlgorithm def write_checksum_to_tag_value(checksum: Checksum) -> str: diff --git a/src/writer/tagvalue/creation_info_writer.py b/src/spdx/writer/tagvalue/creation_info_writer.py similarity index 90% rename from src/writer/tagvalue/creation_info_writer.py rename to src/spdx/writer/tagvalue/creation_info_writer.py index d2c515332..45788410b 100644 --- a/src/writer/tagvalue/creation_info_writer.py +++ b/src/spdx/writer/tagvalue/creation_info_writer.py @@ -10,9 +10,9 @@ # limitations under the License. from typing import TextIO -from src.datetime_conversions import datetime_to_iso_string -from src.model.document import CreationInfo -from src.writer.tagvalue.tagvalue_writer_helper_functions import write_value, write_text_value, write_optional_heading, \ +from spdx.datetime_conversions import datetime_to_iso_string +from spdx.model.document import CreationInfo +from spdx.writer.tagvalue.tagvalue_writer_helper_functions import write_value, write_text_value, write_optional_heading, \ write_separator diff --git a/src/writer/tagvalue/extracted_licensing_info_writer.py b/src/spdx/writer/tagvalue/extracted_licensing_info_writer.py similarity index 87% rename from src/writer/tagvalue/extracted_licensing_info_writer.py rename to src/spdx/writer/tagvalue/extracted_licensing_info_writer.py index eed0e07f2..bddbe48c2 100644 --- a/src/writer/tagvalue/extracted_licensing_info_writer.py +++ b/src/spdx/writer/tagvalue/extracted_licensing_info_writer.py @@ -10,8 +10,8 @@ # limitations under the License. from typing import TextIO -from src.model.extracted_licensing_info import ExtractedLicensingInfo -from src.writer.tagvalue.tagvalue_writer_helper_functions import write_value, write_text_value +from spdx.model.extracted_licensing_info import ExtractedLicensingInfo +from spdx.writer.tagvalue.tagvalue_writer_helper_functions import write_value, write_text_value def write_extracted_licensing_info(extracted_licensing_info: ExtractedLicensingInfo, text_output: TextIO): diff --git a/src/writer/tagvalue/file_writer.py b/src/spdx/writer/tagvalue/file_writer.py similarity index 89% rename from src/writer/tagvalue/file_writer.py rename to src/spdx/writer/tagvalue/file_writer.py index 67780d146..e281d4fd7 100644 --- a/src/writer/tagvalue/file_writer.py +++ b/src/spdx/writer/tagvalue/file_writer.py @@ -10,10 +10,10 @@ # limitations under the License. from typing import TextIO -from src.model.file import File -from src.writer.tagvalue.tagvalue_writer_helper_functions import write_value, write_text_value, \ +from spdx.model.file import File +from spdx.writer.tagvalue.tagvalue_writer_helper_functions import write_value, write_text_value, \ write_license_expression -from src.writer.tagvalue.checksum_writer import write_checksum_to_tag_value +from spdx.writer.tagvalue.checksum_writer import write_checksum_to_tag_value def write_file(file: File, text_output: TextIO): diff --git a/src/writer/tagvalue/package_writer.py b/src/spdx/writer/tagvalue/package_writer.py similarity index 93% rename from src/writer/tagvalue/package_writer.py rename to src/spdx/writer/tagvalue/package_writer.py index 78bb90dc7..045e509e4 100644 --- a/src/writer/tagvalue/package_writer.py +++ b/src/spdx/writer/tagvalue/package_writer.py @@ -10,11 +10,11 @@ # limitations under the License. from typing import TextIO -from src.datetime_conversions import datetime_to_iso_string -from src.model.package import Package, PackageVerificationCode -from src.writer.tagvalue.tagvalue_writer_helper_functions import write_value, write_text_value, \ +from spdx.datetime_conversions import datetime_to_iso_string +from spdx.model.package import Package, PackageVerificationCode +from spdx.writer.tagvalue.tagvalue_writer_helper_functions import write_value, write_text_value, \ write_license_expression, transform_enum_name_to_tv, write_actor -from src.writer.tagvalue.checksum_writer import write_checksum_to_tag_value +from spdx.writer.tagvalue.checksum_writer import write_checksum_to_tag_value def write_package(package: Package, text_output: TextIO): diff --git a/src/writer/tagvalue/relationship_writer.py b/src/spdx/writer/tagvalue/relationship_writer.py similarity index 86% rename from src/writer/tagvalue/relationship_writer.py rename to src/spdx/writer/tagvalue/relationship_writer.py index 15aeb3cd4..8972996df 100644 --- a/src/writer/tagvalue/relationship_writer.py +++ b/src/spdx/writer/tagvalue/relationship_writer.py @@ -10,8 +10,8 @@ # limitations under the License. from typing import TextIO -from src.model.relationship import Relationship -from src.writer.tagvalue.tagvalue_writer_helper_functions import write_value, write_text_value +from spdx.model.relationship import Relationship +from spdx.writer.tagvalue.tagvalue_writer_helper_functions import write_value, write_text_value def write_relationship(relationship: Relationship, text_output: TextIO): diff --git a/src/writer/tagvalue/snippet_writer.py b/src/spdx/writer/tagvalue/snippet_writer.py similarity index 91% rename from src/writer/tagvalue/snippet_writer.py rename to src/spdx/writer/tagvalue/snippet_writer.py index b4a4740e6..7f5d8d600 100644 --- a/src/writer/tagvalue/snippet_writer.py +++ b/src/spdx/writer/tagvalue/snippet_writer.py @@ -10,8 +10,8 @@ # limitations under the License. from typing import TextIO -from src.model.snippet import Snippet -from src.writer.tagvalue.tagvalue_writer_helper_functions import write_value, write_text_value, write_range, \ +from spdx.model.snippet import Snippet +from spdx.writer.tagvalue.tagvalue_writer_helper_functions import write_value, write_text_value, write_range, \ write_license_expression diff --git a/src/writer/tagvalue/tagvalue_writer.py b/src/spdx/writer/tagvalue/tagvalue_writer.py similarity index 84% rename from src/writer/tagvalue/tagvalue_writer.py rename to src/spdx/writer/tagvalue/tagvalue_writer.py index 0f609602f..bce0db50d 100644 --- a/src/writer/tagvalue/tagvalue_writer.py +++ b/src/spdx/writer/tagvalue/tagvalue_writer.py @@ -11,15 +11,15 @@ from typing import TextIO -from src.model.document import Document -from src.writer.tagvalue.annotation_writer import write_annotation -from src.writer.tagvalue.creation_info_writer import write_creation_info -from src.writer.tagvalue.extracted_licensing_info_writer import write_extracted_licensing_info -from src.writer.tagvalue.file_writer import write_file -from src.writer.tagvalue.package_writer import write_package -from src.writer.tagvalue.relationship_writer import write_relationship -from src.writer.tagvalue.snippet_writer import write_snippet -from src.writer.tagvalue.tagvalue_writer_helper_functions import write_separator, scan_relationships, \ +from spdx.model.document import Document +from spdx.writer.tagvalue.annotation_writer import write_annotation +from spdx.writer.tagvalue.creation_info_writer import write_creation_info +from spdx.writer.tagvalue.extracted_licensing_info_writer import write_extracted_licensing_info +from spdx.writer.tagvalue.file_writer import write_file +from spdx.writer.tagvalue.package_writer import write_package +from spdx.writer.tagvalue.relationship_writer import write_relationship +from spdx.writer.tagvalue.snippet_writer import write_snippet +from spdx.writer.tagvalue.tagvalue_writer_helper_functions import write_separator, scan_relationships, \ get_file_ids_with_contained_snippets, write_optional_heading, write_list_of_elements diff --git a/src/writer/tagvalue/tagvalue_writer_helper_functions.py b/src/spdx/writer/tagvalue/tagvalue_writer_helper_functions.py similarity index 92% rename from src/writer/tagvalue/tagvalue_writer_helper_functions.py rename to src/spdx/writer/tagvalue/tagvalue_writer_helper_functions.py index 967281551..445b6c207 100644 --- a/src/writer/tagvalue/tagvalue_writer_helper_functions.py +++ b/src/spdx/writer/tagvalue/tagvalue_writer_helper_functions.py @@ -10,14 +10,14 @@ # limitations under the License. from typing import TextIO, Tuple, List, Dict, Any, Union, Callable, Optional -from src.model.actor import Actor -from src.model.file import File -from src.model.license_expression import LicenseExpression -from src.model.package import Package -from src.model.relationship import Relationship -from src.model.snippet import Snippet -from src.model.spdx_no_assertion import SpdxNoAssertion -from src.model.spdx_none import SpdxNone +from spdx.model.actor import Actor +from spdx.model.file import File +from spdx.model.license_expression import LicenseExpression +from spdx.model.package import Package +from spdx.model.relationship import Relationship +from spdx.model.snippet import Snippet +from spdx.model.spdx_no_assertion import SpdxNoAssertion +from spdx.model.spdx_none import SpdxNone def write_separator(out: TextIO): diff --git a/src/writer/write_anything.py b/src/spdx/writer/write_anything.py similarity index 82% rename from src/writer/write_anything.py rename to src/spdx/writer/write_anything.py index 29d07cbfa..43f786639 100644 --- a/src/writer/write_anything.py +++ b/src/spdx/writer/write_anything.py @@ -8,12 +8,12 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. -from src.formats import file_name_to_format, FileFormat -from src.model.document import Document -from src.writer.json import json_writer -from src.writer.tagvalue import tagvalue_writer -from src.writer.xml import xml_writer -from src.writer.yaml import yaml_writer +from spdx.formats import file_name_to_format, FileFormat +from spdx.model.document import Document +from spdx.writer.json import json_writer +from spdx.writer.tagvalue import tagvalue_writer +from spdx.writer.xml import xml_writer +from spdx.writer.yaml import yaml_writer def write_file(document: Document, file_name: str, validate: bool = True): diff --git a/src/writer/xml/__init__.py b/src/spdx/writer/xml/__init__.py similarity index 100% rename from src/writer/xml/__init__.py rename to src/spdx/writer/xml/__init__.py diff --git a/src/writer/xml/xml_writer.py b/src/spdx/writer/xml/xml_writer.py similarity index 86% rename from src/writer/xml/xml_writer.py rename to src/spdx/writer/xml/xml_writer.py index b0a374162..f6bcf738e 100644 --- a/src/writer/xml/xml_writer.py +++ b/src/spdx/writer/xml/xml_writer.py @@ -12,10 +12,10 @@ import xmltodict -from src.jsonschema.document_converter import DocumentConverter -from src.model.document import Document -from src.validation.document_validator import validate_full_spdx_document -from src.validation.validation_message import ValidationMessage +from spdx.jsonschema.document_converter import DocumentConverter +from spdx.model.document import Document +from spdx.validation.document_validator import validate_full_spdx_document +from spdx.validation.validation_message import ValidationMessage def write_document_to_file(document: Document, file_name: str, validate: bool = True, converter: DocumentConverter = None): diff --git a/src/writer/yaml/__init__.py b/src/spdx/writer/yaml/__init__.py similarity index 100% rename from src/writer/yaml/__init__.py rename to src/spdx/writer/yaml/__init__.py diff --git a/src/writer/yaml/yaml_writer.py b/src/spdx/writer/yaml/yaml_writer.py similarity index 86% rename from src/writer/yaml/yaml_writer.py rename to src/spdx/writer/yaml/yaml_writer.py index 07f36917d..38dc40ac4 100644 --- a/src/writer/yaml/yaml_writer.py +++ b/src/spdx/writer/yaml/yaml_writer.py @@ -12,10 +12,10 @@ import yaml -from src.jsonschema.document_converter import DocumentConverter -from src.model.document import Document -from src.validation.document_validator import validate_full_spdx_document -from src.validation.validation_message import ValidationMessage +from spdx.jsonschema.document_converter import DocumentConverter +from spdx.model.document import Document +from spdx.validation.document_validator import validate_full_spdx_document +from spdx.validation.validation_message import ValidationMessage def write_document_to_file(document: Document, file_name: str, validate: bool = True, converter: DocumentConverter = None): diff --git a/tests/fixtures.py b/tests/fixtures.py index 284d84149..8bcb0f3d0 100644 --- a/tests/fixtures.py +++ b/tests/fixtures.py @@ -10,19 +10,19 @@ # limitations under the License. from datetime import datetime -from src.model.actor import Actor, ActorType -from src.model.annotation import Annotation, AnnotationType -from src.model.checksum import Checksum, ChecksumAlgorithm -from src.model.document import CreationInfo, Document -from src.model.external_document_ref import ExternalDocumentRef -from src.model.extracted_licensing_info import ExtractedLicensingInfo -from src.model.file import File, FileType -from src.model.license_expression import LicenseExpression -from src.model.package import Package, PackageVerificationCode, PackagePurpose, ExternalPackageRef, \ +from spdx.model.actor import Actor, ActorType +from spdx.model.annotation import Annotation, AnnotationType +from spdx.model.checksum import Checksum, ChecksumAlgorithm +from spdx.model.document import CreationInfo, Document +from spdx.model.external_document_ref import ExternalDocumentRef +from spdx.model.extracted_licensing_info import ExtractedLicensingInfo +from spdx.model.file import File, FileType +from spdx.model.license_expression import LicenseExpression +from spdx.model.package import Package, PackageVerificationCode, PackagePurpose, ExternalPackageRef, \ ExternalPackageRefCategory -from src.model.relationship import Relationship, RelationshipType -from src.model.snippet import Snippet -from src.model.version import Version +from spdx.model.relationship import Relationship, RelationshipType +from spdx.model.snippet import Snippet +from spdx.model.version import Version """Utility methods to create data model instances. All properties have valid defaults, so they don't need to be specified unless relevant for the test.""" diff --git a/tests/jsonschema/test_annotation_converter.py b/tests/jsonschema/test_annotation_converter.py index a6b593190..b843ff275 100644 --- a/tests/jsonschema/test_annotation_converter.py +++ b/tests/jsonschema/test_annotation_converter.py @@ -12,11 +12,11 @@ import pytest -from src.datetime_conversions import datetime_to_iso_string -from src.jsonschema.annotation_converter import AnnotationConverter -from src.jsonschema.annotation_properties import AnnotationProperty -from src.model.actor import Actor, ActorType -from src.model.annotation import Annotation, AnnotationType +from spdx.datetime_conversions import datetime_to_iso_string +from spdx.jsonschema.annotation_converter import AnnotationConverter +from spdx.jsonschema.annotation_properties import AnnotationProperty +from spdx.model.actor import Actor, ActorType +from spdx.model.annotation import Annotation, AnnotationType @pytest.fixture diff --git a/tests/jsonschema/test_checksum_converter.py b/tests/jsonschema/test_checksum_converter.py index 4f2eef537..857745b7c 100644 --- a/tests/jsonschema/test_checksum_converter.py +++ b/tests/jsonschema/test_checksum_converter.py @@ -10,9 +10,9 @@ # limitations under the License. import pytest -from src.jsonschema.checksum_converter import ChecksumConverter -from src.jsonschema.checksum_properties import ChecksumProperty -from src.model.checksum import Checksum, ChecksumAlgorithm +from spdx.jsonschema.checksum_converter import ChecksumConverter +from spdx.jsonschema.checksum_properties import ChecksumProperty +from spdx.model.checksum import Checksum, ChecksumAlgorithm @pytest.fixture diff --git a/tests/jsonschema/test_converter.py b/tests/jsonschema/test_converter.py index ca5091144..7a5b4783c 100644 --- a/tests/jsonschema/test_converter.py +++ b/tests/jsonschema/test_converter.py @@ -13,12 +13,12 @@ import pytest -from src.jsonschema.converter import TypedConverter -from src.jsonschema.json_property import JsonProperty -from src.model.checksum import Checksum, ChecksumAlgorithm -from src.model.document import Document -from src.model.typing.dataclass_with_properties import dataclass_with_properties -from src.model.typing.type_checks import check_types_and_set_values +from spdx.jsonschema.converter import TypedConverter +from spdx.jsonschema.json_property import JsonProperty +from spdx.model.checksum import Checksum, ChecksumAlgorithm +from spdx.model.document import Document +from spdx.model.typing.dataclass_with_properties import dataclass_with_properties +from spdx.model.typing.type_checks import check_types_and_set_values class TestPropertyType(JsonProperty): diff --git a/tests/jsonschema/test_creation_info_converter.py b/tests/jsonschema/test_creation_info_converter.py index 012659083..47b825802 100644 --- a/tests/jsonschema/test_creation_info_converter.py +++ b/tests/jsonschema/test_creation_info_converter.py @@ -12,12 +12,12 @@ import pytest -from src.datetime_conversions import datetime_to_iso_string -from src.jsonschema.creation_info_converter import CreationInfoConverter -from src.jsonschema.creation_info_properties import CreationInfoProperty -from src.model.actor import Actor, ActorType -from src.model.document import CreationInfo -from src.model.version import Version +from spdx.datetime_conversions import datetime_to_iso_string +from spdx.jsonschema.creation_info_converter import CreationInfoConverter +from spdx.jsonschema.creation_info_properties import CreationInfoProperty +from spdx.model.actor import Actor, ActorType +from spdx.model.document import CreationInfo +from spdx.model.version import Version from tests.fixtures import creation_info_fixture diff --git a/tests/jsonschema/test_document_converter.py b/tests/jsonschema/test_document_converter.py index 82e5ba34a..95bf0dd15 100644 --- a/tests/jsonschema/test_document_converter.py +++ b/tests/jsonschema/test_document_converter.py @@ -15,29 +15,29 @@ import pytest -from src.jsonschema.annotation_converter import AnnotationConverter -from src.jsonschema.document_converter import DocumentConverter -from src.jsonschema.document_properties import DocumentProperty -from src.jsonschema.relationship_converter import RelationshipConverter -from src.model.actor import Actor, ActorType -from src.model.annotation import Annotation, AnnotationType -from src.model.document import Document -from src.model.extracted_licensing_info import ExtractedLicensingInfo -from src.model.relationship import Relationship, RelationshipType +from spdx.jsonschema.annotation_converter import AnnotationConverter +from spdx.jsonschema.document_converter import DocumentConverter +from spdx.jsonschema.document_properties import DocumentProperty +from spdx.jsonschema.relationship_converter import RelationshipConverter +from spdx.model.actor import Actor, ActorType +from spdx.model.annotation import Annotation, AnnotationType +from spdx.model.document import Document +from spdx.model.extracted_licensing_info import ExtractedLicensingInfo +from spdx.model.relationship import Relationship, RelationshipType from tests.fixtures import creation_info_fixture, file_fixture, package_fixture, external_document_ref_fixture, \ snippet_fixture, annotation_fixture, document_fixture, relationship_fixture from tests.mock_utils import assert_mock_method_called_with_arguments, assert_no_mock_methods_called @pytest.fixture -@mock.patch('src.jsonschema.creation_info_converter.CreationInfoConverter', autospec=True) -@mock.patch('src.jsonschema.external_document_ref_converter.ExternalDocumentRefConverter', autospec=True) -@mock.patch('src.jsonschema.package_converter.PackageConverter', autospec=True) -@mock.patch('src.jsonschema.annotation_converter.AnnotationConverter', autospec=True) -@mock.patch('src.jsonschema.extracted_licensing_info_converter.ExtractedLicensingInfoConverter', autospec=True) -@mock.patch('src.jsonschema.file_converter.FileConverter', autospec=True) -@mock.patch('src.jsonschema.snippet_converter.SnippetConverter', autospec=True) -@mock.patch('src.jsonschema.relationship_converter.RelationshipConverter', autospec=True) +@mock.patch('spdx.jsonschema.creation_info_converter.CreationInfoConverter', autospec=True) +@mock.patch('spdx.jsonschema.external_document_ref_converter.ExternalDocumentRefConverter', autospec=True) +@mock.patch('spdx.jsonschema.package_converter.PackageConverter', autospec=True) +@mock.patch('spdx.jsonschema.annotation_converter.AnnotationConverter', autospec=True) +@mock.patch('spdx.jsonschema.extracted_licensing_info_converter.ExtractedLicensingInfoConverter', autospec=True) +@mock.patch('spdx.jsonschema.file_converter.FileConverter', autospec=True) +@mock.patch('spdx.jsonschema.snippet_converter.SnippetConverter', autospec=True) +@mock.patch('spdx.jsonschema.relationship_converter.RelationshipConverter', autospec=True) def converter(relationship_converter_mock: MagicMock, snippet_converter_mock: MagicMock, file_converter_mock: MagicMock, extracted_licensing_info_converter_mock: MagicMock, annotation_converter_mock: MagicMock, package_converter_mock: MagicMock, external_ref_converter_mock: MagicMock, diff --git a/tests/jsonschema/test_external_document_ref_converter.py b/tests/jsonschema/test_external_document_ref_converter.py index ebd9bc97b..dc85c42b9 100644 --- a/tests/jsonschema/test_external_document_ref_converter.py +++ b/tests/jsonschema/test_external_document_ref_converter.py @@ -13,14 +13,14 @@ import pytest -from src.jsonschema.external_document_ref_converter import ExternalDocumentRefConverter -from src.jsonschema.external_document_ref_properties import ExternalDocumentRefProperty -from src.model.checksum import Checksum, ChecksumAlgorithm -from src.model.external_document_ref import ExternalDocumentRef +from spdx.jsonschema.external_document_ref_converter import ExternalDocumentRefConverter +from spdx.jsonschema.external_document_ref_properties import ExternalDocumentRefProperty +from spdx.model.checksum import Checksum, ChecksumAlgorithm +from spdx.model.external_document_ref import ExternalDocumentRef @pytest.fixture -@mock.patch('src.jsonschema.checksum_converter.ChecksumConverter', autospec=True) +@mock.patch('spdx.jsonschema.checksum_converter.ChecksumConverter', autospec=True) def converter(checksum_converter_magic_mock: MagicMock) -> ExternalDocumentRefConverter: mocked_checksum_converter = checksum_converter_magic_mock() converter = ExternalDocumentRefConverter() diff --git a/tests/jsonschema/test_external_package_ref_converter.py b/tests/jsonschema/test_external_package_ref_converter.py index fb4aad6b1..64c61228e 100644 --- a/tests/jsonschema/test_external_package_ref_converter.py +++ b/tests/jsonschema/test_external_package_ref_converter.py @@ -10,9 +10,9 @@ # limitations under the License. import pytest -from src.jsonschema.external_package_ref_converter import ExternalPackageRefConverter -from src.jsonschema.external_package_ref_properties import ExternalPackageRefProperty -from src.model.package import ExternalPackageRef, ExternalPackageRefCategory +from spdx.jsonschema.external_package_ref_converter import ExternalPackageRefConverter +from spdx.jsonschema.external_package_ref_properties import ExternalPackageRefProperty +from spdx.model.package import ExternalPackageRef, ExternalPackageRefCategory @pytest.fixture diff --git a/tests/jsonschema/test_extracted_licensing_info_converter.py b/tests/jsonschema/test_extracted_licensing_info_converter.py index 5b892389a..52fef8f80 100644 --- a/tests/jsonschema/test_extracted_licensing_info_converter.py +++ b/tests/jsonschema/test_extracted_licensing_info_converter.py @@ -10,10 +10,10 @@ # limitations under the License. import pytest -from src.jsonschema.extracted_licensing_info_converter import ExtractedLicensingInfoConverter -from src.jsonschema.extracted_licensing_info_properties import ExtractedLicensingInfoProperty -from src.model.extracted_licensing_info import ExtractedLicensingInfo -from src.model.spdx_no_assertion import SpdxNoAssertion, SPDX_NO_ASSERTION_STRING +from spdx.jsonschema.extracted_licensing_info_converter import ExtractedLicensingInfoConverter +from spdx.jsonschema.extracted_licensing_info_properties import ExtractedLicensingInfoProperty +from spdx.model.extracted_licensing_info import ExtractedLicensingInfo +from spdx.model.spdx_no_assertion import SpdxNoAssertion, SPDX_NO_ASSERTION_STRING from tests.fixtures import extracted_licensing_info_fixture diff --git a/tests/jsonschema/test_file_converter.py b/tests/jsonschema/test_file_converter.py index 46f39e215..452d08c51 100644 --- a/tests/jsonschema/test_file_converter.py +++ b/tests/jsonschema/test_file_converter.py @@ -15,24 +15,24 @@ import pytest -from src.jsonschema.annotation_converter import AnnotationConverter -from src.jsonschema.file_converter import FileConverter -from src.jsonschema.file_properties import FileProperty -from src.model.actor import Actor, ActorType -from src.model.annotation import Annotation, AnnotationType -from src.model.checksum import Checksum, ChecksumAlgorithm -from src.model.document import Document -from src.model.file import File, FileType -from src.model.license_expression import LicenseExpression -from src.model.spdx_no_assertion import SpdxNoAssertion, SPDX_NO_ASSERTION_STRING -from src.model.spdx_none import SpdxNone, SPDX_NONE_STRING +from spdx.jsonschema.annotation_converter import AnnotationConverter +from spdx.jsonschema.file_converter import FileConverter +from spdx.jsonschema.file_properties import FileProperty +from spdx.model.actor import Actor, ActorType +from spdx.model.annotation import Annotation, AnnotationType +from spdx.model.checksum import Checksum, ChecksumAlgorithm +from spdx.model.document import Document +from spdx.model.file import File, FileType +from spdx.model.license_expression import LicenseExpression +from spdx.model.spdx_no_assertion import SpdxNoAssertion, SPDX_NO_ASSERTION_STRING +from spdx.model.spdx_none import SpdxNone, SPDX_NONE_STRING from tests.fixtures import creation_info_fixture, file_fixture, annotation_fixture, document_fixture from tests.mock_utils import assert_mock_method_called_with_arguments @pytest.fixture -@mock.patch('src.jsonschema.checksum_converter.ChecksumConverter', autospec=True) -@mock.patch('src.jsonschema.annotation_converter.AnnotationConverter', autospec=True) +@mock.patch('spdx.jsonschema.checksum_converter.ChecksumConverter', autospec=True) +@mock.patch('spdx.jsonschema.annotation_converter.AnnotationConverter', autospec=True) def converter(annotation_converter_mock: MagicMock, checksum_converter_mock: MagicMock) -> FileConverter: converter = FileConverter() converter.checksum_converter = checksum_converter_mock() diff --git a/tests/jsonschema/test_package_converter.py b/tests/jsonschema/test_package_converter.py index 1f9c22ff0..f6c757a17 100644 --- a/tests/jsonschema/test_package_converter.py +++ b/tests/jsonschema/test_package_converter.py @@ -15,28 +15,28 @@ import pytest -from src.jsonschema.annotation_converter import AnnotationConverter -from src.jsonschema.package_converter import PackageConverter -from src.jsonschema.package_properties import PackageProperty -from src.model.actor import Actor, ActorType -from src.model.annotation import Annotation, AnnotationType -from src.model.checksum import Checksum, ChecksumAlgorithm -from src.model.document import Document -from src.model.license_expression import LicenseExpression -from src.model.package import Package, PackageVerificationCode, PackagePurpose -from src.model.relationship import RelationshipType -from src.model.spdx_no_assertion import SpdxNoAssertion, SPDX_NO_ASSERTION_STRING -from src.model.spdx_none import SpdxNone, SPDX_NONE_STRING +from spdx.jsonschema.annotation_converter import AnnotationConverter +from spdx.jsonschema.package_converter import PackageConverter +from spdx.jsonschema.package_properties import PackageProperty +from spdx.model.actor import Actor, ActorType +from spdx.model.annotation import Annotation, AnnotationType +from spdx.model.checksum import Checksum, ChecksumAlgorithm +from spdx.model.document import Document +from spdx.model.license_expression import LicenseExpression +from spdx.model.package import Package, PackageVerificationCode, PackagePurpose +from spdx.model.relationship import RelationshipType +from spdx.model.spdx_no_assertion import SpdxNoAssertion, SPDX_NO_ASSERTION_STRING +from spdx.model.spdx_none import SpdxNone, SPDX_NONE_STRING from tests.fixtures import creation_info_fixture, package_fixture, external_package_ref_fixture, document_fixture, \ annotation_fixture, file_fixture, relationship_fixture, snippet_fixture from tests.mock_utils import assert_mock_method_called_with_arguments @pytest.fixture -@mock.patch('src.jsonschema.checksum_converter.ChecksumConverter', autospec=True) -@mock.patch('src.jsonschema.annotation_converter.AnnotationConverter', autospec=True) -@mock.patch('src.jsonschema.package_verification_code_converter.PackageVerificationCodeConverter', autospec=True) -@mock.patch('src.jsonschema.external_package_ref_converter.ExternalPackageRefConverter', autospec=True) +@mock.patch('spdx.jsonschema.checksum_converter.ChecksumConverter', autospec=True) +@mock.patch('spdx.jsonschema.annotation_converter.AnnotationConverter', autospec=True) +@mock.patch('spdx.jsonschema.package_verification_code_converter.PackageVerificationCodeConverter', autospec=True) +@mock.patch('spdx.jsonschema.external_package_ref_converter.ExternalPackageRefConverter', autospec=True) def converter(package_ref_converter_mock: MagicMock, verification_code_converter_mock: MagicMock, annotation_converter_mock: MagicMock, checksum_converter_mock: MagicMock) -> PackageConverter: converter = PackageConverter() diff --git a/tests/jsonschema/test_package_verification_code_converter.py b/tests/jsonschema/test_package_verification_code_converter.py index 6d8ac4476..2ee715484 100644 --- a/tests/jsonschema/test_package_verification_code_converter.py +++ b/tests/jsonschema/test_package_verification_code_converter.py @@ -10,9 +10,9 @@ # limitations under the License. import pytest -from src.jsonschema.package_verification_code_converter import PackageVerificationCodeConverter -from src.jsonschema.package_verification_code_properties import PackageVerificationCodeProperty -from src.model.package import PackageVerificationCode +from spdx.jsonschema.package_verification_code_converter import PackageVerificationCodeConverter +from spdx.jsonschema.package_verification_code_properties import PackageVerificationCodeProperty +from spdx.model.package import PackageVerificationCode @pytest.fixture diff --git a/tests/jsonschema/test_relationship_converter.py b/tests/jsonschema/test_relationship_converter.py index d2bcffb5b..98ff88e46 100644 --- a/tests/jsonschema/test_relationship_converter.py +++ b/tests/jsonschema/test_relationship_converter.py @@ -10,11 +10,11 @@ # limitations under the License. import pytest -from src.jsonschema.relationship_converter import RelationshipConverter -from src.jsonschema.relationship_properties import RelationshipProperty -from src.model.relationship import Relationship, RelationshipType -from src.model.spdx_no_assertion import SpdxNoAssertion, SPDX_NO_ASSERTION_STRING -from src.model.spdx_none import SpdxNone, SPDX_NONE_STRING +from spdx.jsonschema.relationship_converter import RelationshipConverter +from spdx.jsonschema.relationship_properties import RelationshipProperty +from spdx.model.relationship import Relationship, RelationshipType +from spdx.model.spdx_no_assertion import SpdxNoAssertion, SPDX_NO_ASSERTION_STRING +from spdx.model.spdx_none import SpdxNone, SPDX_NONE_STRING from tests.fixtures import relationship_fixture diff --git a/tests/jsonschema/test_snippet_converter.py b/tests/jsonschema/test_snippet_converter.py index 5549c9a5a..c29ad0806 100644 --- a/tests/jsonschema/test_snippet_converter.py +++ b/tests/jsonschema/test_snippet_converter.py @@ -15,22 +15,22 @@ import pytest -from src.jsonschema.annotation_converter import AnnotationConverter -from src.jsonschema.snippet_converter import SnippetConverter -from src.jsonschema.snippet_properties import SnippetProperty -from src.model.actor import Actor, ActorType -from src.model.annotation import Annotation, AnnotationType -from src.model.document import Document -from src.model.license_expression import LicenseExpression -from src.model.snippet import Snippet -from src.model.spdx_no_assertion import SpdxNoAssertion, SPDX_NO_ASSERTION_STRING -from src.model.spdx_none import SpdxNone, SPDX_NONE_STRING +from spdx.jsonschema.annotation_converter import AnnotationConverter +from spdx.jsonschema.snippet_converter import SnippetConverter +from spdx.jsonschema.snippet_properties import SnippetProperty +from spdx.model.actor import Actor, ActorType +from spdx.model.annotation import Annotation, AnnotationType +from spdx.model.document import Document +from spdx.model.license_expression import LicenseExpression +from spdx.model.snippet import Snippet +from spdx.model.spdx_no_assertion import SpdxNoAssertion, SPDX_NO_ASSERTION_STRING +from spdx.model.spdx_none import SpdxNone, SPDX_NONE_STRING from tests.fixtures import creation_info_fixture, snippet_fixture, document_fixture, annotation_fixture from tests.mock_utils import assert_mock_method_called_with_arguments @pytest.fixture -@mock.patch('src.jsonschema.annotation_converter.AnnotationConverter', autospec=True) +@mock.patch('spdx.jsonschema.annotation_converter.AnnotationConverter', autospec=True) def converter(annotation_converter_mock: MagicMock) -> SnippetConverter: converter = SnippetConverter() converter.annotation_converter = annotation_converter_mock() diff --git a/tests/model/test_actor.py b/tests/model/test_actor.py index c39ac744a..9a0ba5a14 100644 --- a/tests/model/test_actor.py +++ b/tests/model/test_actor.py @@ -1,6 +1,6 @@ import pytest -from src.model.actor import Actor, ActorType +from spdx.model.actor import Actor, ActorType def test_correct_initialization(): diff --git a/tests/model/test_annotation.py b/tests/model/test_annotation.py index 5455569bc..c2d357c43 100644 --- a/tests/model/test_annotation.py +++ b/tests/model/test_annotation.py @@ -3,10 +3,10 @@ import pytest -from src.model.annotation import Annotation, AnnotationType +from spdx.model.annotation import Annotation, AnnotationType -@mock.patch('src.model.actor.Actor', autospec=True) +@mock.patch('spdx.model.actor.Actor', autospec=True) def test_correct_initialization(actor): annotation = Annotation("id", AnnotationType.OTHER, actor, datetime(2022, 1, 1), "comment") assert annotation.spdx_id == "id" @@ -16,31 +16,31 @@ def test_correct_initialization(actor): assert annotation.annotation_comment == "comment" -@mock.patch('src.model.actor.Actor', autospec=True) +@mock.patch('spdx.model.actor.Actor', autospec=True) def test_wrong_type_in_spdx_id(actor): with pytest.raises(TypeError): Annotation(42, AnnotationType.OTHER, actor, datetime(2022, 1, 1), "comment") -@mock.patch('src.model.actor.Actor', autospec=True) +@mock.patch('spdx.model.actor.Actor', autospec=True) def test_wrong_type_in_annotation_type(actor): with pytest.raises(TypeError): Annotation("id", 42, actor, datetime(2022, 1, 1), "comment") -@mock.patch('src.model.actor.Actor', autospec=True) +@mock.patch('spdx.model.actor.Actor', autospec=True) def test_wrong_type_in_annotator(actor): with pytest.raises(TypeError): Annotation("id", AnnotationType.OTHER, 42, datetime(2022, 1, 1), "comment") -@mock.patch('src.model.actor.Actor', autospec=True) +@mock.patch('spdx.model.actor.Actor', autospec=True) def test_wrong_type_in_annotation_date(actor): with pytest.raises(TypeError): Annotation("id", AnnotationType.OTHER, actor, 42, "comment") -@mock.patch('src.model.actor.Actor', autospec=True) +@mock.patch('spdx.model.actor.Actor', autospec=True) def test_wrong_type_in_annotation_comment(actor): with pytest.raises(TypeError): Annotation("id", AnnotationType.OTHER, actor, datetime(2022, 1, 1), 42) diff --git a/tests/model/test_checksum.py b/tests/model/test_checksum.py index 41aeaf7b6..8b1c3e43b 100644 --- a/tests/model/test_checksum.py +++ b/tests/model/test_checksum.py @@ -1,6 +1,6 @@ import pytest -from src.model.checksum import Checksum, ChecksumAlgorithm +from spdx.model.checksum import Checksum, ChecksumAlgorithm def test_correct_initialization(): diff --git a/tests/model/test_creation_info.py b/tests/model/test_creation_info.py index a0ba11b9e..68f5f323e 100644 --- a/tests/model/test_creation_info.py +++ b/tests/model/test_creation_info.py @@ -3,12 +3,12 @@ import pytest -from src.model.document import CreationInfo -from src.model.version import Version +from spdx.model.document import CreationInfo +from spdx.model.version import Version -@mock.patch('src.model.actor.Actor', autospec=True) -@mock.patch('src.model.external_document_ref.ExternalDocumentRef', autospec=True) +@mock.patch('spdx.model.actor.Actor', autospec=True) +@mock.patch('spdx.model.external_document_ref.ExternalDocumentRef', autospec=True) def test_correct_initialization(actor, ext_ref): creation_info = CreationInfo("version", "id", "name", "namespace", [actor, actor], datetime(2022, 1, 1), "creator_comment", "CC0-1.1", [ext_ref, ext_ref], Version(6, 3), "doc_comment") @@ -25,25 +25,25 @@ def test_correct_initialization(actor, ext_ref): assert creation_info.document_comment == "doc_comment" -@mock.patch('src.model.actor.Actor', autospec=True) +@mock.patch('spdx.model.actor.Actor', autospec=True) def test_wrong_type_in_spdx_version(actor): with pytest.raises(TypeError): CreationInfo(42, "id", "name", "namespace", [actor, actor], datetime(2022, 1, 1)) -@mock.patch('src.model.actor.Actor', autospec=True) +@mock.patch('spdx.model.actor.Actor', autospec=True) def test_wrong_type_in_spdx_id(actor): with pytest.raises(TypeError): CreationInfo("version", 42, "name", "namespace", [actor, actor], datetime(2022, 1, 1)) -@mock.patch('src.model.actor.Actor', autospec=True) +@mock.patch('spdx.model.actor.Actor', autospec=True) def test_wrong_type_in_name(actor): with pytest.raises(TypeError): CreationInfo("version", "id", 42, "namespace", [actor, actor], datetime(2022, 1, 1)) -@mock.patch('src.model.actor.Actor', autospec=True) +@mock.patch('spdx.model.actor.Actor', autospec=True) def test_wrong_type_in_document_namespace(actor): with pytest.raises(TypeError): CreationInfo("version", "id", "name", 42, [actor, actor], datetime(2022, 1, 1)) @@ -54,40 +54,40 @@ def test_wrong_type_in_creators(): CreationInfo("version", "id", "name", "namespace", ["person"], datetime(2022, 1, 1)) -@mock.patch('src.model.actor.Actor', autospec=True) +@mock.patch('spdx.model.actor.Actor', autospec=True) def test_wrong_type_in_created(actor): with pytest.raises(TypeError): CreationInfo("version", "id", "name", "namespace", [actor, actor], "2022-01-01") -@mock.patch('src.model.actor.Actor', autospec=True) +@mock.patch('spdx.model.actor.Actor', autospec=True) def test_wrong_type_in_creator_comment(actor): with pytest.raises(TypeError): CreationInfo("version", "id", "name", "namespace", [actor, actor], datetime(2022, 1, 1), creator_comment=["string"]) -@mock.patch('src.model.actor.Actor', autospec=True) +@mock.patch('spdx.model.actor.Actor', autospec=True) def test_wrong_type_in_data_license(actor): with pytest.raises(TypeError): CreationInfo("version", "id", "name", "namespace", [actor, actor], datetime(2022, 1, 1), data_license=42) -@mock.patch('src.model.actor.Actor', autospec=True) +@mock.patch('spdx.model.actor.Actor', autospec=True) def test_wrong_type_in_external_document_refs(actor): with pytest.raises(TypeError): CreationInfo("version", "id", "name", "namespace", [actor, actor], datetime(2022, 1, 1), external_document_refs=()) -@mock.patch('src.model.actor.Actor', autospec=True) +@mock.patch('spdx.model.actor.Actor', autospec=True) def test_wrong_type_in_license_list_version(actor): with pytest.raises(TypeError): CreationInfo("version", "id", "name", "namespace", [actor, actor], datetime(2022, 1, 1), license_list_version="6.4") -@mock.patch('src.model.actor.Actor', autospec=True) +@mock.patch('spdx.model.actor.Actor', autospec=True) def test_wrong_type_in_document_comment(actor): with pytest.raises(TypeError): CreationInfo("version", "id", "name", "namespace", [actor, actor], datetime(2022, 1, 1), document_comment=["1"]) diff --git a/tests/model/test_document.py b/tests/model/test_document.py index 1a0a92087..a27370db5 100644 --- a/tests/model/test_document.py +++ b/tests/model/test_document.py @@ -2,16 +2,16 @@ import pytest -from src.model.document import Document +from spdx.model.document import Document -@mock.patch('src.model.document.CreationInfo', autospec=True) -@mock.patch('src.model.package.Package', autospec=True) -@mock.patch('src.model.file.File', autospec=True) -@mock.patch('src.model.snippet.Snippet', autospec=True) -@mock.patch('src.model.annotation.Annotation', autospec=True) -@mock.patch('src.model.relationship.Relationship', autospec=True) -@mock.patch('src.model.extracted_licensing_info.ExtractedLicensingInfo', autospec=True) +@mock.patch('spdx.model.document.CreationInfo', autospec=True) +@mock.patch('spdx.model.package.Package', autospec=True) +@mock.patch('spdx.model.file.File', autospec=True) +@mock.patch('spdx.model.snippet.Snippet', autospec=True) +@mock.patch('spdx.model.annotation.Annotation', autospec=True) +@mock.patch('spdx.model.relationship.Relationship', autospec=True) +@mock.patch('spdx.model.extracted_licensing_info.ExtractedLicensingInfo', autospec=True) def test_correct_initialization(creation_info, package, file, snippet, annotation, relationship, extracted_lic): document = Document(creation_info, [package, package], [file, file], [snippet, snippet], [annotation, annotation], @@ -25,7 +25,7 @@ def test_correct_initialization(creation_info, package, file, snippet, annotatio assert document.extracted_licensing_info == [extracted_lic, extracted_lic] -@mock.patch('src.model.document.CreationInfo', autospec=True) +@mock.patch('spdx.model.document.CreationInfo', autospec=True) def test_correct_initialization_with_default_values(creation_info): document = Document(creation_info) assert document.creation_info == creation_info @@ -42,37 +42,37 @@ def test_wrong_type_in_creation_info(): Document("string") -@mock.patch('src.model.document.CreationInfo', autospec=True) +@mock.patch('spdx.model.document.CreationInfo', autospec=True) def test_wrong_type_in_packages(creation_info): with pytest.raises(TypeError): Document(creation_info, packages=["string"]) -@mock.patch('src.model.document.CreationInfo', autospec=True) +@mock.patch('spdx.model.document.CreationInfo', autospec=True) def test_wrong_type_in_files(creation_info): with pytest.raises(TypeError): Document(creation_info, files={}) -@mock.patch('src.model.document.CreationInfo', autospec=True) +@mock.patch('spdx.model.document.CreationInfo', autospec=True) def test_wrong_type_in_snippets(creation_info): with pytest.raises(TypeError): Document(creation_info, snippets=()) -@mock.patch('src.model.document.CreationInfo', autospec=True) +@mock.patch('spdx.model.document.CreationInfo', autospec=True) def test_wrong_type_in_annotations(creation_info): with pytest.raises(TypeError): Document(creation_info, annotations=["string"]) -@mock.patch('src.model.document.CreationInfo', autospec=True) +@mock.patch('spdx.model.document.CreationInfo', autospec=True) def test_wrong_type_in_relationships(creation_info): with pytest.raises(TypeError): Document(creation_info, relationships="string") -@mock.patch('src.model.document.CreationInfo', autospec=True) +@mock.patch('spdx.model.document.CreationInfo', autospec=True) def test_wrong_type_in_extracted_licensing_info(creation_info): with pytest.raises(TypeError): Document(creation_info, extracted_licensing_info=42) diff --git a/tests/model/test_external_document_ref.py b/tests/model/test_external_document_ref.py index fecf4bb93..c210910af 100644 --- a/tests/model/test_external_document_ref.py +++ b/tests/model/test_external_document_ref.py @@ -2,10 +2,10 @@ import pytest -from src.model.external_document_ref import ExternalDocumentRef +from spdx.model.external_document_ref import ExternalDocumentRef -@mock.patch('src.model.checksum.Checksum', autospec=True) +@mock.patch('spdx.model.checksum.Checksum', autospec=True) def test_correct_initialization(checksum): external_document_ref = ExternalDocumentRef("id", "uri", checksum) assert external_document_ref.document_ref_id == "id" @@ -13,13 +13,13 @@ def test_correct_initialization(checksum): assert external_document_ref.checksum == checksum -@mock.patch('src.model.checksum.Checksum', autospec=True) +@mock.patch('spdx.model.checksum.Checksum', autospec=True) def test_wrong_type_in_spdx_id(checksum): with pytest.raises(TypeError): ExternalDocumentRef(42, "uri", checksum) -@mock.patch('src.model.checksum.Checksum', autospec=True) +@mock.patch('spdx.model.checksum.Checksum', autospec=True) def test_wrong_type_in_document_uri(checksum): with pytest.raises(TypeError): ExternalDocumentRef("id", 42, checksum) diff --git a/tests/model/test_external_package_reference.py b/tests/model/test_external_package_reference.py index 52a2c2519..768e56329 100644 --- a/tests/model/test_external_package_reference.py +++ b/tests/model/test_external_package_reference.py @@ -1,6 +1,6 @@ import pytest -from src.model.package import ExternalPackageRef, ExternalPackageRefCategory +from spdx.model.package import ExternalPackageRef, ExternalPackageRefCategory def test_correct_initialization(): diff --git a/tests/model/test_extracted_licensing_info.py b/tests/model/test_extracted_licensing_info.py index 1d83077a3..cefba997a 100644 --- a/tests/model/test_extracted_licensing_info.py +++ b/tests/model/test_extracted_licensing_info.py @@ -1,6 +1,6 @@ import pytest -from src.model.extracted_licensing_info import ExtractedLicensingInfo +from spdx.model.extracted_licensing_info import ExtractedLicensingInfo def test_correct_initialization(): diff --git a/tests/model/test_file.py b/tests/model/test_file.py index 0c8cd3513..40a77d74b 100644 --- a/tests/model/test_file.py +++ b/tests/model/test_file.py @@ -2,13 +2,13 @@ import pytest -from src.model.checksum import Checksum, ChecksumAlgorithm -from src.model.file import File, FileType -from src.model.spdx_no_assertion import SpdxNoAssertion -from src.model.spdx_none import SpdxNone +from spdx.model.checksum import Checksum, ChecksumAlgorithm +from spdx.model.file import File, FileType +from spdx.model.spdx_no_assertion import SpdxNoAssertion +from spdx.model.spdx_none import SpdxNone -@mock.patch('src.model.checksum.Checksum', autospec=True) +@mock.patch('spdx.model.checksum.Checksum', autospec=True) def test_correct_initialization(checksum): file = File("name", "id", [checksum, checksum], [FileType.OTHER, FileType.SPDX], SpdxNone(), SpdxNoAssertion(), "comment on license", "copyright", "comment", "notice", ["contributor"], ["attribution"]) @@ -26,7 +26,7 @@ def test_correct_initialization(checksum): assert file.attribution_texts == ["attribution"] -@mock.patch('src.model.checksum.Checksum', autospec=True) +@mock.patch('spdx.model.checksum.Checksum', autospec=True) def test_correct_initialization_with_default_values(checksum): file = File("name", "id", [checksum, checksum]) assert file.name == "name" @@ -43,13 +43,13 @@ def test_correct_initialization_with_default_values(checksum): assert file.attribution_texts == [] -@mock.patch('src.model.checksum.Checksum', autospec=True) +@mock.patch('spdx.model.checksum.Checksum', autospec=True) def test_wrong_type_in_name(checksum): with pytest.raises(TypeError): File(42, "id", [checksum]) -@mock.patch('src.model.checksum.Checksum', autospec=True) +@mock.patch('spdx.model.checksum.Checksum', autospec=True) def test_wrong_type_in_spdx_id(checksum): with pytest.raises(TypeError): File("name", 42, [checksum]) @@ -61,55 +61,55 @@ def test_wrong_type_in_checksum(): File("name", "id", checksum) -@mock.patch('src.model.checksum.Checksum', autospec=True) +@mock.patch('spdx.model.checksum.Checksum', autospec=True) def test_wrong_type_in_file_type(checksum): with pytest.raises(TypeError): File("name", "id", [checksum], file_type=FileType.OTHER) -@mock.patch('src.model.checksum.Checksum', autospec=True) +@mock.patch('spdx.model.checksum.Checksum', autospec=True) def test_wrong_type_in_concluded_license(checksum): with pytest.raises(TypeError): File("name", "id", [checksum], concluded_license="NONE") -@mock.patch('src.model.checksum.Checksum', autospec=True) +@mock.patch('spdx.model.checksum.Checksum', autospec=True) def test_wrong_type_in_license_info_in_file(checksum): with pytest.raises(TypeError): File("name", "id", [checksum], license_info_in_file=[SpdxNone]) -@mock.patch('src.model.checksum.Checksum', autospec=True) +@mock.patch('spdx.model.checksum.Checksum', autospec=True) def test_wrong_type_in_license_comment(checksum): with pytest.raises(TypeError): File("name", "id", [checksum], license_comment=42) -@mock.patch('src.model.checksum.Checksum', autospec=True) +@mock.patch('spdx.model.checksum.Checksum', autospec=True) def test_wrong_type_in_copyright_text(checksum): with pytest.raises(TypeError): File("name", "id", [checksum], copyright_text=[SpdxNone()]) -@mock.patch('src.model.checksum.Checksum', autospec=True) +@mock.patch('spdx.model.checksum.Checksum', autospec=True) def test_wrong_type_in_comment(checksum): with pytest.raises(TypeError): File("name", "id", [checksum], comment=42) -@mock.patch('src.model.checksum.Checksum', autospec=True) +@mock.patch('spdx.model.checksum.Checksum', autospec=True) def test_wrong_type_in_notice(checksum): with pytest.raises(TypeError): File("name", "id", [checksum], notice=["notice"]) -@mock.patch('src.model.checksum.Checksum', autospec=True) +@mock.patch('spdx.model.checksum.Checksum', autospec=True) def test_wrong_type_in_contributors(checksum): with pytest.raises(TypeError): File("name", "id", [checksum], contributors="contributor") -@mock.patch('src.model.checksum.Checksum', autospec=True) +@mock.patch('spdx.model.checksum.Checksum', autospec=True) def test_wrong_type_in_attribution_texts(checksum): with pytest.raises(TypeError): File("name", "id", [checksum], attribution_texts=["attribution", 42]) diff --git a/tests/model/test_license.py b/tests/model/test_license.py index 210ad53a5..69bf7fa88 100644 --- a/tests/model/test_license.py +++ b/tests/model/test_license.py @@ -12,7 +12,7 @@ import pytest -from src.model.license import determine_full_name, determine_identifier +from spdx.model.license import determine_full_name, determine_identifier @pytest.mark.parametrize("identifier,full_name,expected", diff --git a/tests/model/test_package.py b/tests/model/test_package.py index 85f1d7920..bb0e92816 100644 --- a/tests/model/test_package.py +++ b/tests/model/test_package.py @@ -3,17 +3,17 @@ import pytest -from src.model.checksum import Checksum, ChecksumAlgorithm -from src.model.license_expression import LicenseExpression -from src.model.package import Package, PackagePurpose -from src.model.spdx_no_assertion import SpdxNoAssertion -from src.model.spdx_none import SpdxNone +from spdx.model.checksum import Checksum, ChecksumAlgorithm +from spdx.model.license_expression import LicenseExpression +from spdx.model.package import Package, PackagePurpose +from spdx.model.spdx_no_assertion import SpdxNoAssertion +from spdx.model.spdx_none import SpdxNone -@mock.patch('src.model.actor.Actor', autospec=True) -@mock.patch('src.model.package.PackageVerificationCode', autospec=True) -@mock.patch('src.model.checksum.Checksum', autospec=True) -@mock.patch('src.model.package.ExternalPackageRef', autospec=True) +@mock.patch('spdx.model.actor.Actor', autospec=True) +@mock.patch('spdx.model.package.PackageVerificationCode', autospec=True) +@mock.patch('spdx.model.checksum.Checksum', autospec=True) +@mock.patch('spdx.model.package.ExternalPackageRef', autospec=True) def test_correct_initialization(actor, verif_code, checksum, ext_ref): package = Package("id", "name", SpdxNoAssertion(), "version", "file_name", SpdxNoAssertion(), actor, True, verif_code, [checksum], "homepage", "source_info", None, [LicenseExpression("expression")], diff --git a/tests/model/test_package_verification_code.py b/tests/model/test_package_verification_code.py index 266b7f157..2afe5c434 100644 --- a/tests/model/test_package_verification_code.py +++ b/tests/model/test_package_verification_code.py @@ -1,6 +1,6 @@ import pytest -from src.model.package import PackageVerificationCode +from spdx.model.package import PackageVerificationCode def test_correct_initialization(): diff --git a/tests/model/test_relationship.py b/tests/model/test_relationship.py index c3b99a689..0413729ed 100644 --- a/tests/model/test_relationship.py +++ b/tests/model/test_relationship.py @@ -1,7 +1,7 @@ import pytest -from src.model.relationship import Relationship, RelationshipType -from src.model.spdx_no_assertion import SpdxNoAssertion +from spdx.model.relationship import Relationship, RelationshipType +from spdx.model.spdx_no_assertion import SpdxNoAssertion def test_correct_initialization(): diff --git a/tests/model/test_snippet.py b/tests/model/test_snippet.py index 0e7030507..779e0c6dc 100644 --- a/tests/model/test_snippet.py +++ b/tests/model/test_snippet.py @@ -1,8 +1,8 @@ import pytest -from src.model.snippet import Snippet -from src.model.spdx_no_assertion import SpdxNoAssertion -from src.model.spdx_none import SpdxNone +from spdx.model.snippet import Snippet +from spdx.model.spdx_no_assertion import SpdxNoAssertion +from spdx.model.spdx_none import SpdxNone def test_correct_initialization(): diff --git a/tests/model/test_version.py b/tests/model/test_version.py index 997de23e2..574a5faa2 100644 --- a/tests/model/test_version.py +++ b/tests/model/test_version.py @@ -12,7 +12,7 @@ import pytest -from src.model.version import Version +from spdx.model.version import Version @pytest.mark.parametrize("input_string,expected", [("1.2", Version(1, 2)), ("12.345", Version(12, 345))]) diff --git a/tests/parser/json/test_json_parser.py b/tests/parser/json/test_json_parser.py index 80a7de0ab..3acbfa14e 100644 --- a/tests/parser/json/test_json_parser.py +++ b/tests/parser/json/test_json_parser.py @@ -12,8 +12,8 @@ import os import pytest -from src.model.document import Document -from src.parser.json import json_parser +from spdx.model.document import Document +from spdx.parser.json import json_parser def test_parse_json_file_not_found(): with pytest.raises(FileNotFoundError) as err: diff --git a/tests/parser/jsonlikedict/test_actor_parser.py b/tests/parser/jsonlikedict/test_actor_parser.py index 93429e42c..3938d9536 100644 --- a/tests/parser/jsonlikedict/test_actor_parser.py +++ b/tests/parser/jsonlikedict/test_actor_parser.py @@ -11,9 +11,9 @@ import pytest from unittest import TestCase -from src.model.actor import ActorType -from src.parser.error import SPDXParsingError -from src.parser.jsonlikedict.actor_parser import ActorParser +from spdx.model.actor import ActorType +from spdx.parser.error import SPDXParsingError +from spdx.parser.jsonlikedict.actor_parser import ActorParser @pytest.mark.parametrize("actor_string,expected_type,expected_name,expected_mail", [ diff --git a/tests/parser/jsonlikedict/test_annotation_parser.py b/tests/parser/jsonlikedict/test_annotation_parser.py index 1ffd819f8..7bf6b66f8 100644 --- a/tests/parser/jsonlikedict/test_annotation_parser.py +++ b/tests/parser/jsonlikedict/test_annotation_parser.py @@ -13,10 +13,10 @@ import pytest -from src.model.actor import Actor, ActorType -from src.model.annotation import AnnotationType, Annotation -from src.parser.error import SPDXParsingError -from src.parser.jsonlikedict.annotation_parser import AnnotationParser +from spdx.model.actor import Actor, ActorType +from spdx.model.annotation import AnnotationType, Annotation +from spdx.parser.error import SPDXParsingError +from spdx.parser.jsonlikedict.annotation_parser import AnnotationParser def test_parse_annotation(): @@ -105,8 +105,8 @@ def test_parse_all_annotations(): @pytest.mark.parametrize("incomplete_annotation_dict,expected_message", [({"annotator": "Person: Jane Doe ()"}, [ - "Error while constructing Annotation: ['SetterError Annotation: type of " 'argument "spdx_id" must be str; got NoneType instead: None\', \'SetterError Annotation: type of argument "annotation_type" must be ' "src.model.annotation.AnnotationType; got NoneType instead: None', " '\'SetterError Annotation: type of argument "annotation_date" must be ' "datetime.datetime; got NoneType instead: None', 'SetterError Annotation: " 'type of argument "annotation_comment" must be str; got NoneType instead: ' "None']"]), - ({"annotationDate": "2010-01-29T18:30:22Z"}, ["Error while constructing Annotation: ['SetterError Annotation: type of " 'argument "spdx_id" must be str; got NoneType instead: None\', \'SetterError Annotation: type of argument "annotation_type" must be ' "src.model.annotation.AnnotationType; got NoneType instead: None', " '\'SetterError Annotation: type of argument "annotator" must be ' "src.model.actor.Actor; got NoneType instead: None', 'SetterError Annotation: " 'type of argument "annotation_comment" must be str; got NoneType instead: ' "None']"])]) + "Error while constructing Annotation: ['SetterError Annotation: type of " 'argument "spdx_id" must be str; got NoneType instead: None\', \'SetterError Annotation: type of argument "annotation_type" must be ' "spdx.model.annotation.AnnotationType; got NoneType instead: None', " '\'SetterError Annotation: type of argument "annotation_date" must be ' "datetime.datetime; got NoneType instead: None', 'SetterError Annotation: " 'type of argument "annotation_comment" must be str; got NoneType instead: ' "None']"]), + ({"annotationDate": "2010-01-29T18:30:22Z"}, ["Error while constructing Annotation: ['SetterError Annotation: type of " 'argument "spdx_id" must be str; got NoneType instead: None\', \'SetterError Annotation: type of argument "annotation_type" must be ' "spdx.model.annotation.AnnotationType; got NoneType instead: None', " '\'SetterError Annotation: type of argument "annotator" must be ' "spdx.model.actor.Actor; got NoneType instead: None', 'SetterError Annotation: " 'type of argument "annotation_comment" must be str; got NoneType instead: ' "None']"])]) def test_parse_incomplete_annotation(incomplete_annotation_dict, expected_message): annotation_parser = AnnotationParser() diff --git a/tests/parser/jsonlikedict/test_checksum_parser.py b/tests/parser/jsonlikedict/test_checksum_parser.py index 86d4b6d5d..a60249787 100644 --- a/tests/parser/jsonlikedict/test_checksum_parser.py +++ b/tests/parser/jsonlikedict/test_checksum_parser.py @@ -12,9 +12,9 @@ import pytest -from src.model.checksum import ChecksumAlgorithm -from src.parser.error import SPDXParsingError -from src.parser.jsonlikedict.checksum_parser import ChecksumParser +from spdx.model.checksum import ChecksumAlgorithm +from spdx.parser.error import SPDXParsingError +from spdx.parser.jsonlikedict.checksum_parser import ChecksumParser def test_parse_checksum(): diff --git a/tests/parser/jsonlikedict/test_creation_info_parser.py b/tests/parser/jsonlikedict/test_creation_info_parser.py index 0193c1938..a45f204b6 100644 --- a/tests/parser/jsonlikedict/test_creation_info_parser.py +++ b/tests/parser/jsonlikedict/test_creation_info_parser.py @@ -13,12 +13,12 @@ import pytest -from src.model.actor import Actor, ActorType -from src.model.checksum import Checksum, ChecksumAlgorithm -from src.model.external_document_ref import ExternalDocumentRef -from src.model.version import Version -from src.parser.error import SPDXParsingError -from src.parser.jsonlikedict.creation_info_parser import CreationInfoParser +from spdx.model.actor import Actor, ActorType +from spdx.model.checksum import Checksum, ChecksumAlgorithm +from spdx.model.external_document_ref import ExternalDocumentRef +from spdx.model.version import Version +from spdx.parser.error import SPDXParsingError +from spdx.parser.jsonlikedict.creation_info_parser import CreationInfoParser def test_parse_creation_info(): diff --git a/tests/parser/jsonlikedict/test_dict_parsing_functions.py b/tests/parser/jsonlikedict/test_dict_parsing_functions.py index 8d9f80d32..30232e6ae 100644 --- a/tests/parser/jsonlikedict/test_dict_parsing_functions.py +++ b/tests/parser/jsonlikedict/test_dict_parsing_functions.py @@ -13,12 +13,12 @@ import pytest -from src.model.spdx_no_assertion import SpdxNoAssertion -from src.model.spdx_none import SpdxNone -from src.parser.error import SPDXParsingError -from src.parser.jsonlikedict.dict_parsing_functions import json_str_to_enum_name, \ +from spdx.model.spdx_no_assertion import SpdxNoAssertion +from spdx.model.spdx_none import SpdxNone +from spdx.parser.error import SPDXParsingError +from spdx.parser.jsonlikedict.dict_parsing_functions import json_str_to_enum_name, \ parse_field_or_no_assertion, parse_field_or_no_assertion_or_none -from src.datetime_conversions import datetime_from_str +from spdx.datetime_conversions import datetime_from_str def test_json_str_to_enum(): diff --git a/tests/parser/jsonlikedict/test_extracted_licensing_info_parser.py b/tests/parser/jsonlikedict/test_extracted_licensing_info_parser.py index 848576d37..d73ed5c0e 100644 --- a/tests/parser/jsonlikedict/test_extracted_licensing_info_parser.py +++ b/tests/parser/jsonlikedict/test_extracted_licensing_info_parser.py @@ -12,8 +12,8 @@ import pytest -from src.parser.error import SPDXParsingError -from src.parser.jsonlikedict.extracted_licensing_info_parser import ExtractedLicensingInfoParser +from spdx.parser.error import SPDXParsingError +from spdx.parser.jsonlikedict.extracted_licensing_info_parser import ExtractedLicensingInfoParser def test_parse_extracted_licensing_info(): diff --git a/tests/parser/jsonlikedict/test_file_parser.py b/tests/parser/jsonlikedict/test_file_parser.py index bf26e29e8..ea8eabed9 100644 --- a/tests/parser/jsonlikedict/test_file_parser.py +++ b/tests/parser/jsonlikedict/test_file_parser.py @@ -12,12 +12,12 @@ import pytest -from src.model.checksum import Checksum, ChecksumAlgorithm -from src.model.file import FileType -from src.model.license_expression import LicenseExpression -from src.parser.error import SPDXParsingError -from src.parser.jsonlikedict.dict_parsing_functions import parse_list_of_elements -from src.parser.jsonlikedict.file_parser import FileParser +from spdx.model.checksum import Checksum, ChecksumAlgorithm +from spdx.model.file import FileType +from spdx.model.license_expression import LicenseExpression +from spdx.parser.error import SPDXParsingError +from spdx.parser.jsonlikedict.dict_parsing_functions import parse_list_of_elements +from spdx.parser.jsonlikedict.file_parser import FileParser def test_parse_file(): diff --git a/tests/parser/jsonlikedict/test_license_expression_parser.py b/tests/parser/jsonlikedict/test_license_expression_parser.py index 7e30e2ab2..b21583426 100644 --- a/tests/parser/jsonlikedict/test_license_expression_parser.py +++ b/tests/parser/jsonlikedict/test_license_expression_parser.py @@ -12,9 +12,9 @@ import pytest -from src.model.license_expression import LicenseExpression -from src.parser.error import SPDXParsingError -from src.parser.jsonlikedict.license_expression_parser import LicenseExpressionParser +from spdx.model.license_expression import LicenseExpression +from spdx.parser.error import SPDXParsingError +from spdx.parser.jsonlikedict.license_expression_parser import LicenseExpressionParser @pytest.mark.parametrize("invalid_license_expression,expected_message", diff --git a/tests/parser/jsonlikedict/test_package_parser.py b/tests/parser/jsonlikedict/test_package_parser.py index 5d04331e3..6839af812 100644 --- a/tests/parser/jsonlikedict/test_package_parser.py +++ b/tests/parser/jsonlikedict/test_package_parser.py @@ -13,13 +13,13 @@ import pytest -from src.model.actor import Actor, ActorType -from src.model.checksum import Checksum, ChecksumAlgorithm -from src.model.license_expression import LicenseExpression -from src.model.package import PackageVerificationCode, ExternalPackageRef, ExternalPackageRefCategory, PackagePurpose -from src.parser.error import SPDXParsingError -from src.parser.jsonlikedict.dict_parsing_functions import parse_list_of_elements -from src.parser.jsonlikedict.package_parser import PackageParser +from spdx.model.actor import Actor, ActorType +from spdx.model.checksum import Checksum, ChecksumAlgorithm +from spdx.model.license_expression import LicenseExpression +from spdx.model.package import PackageVerificationCode, ExternalPackageRef, ExternalPackageRefCategory, PackagePurpose +from spdx.parser.error import SPDXParsingError +from spdx.parser.jsonlikedict.dict_parsing_functions import parse_list_of_elements +from spdx.parser.jsonlikedict.package_parser import PackageParser def test_parse_package(): @@ -128,7 +128,7 @@ def test_parse_package(): @pytest.mark.parametrize("incomplete_package_dict,expected_message", [({"SPDXID": "SPDXRef-Package"}, [ - "Error while constructing Package: ['SetterError Package: type of " 'argument "name" must be str; got NoneType instead: None\', \'SetterError Package: type of argument "download_location" must be one of (str, src.model.spdx_no_assertion.SpdxNoAssertion, src.model.spdx_none.SpdxNone); ' "got NoneType instead: None']"]), + "Error while constructing Package: ['SetterError Package: type of " 'argument "name" must be str; got NoneType instead: None\', \'SetterError Package: type of argument "download_location" must be one of (str, spdx.model.spdx_no_assertion.SpdxNoAssertion, spdx.model.spdx_none.SpdxNone); ' "got NoneType instead: None']"]), ({"SPDXID": "SPDXRef-Package", "name": 5, "downloadLocation": "NONE"}, [ "Error while constructing Package: ['SetterError Package: type of argument " '"name" must be str; got int instead: 5\']'])]) @@ -199,7 +199,7 @@ def test_parse_external_ref(): package_parser.parse_external_ref(external_ref) TestCase().assertCountEqual(err.value.get_messages(), [ - "Error while constructing ExternalPackageRef: ['SetterError " 'ExternalPackageRef: type of argument "category" must be ' "src.model.package.ExternalPackageRefCategory; got NoneType instead: None', " '\'SetterError ExternalPackageRef: type of argument "locator" must be str; ' "got NoneType instead: None']"]) + "Error while constructing ExternalPackageRef: ['SetterError " 'ExternalPackageRef: type of argument "category" must be ' "spdx.model.package.ExternalPackageRefCategory; got NoneType instead: None', " '\'SetterError ExternalPackageRef: type of argument "locator" must be str; ' "got NoneType instead: None']"]) def test_parse_invalid_external_package_ref_category(): package_parser = PackageParser() diff --git a/tests/parser/jsonlikedict/test_relationship_parser.py b/tests/parser/jsonlikedict/test_relationship_parser.py index 83bdd212e..20dc39a42 100644 --- a/tests/parser/jsonlikedict/test_relationship_parser.py +++ b/tests/parser/jsonlikedict/test_relationship_parser.py @@ -12,10 +12,10 @@ import pytest -from src.model.relationship import RelationshipType, Relationship -from src.model.spdx_no_assertion import SpdxNoAssertion -from src.parser.error import SPDXParsingError -from src.parser.jsonlikedict.relationship_parser import RelationshipParser +from spdx.model.relationship import RelationshipType, Relationship +from spdx.model.spdx_no_assertion import SpdxNoAssertion +from spdx.parser.error import SPDXParsingError +from spdx.parser.jsonlikedict.relationship_parser import RelationshipParser def test_parse_relationship(): @@ -48,7 +48,7 @@ def test_parse_incomplete_relationship(): relationship_parser.parse_relationship(relationship_dict) TestCase().assertCountEqual(err.value.get_messages(), [ - "Error while constructing Relationship: ['SetterError Relationship: type of " 'argument "relationship_type" must be ' "src.model.relationship.RelationshipType; got NoneType instead: None']"]) + "Error while constructing Relationship: ['SetterError Relationship: type of " 'argument "relationship_type" must be ' "spdx.model.relationship.RelationshipType; got NoneType instead: None']"]) def test_parse_relationship_type(): diff --git a/tests/parser/jsonlikedict/test_snippet_parser.py b/tests/parser/jsonlikedict/test_snippet_parser.py index 91d1d446c..e9108eed7 100644 --- a/tests/parser/jsonlikedict/test_snippet_parser.py +++ b/tests/parser/jsonlikedict/test_snippet_parser.py @@ -12,9 +12,9 @@ import pytest -from src.model.license_expression import LicenseExpression -from src.parser.error import SPDXParsingError -from src.parser.jsonlikedict.snippet_parser import SnippetParser +from spdx.model.license_expression import LicenseExpression +from spdx.parser.error import SPDXParsingError +from spdx.parser.jsonlikedict.snippet_parser import SnippetParser def test_parse_snippet(): diff --git a/tests/test_datetime_conversions.py b/tests/test_datetime_conversions.py index f015a4cd6..265054c0b 100644 --- a/tests/test_datetime_conversions.py +++ b/tests/test_datetime_conversions.py @@ -12,7 +12,7 @@ import pytest -from src.datetime_conversions import datetime_from_str, datetime_to_iso_string +from spdx.datetime_conversions import datetime_from_str, datetime_to_iso_string def test_datetime_to_iso_string(): diff --git a/tests/validation/test_actor_validator.py b/tests/validation/test_actor_validator.py index 417755236..f7f7e22da 100644 --- a/tests/validation/test_actor_validator.py +++ b/tests/validation/test_actor_validator.py @@ -13,9 +13,9 @@ import pytest -from src.model.actor import ActorType -from src.validation.actor_validator import validate_actor -from src.validation.validation_message import ValidationMessage, ValidationContext, SpdxElementType +from spdx.model.actor import ActorType +from spdx.validation.actor_validator import validate_actor +from spdx.validation.validation_message import ValidationMessage, ValidationContext, SpdxElementType from tests.fixtures import actor_fixture diff --git a/tests/validation/test_annotation_validator.py b/tests/validation/test_annotation_validator.py index 9081fe260..b6a624855 100644 --- a/tests/validation/test_annotation_validator.py +++ b/tests/validation/test_annotation_validator.py @@ -13,10 +13,10 @@ import pytest -from src.model.annotation import Annotation -from src.model.document import Document -from src.validation.annotation_validator import validate_annotation -from src.validation.validation_message import ValidationMessage, ValidationContext, SpdxElementType +from spdx.model.annotation import Annotation +from spdx.model.document import Document +from spdx.validation.annotation_validator import validate_annotation +from spdx.validation.validation_message import ValidationMessage, ValidationContext, SpdxElementType from tests.fixtures import document_fixture, annotation_fixture, file_fixture diff --git a/tests/validation/test_checksum_validator.py b/tests/validation/test_checksum_validator.py index 72ecb0cd9..c57e7b022 100644 --- a/tests/validation/test_checksum_validator.py +++ b/tests/validation/test_checksum_validator.py @@ -13,9 +13,9 @@ import pytest -from src.model.checksum import Checksum, ChecksumAlgorithm -from src.validation.checksum_validator import validate_checksum -from src.validation.validation_message import ValidationMessage, ValidationContext, SpdxElementType +from spdx.model.checksum import Checksum, ChecksumAlgorithm +from spdx.validation.checksum_validator import validate_checksum +from spdx.validation.validation_message import ValidationMessage, ValidationContext, SpdxElementType from tests.fixtures import checksum_fixture diff --git a/tests/validation/test_creation_info_validator.py b/tests/validation/test_creation_info_validator.py index 93b93c512..323252f97 100644 --- a/tests/validation/test_creation_info_validator.py +++ b/tests/validation/test_creation_info_validator.py @@ -13,8 +13,8 @@ import pytest -from src.validation.creation_info_validator import validate_creation_info -from src.validation.validation_message import ValidationMessage, ValidationContext, SpdxElementType +from spdx.validation.creation_info_validator import validate_creation_info +from spdx.validation.validation_message import ValidationMessage, ValidationContext, SpdxElementType from tests.fixtures import creation_info_fixture diff --git a/tests/validation/test_document_validator.py b/tests/validation/test_document_validator.py index 0c615255b..6156f4ca4 100644 --- a/tests/validation/test_document_validator.py +++ b/tests/validation/test_document_validator.py @@ -13,9 +13,9 @@ import pytest -from src.model.document import Document, CreationInfo -from src.validation.document_validator import validate_full_spdx_document -from src.validation.validation_message import ValidationMessage, ValidationContext, SpdxElementType +from spdx.model.document import Document, CreationInfo +from spdx.validation.document_validator import validate_full_spdx_document +from spdx.validation.validation_message import ValidationMessage, ValidationContext, SpdxElementType from tests.fixtures import document_fixture, creation_info_fixture diff --git a/tests/validation/test_external_document_ref_validator.py b/tests/validation/test_external_document_ref_validator.py index a94bd1d17..870e80f06 100644 --- a/tests/validation/test_external_document_ref_validator.py +++ b/tests/validation/test_external_document_ref_validator.py @@ -11,8 +11,8 @@ from typing import List -from src.validation.external_document_ref_validator import validate_external_document_ref -from src.validation.validation_message import ValidationMessage +from spdx.validation.external_document_ref_validator import validate_external_document_ref +from spdx.validation.validation_message import ValidationMessage from tests.fixtures import external_document_ref_fixture diff --git a/tests/validation/test_external_package_ref_validator.py b/tests/validation/test_external_package_ref_validator.py index 4430e96f5..f347f9a7c 100644 --- a/tests/validation/test_external_package_ref_validator.py +++ b/tests/validation/test_external_package_ref_validator.py @@ -13,8 +13,8 @@ import pytest -from src.validation.external_package_ref_validator import validate_external_package_ref -from src.validation.validation_message import ValidationMessage, ValidationContext, SpdxElementType +from spdx.validation.external_package_ref_validator import validate_external_package_ref +from spdx.validation.validation_message import ValidationMessage, ValidationContext, SpdxElementType from tests.fixtures import external_package_ref_fixture diff --git a/tests/validation/test_extracted_licensing_info_validator.py b/tests/validation/test_extracted_licensing_info_validator.py index c2e557495..2017c151c 100644 --- a/tests/validation/test_extracted_licensing_info_validator.py +++ b/tests/validation/test_extracted_licensing_info_validator.py @@ -13,8 +13,8 @@ import pytest -from src.validation.extracted_licensing_info_validator import validate_extracted_licensing_info -from src.validation.validation_message import ValidationMessage, ValidationContext, SpdxElementType +from spdx.validation.extracted_licensing_info_validator import validate_extracted_licensing_info +from spdx.validation.validation_message import ValidationMessage, ValidationContext, SpdxElementType from tests.fixtures import extracted_licensing_info_fixture diff --git a/tests/validation/test_file_validator.py b/tests/validation/test_file_validator.py index 5aaa95350..433fd1145 100644 --- a/tests/validation/test_file_validator.py +++ b/tests/validation/test_file_validator.py @@ -13,9 +13,9 @@ import pytest -from src.model.checksum import Checksum, ChecksumAlgorithm -from src.validation.file_validator import validate_file_within_document -from src.validation.validation_message import ValidationMessage, ValidationContext, SpdxElementType +from spdx.model.checksum import Checksum, ChecksumAlgorithm +from spdx.validation.file_validator import validate_file_within_document +from spdx.validation.validation_message import ValidationMessage, ValidationContext, SpdxElementType from tests.fixtures import file_fixture, document_fixture diff --git a/tests/validation/test_license_expression_validator.py b/tests/validation/test_license_expression_validator.py index 6203f5688..ac13a537a 100644 --- a/tests/validation/test_license_expression_validator.py +++ b/tests/validation/test_license_expression_validator.py @@ -11,9 +11,9 @@ from typing import List -from src.model.license_expression import LicenseExpression -from src.validation.license_expression_validator import validate_license_expression -from src.validation.validation_message import ValidationMessage +from spdx.model.license_expression import LicenseExpression +from spdx.validation.license_expression_validator import validate_license_expression +from spdx.validation.validation_message import ValidationMessage def test_valid_license_expression(): diff --git a/tests/validation/test_package_validator.py b/tests/validation/test_package_validator.py index b54941c50..929f17bcc 100644 --- a/tests/validation/test_package_validator.py +++ b/tests/validation/test_package_validator.py @@ -13,11 +13,11 @@ import pytest -from src.model.license_expression import LicenseExpression -from src.model.spdx_no_assertion import SpdxNoAssertion -from src.model.spdx_none import SpdxNone -from src.validation.package_validator import validate_package_within_document -from src.validation.validation_message import ValidationMessage, ValidationContext, SpdxElementType +from spdx.model.license_expression import LicenseExpression +from spdx.model.spdx_no_assertion import SpdxNoAssertion +from spdx.model.spdx_none import SpdxNone +from spdx.validation.package_validator import validate_package_within_document +from spdx.validation.validation_message import ValidationMessage, ValidationContext, SpdxElementType from tests.fixtures import package_fixture, package_verification_code_fixture, document_fixture diff --git a/tests/validation/test_relationship_validator.py b/tests/validation/test_relationship_validator.py index c9f4e84d3..684334b7f 100644 --- a/tests/validation/test_relationship_validator.py +++ b/tests/validation/test_relationship_validator.py @@ -13,12 +13,12 @@ import pytest -from src.model.document import Document -from src.model.relationship import Relationship, RelationshipType -from src.model.spdx_no_assertion import SpdxNoAssertion -from src.model.spdx_none import SpdxNone -from src.validation.relationship_validator import validate_relationship -from src.validation.validation_message import ValidationMessage, SpdxElementType, ValidationContext +from spdx.model.document import Document +from spdx.model.relationship import Relationship, RelationshipType +from spdx.model.spdx_no_assertion import SpdxNoAssertion +from spdx.model.spdx_none import SpdxNone +from spdx.validation.relationship_validator import validate_relationship +from spdx.validation.validation_message import ValidationMessage, SpdxElementType, ValidationContext from tests.fixtures import document_fixture, relationship_fixture diff --git a/tests/validation/test_snippet_validator.py b/tests/validation/test_snippet_validator.py index 3add700a0..46c72ae0d 100644 --- a/tests/validation/test_snippet_validator.py +++ b/tests/validation/test_snippet_validator.py @@ -13,8 +13,8 @@ import pytest -from src.validation.snippet_validator import validate_snippet_within_document -from src.validation.validation_message import ValidationMessage, ValidationContext, SpdxElementType +from spdx.validation.snippet_validator import validate_snippet_within_document +from spdx.validation.validation_message import ValidationMessage, ValidationContext, SpdxElementType from tests.fixtures import document_fixture, snippet_fixture diff --git a/tests/validation/test_uri_validators.py b/tests/validation/test_uri_validators.py index 552fbf6c0..5eac56145 100644 --- a/tests/validation/test_uri_validators.py +++ b/tests/validation/test_uri_validators.py @@ -11,7 +11,7 @@ import pytest -from src.validation.uri_validators import validate_url, validate_download_location, validate_uri +from spdx.validation.uri_validators import validate_url, validate_download_location, validate_uri @pytest.mark.parametrize("input_value", ["https://some.url", diff --git a/tests/writer/json/test_json_writer.py b/tests/writer/json/test_json_writer.py index 9b2a11747..8d8da5875 100644 --- a/tests/writer/json/test_json_writer.py +++ b/tests/writer/json/test_json_writer.py @@ -14,18 +14,18 @@ import pytest -from src.model.actor import Actor, ActorType -from src.model.annotation import Annotation, AnnotationType -from src.model.checksum import ChecksumAlgorithm, Checksum -from src.model.document import CreationInfo, Document -from src.model.external_document_ref import ExternalDocumentRef -from src.model.extracted_licensing_info import ExtractedLicensingInfo -from src.model.file import File -from src.model.package import Package -from src.model.relationship import RelationshipType, Relationship -from src.model.snippet import Snippet -from src.model.spdx_none import SpdxNone -from src.writer.json.json_writer import write_document +from spdx.model.actor import Actor, ActorType +from spdx.model.annotation import Annotation, AnnotationType +from spdx.model.checksum import ChecksumAlgorithm, Checksum +from spdx.model.document import CreationInfo, Document +from spdx.model.external_document_ref import ExternalDocumentRef +from spdx.model.extracted_licensing_info import ExtractedLicensingInfo +from spdx.model.file import File +from spdx.model.package import Package +from spdx.model.relationship import RelationshipType, Relationship +from spdx.model.snippet import Snippet +from spdx.model.spdx_none import SpdxNone +from spdx.writer.json.json_writer import write_document from tests.fixtures import document_fixture diff --git a/tests/writer/tagvalue/test_package_writer.py b/tests/writer/tagvalue/test_package_writer.py index 735a983dd..b00f5fc78 100644 --- a/tests/writer/tagvalue/test_package_writer.py +++ b/tests/writer/tagvalue/test_package_writer.py @@ -11,14 +11,14 @@ from datetime import datetime from unittest.mock import patch, mock_open, call -from src.model.actor import ActorType, Actor -from src.model.checksum import Checksum, ChecksumAlgorithm -from src.model.license_expression import LicenseExpression -from src.model.package import PackagePurpose, Package, PackageVerificationCode, ExternalPackageRef, \ +from spdx.model.actor import ActorType, Actor +from spdx.model.checksum import Checksum, ChecksumAlgorithm +from spdx.model.license_expression import LicenseExpression +from spdx.model.package import PackagePurpose, Package, PackageVerificationCode, ExternalPackageRef, \ ExternalPackageRefCategory -from src.model.spdx_no_assertion import SpdxNoAssertion -from src.model.spdx_none import SpdxNone -from src.writer.tagvalue.package_writer import write_package +from spdx.model.spdx_no_assertion import SpdxNoAssertion +from spdx.model.spdx_none import SpdxNone +from spdx.writer.tagvalue.package_writer import write_package def test_package_writer(): diff --git a/tests/writer/tagvalue/test_tagvalue_writer.py b/tests/writer/tagvalue/test_tagvalue_writer.py index d7a1a9968..1d4277f11 100644 --- a/tests/writer/tagvalue/test_tagvalue_writer.py +++ b/tests/writer/tagvalue/test_tagvalue_writer.py @@ -14,18 +14,18 @@ import pytest -from src.model.actor import Actor, ActorType -from src.model.annotation import Annotation, AnnotationType -from src.model.checksum import ChecksumAlgorithm, Checksum -from src.model.document import CreationInfo, Document -from src.model.external_document_ref import ExternalDocumentRef -from src.model.extracted_licensing_info import ExtractedLicensingInfo -from src.model.file import File -from src.model.package import Package -from src.model.relationship import RelationshipType, Relationship -from src.model.snippet import Snippet -from src.model.spdx_none import SpdxNone -from src.writer.tagvalue.tagvalue_writer import write_document_to_file +from spdx.model.actor import Actor, ActorType +from spdx.model.annotation import Annotation, AnnotationType +from spdx.model.checksum import ChecksumAlgorithm, Checksum +from spdx.model.document import CreationInfo, Document +from spdx.model.external_document_ref import ExternalDocumentRef +from spdx.model.extracted_licensing_info import ExtractedLicensingInfo +from spdx.model.file import File +from spdx.model.package import Package +from spdx.model.relationship import RelationshipType, Relationship +from spdx.model.snippet import Snippet +from spdx.model.spdx_none import SpdxNone +from spdx.writer.tagvalue.tagvalue_writer import write_document_to_file @pytest.fixture