-
Notifications
You must be signed in to change notification settings - Fork 1
Models
The spdx.document.Document class represents the Document model, it is the top level of any spdx file.
| Field | Type | Notes |
|---|---|---|
| version | spdx.version.Version |
The SPDX version, currently only version 1.2 is supported |
| data_license | spdx.document.License |
Must be CC-1.0 can be created by License.from_identifier('CC-1.0')
|
| comment | str |
Document comment, may be None
|
| creation_info | spdx.creationinfo.CreationInfo |
The document's creation information |
| package | spdx.package.Package |
The package described by the document |
| extracted_licenses | list of spdx.document.License
|
Extracted Licenses, could be empty |
| reviews | list of spdx.review.Review
|
Document Reviews could be empty |
The Document.validate method checks all the fields of a document and returns true if they are all valid according to the standard. It takes an optional parameter messages to append all error messages to it for displaying to the user.
TODO:
- Implement
validate_extraced_licensesmethod.
The class spdx.creationinfo.Creator represents a creator entity. It has a single field name and can be compared for equality with other Creators (does not check type).
The class spdx.creationinfo.Organization represents an organization entity it extends spdx.creationinfo.Creator and adds an email field. It also overrides the __eq__ method.
The class spdx.creationinfo.Person represents a Person entity, it extends spdx.creationinfo.Creator to provide an email field. The Only difference between it and Organization is type in case a user needs that distinction.
##Tool
The class spdx.creationinfo.Tool represents a Tool entity, it extends spdx.creationinfo.Creator It only has a name field. The only difference between it and Creator is type distinction.
##CreationInfo
The class spdx.creationinfo.CreationInfo represents a document's creation info.
| Field | Type | Notes |
|---|---|---|
| creators | list of spdx.creationinfo.Creator or any subclass |
|
| created | datetime.datetime |
Date of creation |
| comment | str |
creation comment, could be None
|
| license_list_version | spdx.version.Version |
By default set to the value of config.LICENSE_LIST_VERSION
|
add_creator : Appends a creator.
remove_creator : removes a creator.
set_created_now : sets creation date to datetime.utcnow()
validate : Validates the fields. Appends error messages to messages parameter.
created_iso_format : Creation date as iso 8601 string.
The class spdx.version.Version represents a version. It has two fields major and minor both integers.
The class method from_str parses a string of the form N.N where N is a number and returns a version.
It returns None if the string is invalid.
It also provides a __cmp__ method.
The class spdx.review.Review represents a document's review.
A review has one reviewer and review date. It may also have a comment.
| Field | Type | Notes |
|---|---|---|
| reviewer | Any subclass of spdx.creationinfo.Creator
|
|
| review_date | datetime.datetime |
The time the review was done at |
| comment | str |
Review comment, could be None
|
set_review_date_now : sets the review date to datetime.utcnow()
validate : validates the fields of the review, messages parameter is a list of user friendly error messages.
review_date_iso_format : Returns review_date in iso 8601 format.