Skip to content

Commit

Permalink
Fix SortedSet type hints for python < 3.8
Browse files Browse the repository at this point in the history
Signed-off-by: Rodney Richardson <rodney.richardson@cambridgeconsultants.com>
  • Loading branch information
RodneyRichardson committed May 30, 2022
1 parent 43ef908 commit 2e283ab
Show file tree
Hide file tree
Showing 8 changed files with 50 additions and 50 deletions.
10 changes: 5 additions & 5 deletions cyclonedx/model/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -505,7 +505,7 @@ def type(self, type_: ExternalReferenceType) -> None:
self._type = type_

@property
def hashes(self) -> SortedSet[HashType]:
def hashes(self) -> "SortedSet[HashType]":
"""
The hashes of the external reference (if applicable).
Expand Down Expand Up @@ -1036,7 +1036,7 @@ def name(self, name: Optional[str]) -> None:
self._name = name

@property
def url(self) -> SortedSet[XsUri]:
def url(self) -> "SortedSet[XsUri]":
"""
Get a list of URLs of the organization. Multiple URLs are allowed.
Expand All @@ -1050,7 +1050,7 @@ def url(self, urls: Iterable[XsUri]) -> None:
self._url = SortedSet(urls)

@property
def contact(self) -> SortedSet[OrganizationalContact]:
def contact(self) -> "SortedSet[OrganizationalContact]":
"""
Get a list of contact person at the organization. Multiple contacts are allowed.
Expand Down Expand Up @@ -1137,7 +1137,7 @@ def version(self, version: Optional[str]) -> None:
self._version = version

@property
def hashes(self) -> SortedSet[HashType]:
def hashes(self) -> "SortedSet[HashType]":
"""
The hashes of the tool (if applicable).
Expand All @@ -1151,7 +1151,7 @@ def hashes(self, hashes: Iterable[HashType]) -> None:
self._hashes = SortedSet(hashes)

@property
def external_references(self) -> SortedSet[ExternalReference]:
def external_references(self) -> "SortedSet[ExternalReference]":
"""
External References provide a way to document systems, sites, and information that may be relevant but which
are not included with the BOM.
Expand Down
14 changes: 7 additions & 7 deletions cyclonedx/model/bom.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ def timestamp(self, timestamp: datetime) -> None:
self._timestamp = timestamp

@property
def tools(self) -> SortedSet[Tool]:
def tools(self) -> "SortedSet[Tool]":
"""
Tools used to create this BOM.
Expand All @@ -85,7 +85,7 @@ def tools(self, tools: Iterable[Tool]) -> None:
self._tools = SortedSet(tools)

@property
def authors(self) -> SortedSet[OrganizationalContact]:
def authors(self) -> "SortedSet[OrganizationalContact]":
"""
The person(s) who created the BOM.
Expand Down Expand Up @@ -157,7 +157,7 @@ def supplier(self, supplier: Optional[OrganizationalEntity]) -> None:
self._supplier = supplier

@property
def licenses(self) -> SortedSet[LicenseChoice]:
def licenses(self) -> "SortedSet[LicenseChoice]":
"""
A optional list of statements about how this BOM is licensed.
Expand All @@ -171,7 +171,7 @@ def licenses(self, licenses: Iterable[LicenseChoice]) -> None:
self._licenses = SortedSet(licenses)

@property
def properties(self) -> SortedSet[Property]:
def properties(self) -> "SortedSet[Property]":
"""
Provides the ability to document properties in a key/value store. This provides flexibility to include data not
officially supported in the standard without having to use additional namespaces or create extensions.
Expand Down Expand Up @@ -275,7 +275,7 @@ def metadata(self, metadata: BomMetaData) -> None:
self._metadata = metadata

@property
def components(self) -> SortedSet[Component]:
def components(self) -> "SortedSet[Component]":
"""
Get all the Components currently in this Bom.
Expand Down Expand Up @@ -329,7 +329,7 @@ def has_component(self, component: Component) -> bool:
return component in self.components

@property
def services(self) -> SortedSet[Service]:
def services(self) -> "SortedSet[Service]":
"""
Get all the Services currently in this Bom.
Expand All @@ -343,7 +343,7 @@ def services(self, services: Iterable[Service]) -> None:
self._services = SortedSet(services)

@property
def external_references(self) -> SortedSet[ExternalReference]:
def external_references(self) -> "SortedSet[ExternalReference]":
"""
Provides the ability to document external references related to the BOM or to the project the BOM describes.
Expand Down
30 changes: 15 additions & 15 deletions cyclonedx/model/component.py
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ def __init__(self, *, licenses: Optional[Iterable[LicenseChoice]] = None,
self.copyright = SortedSet(copyright_ or [])

@property
def licenses(self) -> SortedSet[LicenseChoice]:
def licenses(self) -> "SortedSet[LicenseChoice]":
"""
Optional list of licenses obtained during analysis.
Expand All @@ -193,7 +193,7 @@ def licenses(self, licenses: Iterable[LicenseChoice]) -> None:
self._licenses = SortedSet(licenses)

@property
def copyright(self) -> SortedSet[Copyright]:
def copyright(self) -> "SortedSet[Copyright]":
"""
Optional list of copyright statements.
Expand Down Expand Up @@ -369,7 +369,7 @@ def diff(self, diff: Optional[Diff]) -> None:
self._diff = diff

@property
def resolves(self) -> SortedSet[IssueType]:
def resolves(self) -> "SortedSet[IssueType]":
"""
Optional list of issues resolved by this patch.
Expand Down Expand Up @@ -431,7 +431,7 @@ def __init__(self, *, ancestors: Optional[Iterable['Component']] = None,
self.notes = notes

@property
def ancestors(self) -> SortedSet['Component']:
def ancestors(self) -> "SortedSet['Component']":
"""
Describes zero or more components in which a component is derived from. This is commonly used to describe forks
from existing projects where the forked version contains a ancestor node containing the original component it
Expand All @@ -451,7 +451,7 @@ def ancestors(self, ancestors: Iterable['Component']) -> None:
self._ancestors = SortedSet(ancestors)

@property
def descendants(self) -> SortedSet['Component']:
def descendants(self) -> "SortedSet['Component']":
"""
Descendants are the exact opposite of ancestors. This provides a way to document all forks (and their forks) of
an original or root component.
Expand All @@ -466,7 +466,7 @@ def descendants(self, descendants: Iterable['Component']) -> None:
self._descendants = SortedSet(descendants)

@property
def variants(self) -> SortedSet['Component']:
def variants(self) -> "SortedSet['Component']":
"""
Variants describe relations where the relationship between the components are not known. For example, if
Component A contains nearly identical code to Component B. They are both related, but it is unclear if one is
Expand All @@ -482,7 +482,7 @@ def variants(self, variants: Iterable['Component']) -> None:
self._variants = SortedSet(variants)

@property
def commits(self) -> SortedSet[Commit]:
def commits(self) -> "SortedSet[Commit]":
"""
A list of zero or more commits which provide a trail describing how the component deviates from an ancestor,
descendant, or variant.
Expand All @@ -497,7 +497,7 @@ def commits(self, commits: Iterable[Commit]) -> None:
self._commits = SortedSet(commits)

@property
def patches(self) -> SortedSet[Patch]:
def patches(self) -> "SortedSet[Patch]":
"""
A list of zero or more patches describing how the component deviates from an ancestor, descendant, or variant.
Patches may be complimentary to commits or may be used in place of commits.
Expand Down Expand Up @@ -937,7 +937,7 @@ def scope(self, scope: Optional[ComponentScope]) -> None:
self._scope = scope

@property
def hashes(self) -> SortedSet[HashType]:
def hashes(self) -> "SortedSet[HashType]":
"""
Optional list of hashes that help specify the integrity of this Component.
Expand All @@ -951,7 +951,7 @@ def hashes(self, hashes: Iterable[HashType]) -> None:
self._hashes = SortedSet(hashes)

@property
def licenses(self) -> SortedSet[LicenseChoice]:
def licenses(self) -> "SortedSet[LicenseChoice]":
"""
A optional list of statements about how this Component is licensed.
Expand Down Expand Up @@ -1041,7 +1041,7 @@ def pedigree(self, pedigree: Optional[Pedigree]) -> None:
self._pedigree = pedigree

@property
def external_references(self) -> SortedSet[ExternalReference]:
def external_references(self) -> "SortedSet[ExternalReference]":
"""
Provides the ability to document external references related to the component or to the project the component
describes.
Expand All @@ -1056,7 +1056,7 @@ def external_references(self, external_references: Iterable[ExternalReference])
self._external_references = SortedSet(external_references)

@property
def properties(self) -> SortedSet[Property]:
def properties(self) -> "SortedSet[Property]":
"""
Provides the ability to document properties in a key/value store. This provides flexibility to include data not
officially supported in the standard without having to use additional namespaces or create extensions.
Expand All @@ -1071,7 +1071,7 @@ def properties(self, properties: Iterable[Property]) -> None:
self._properties = SortedSet(properties)

@property
def components(self) -> SortedSet['Component']:
def components(self) -> "SortedSet['Component']":
"""
A list of software and hardware components included in the parent component. This is not a dependency tree. It
provides a way to specify a hierarchical representation of component assemblies, similar to system -> subsystem
Expand Down Expand Up @@ -1115,7 +1115,7 @@ def release_notes(self, release_notes: Optional[ReleaseNotes]) -> None:
self._release_notes = release_notes

@property
def dependencies(self) -> SortedSet[BomRef]:
def dependencies(self) -> "SortedSet[BomRef]":
"""
Set of `BomRef` that this Component depends on.
Expand All @@ -1141,7 +1141,7 @@ def add_vulnerability(self, vulnerability: Vulnerability) -> None:
"""
self.__vulnerabilites.add(vulnerability)

def get_vulnerabilities(self) -> SortedSet[Vulnerability]:
def get_vulnerabilities(self) -> "SortedSet[Vulnerability]":
"""
Get all the Vulnerabilities for this Component.
Expand Down
2 changes: 1 addition & 1 deletion cyclonedx/model/dependency.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ def ref(self) -> BomRef:
return self._ref

@property
def depends_on(self) -> SortedSet[BomRef]:
def depends_on(self) -> "SortedSet[BomRef]":
return self._depends_on

@depends_on.setter
Expand Down
2 changes: 1 addition & 1 deletion cyclonedx/model/issue.py
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ def source(self, source: Optional[IssueTypeSource]) -> None:
self._source = source

@property
def references(self) -> SortedSet[XsUri]:
def references(self) -> "SortedSet[XsUri]":
"""
Any reference URLs related to this issue.
Expand Down
10 changes: 5 additions & 5 deletions cyclonedx/model/release_note.py
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ def timestamp(self, timestamp: Optional[datetime]) -> None:
self._timestamp = timestamp

@property
def aliases(self) -> SortedSet[str]:
def aliases(self) -> "SortedSet[str]":
"""
One or more alternate names the release may be referred to. This may include unofficial terms used by
development and marketing teams (e.g. code names).
Expand All @@ -147,7 +147,7 @@ def aliases(self, aliases: Iterable[str]) -> None:
self._aliases = SortedSet(aliases)

@property
def tags(self) -> SortedSet[str]:
def tags(self) -> "SortedSet[str]":
"""
One or more tags that may aid in search or retrieval of the release note.
Expand All @@ -161,7 +161,7 @@ def tags(self, tags: Iterable[str]) -> None:
self._tags = SortedSet(tags)

@property
def resolves(self) -> SortedSet[IssueType]:
def resolves(self) -> "SortedSet[IssueType]":
"""
A collection of issues that have been resolved.
Expand All @@ -175,7 +175,7 @@ def resolves(self, resolves: Iterable[IssueType]) -> None:
self._resolves = SortedSet(resolves)

@property
def notes(self) -> SortedSet[Note]:
def notes(self) -> "SortedSet[Note]":
"""
Zero or more release notes containing the locale and content. Multiple note elements may be specified to support
release notes in a wide variety of languages.
Expand All @@ -190,7 +190,7 @@ def notes(self, notes: Iterable[Note]) -> None:
self._notes = SortedSet(notes)

@property
def properties(self) -> SortedSet[Property]:
def properties(self) -> "SortedSet[Property]":
"""
Provides the ability to document properties in a name-value store. This provides flexibility to include data not
officially supported in the standard without having to use additional namespaces or create extensions. Unlike
Expand Down
12 changes: 6 additions & 6 deletions cyclonedx/model/service.py
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ def description(self, description: Optional[str]) -> None:
self._description = description

@property
def endpoints(self) -> SortedSet[XsUri]:
def endpoints(self) -> "SortedSet[XsUri]":
"""
A list of endpoints URI's this service provides.
Expand Down Expand Up @@ -206,7 +206,7 @@ def x_trust_boundary(self, x_trust_boundary: Optional[bool]) -> None:
self._x_trust_boundary = x_trust_boundary

@property
def data(self) -> SortedSet[DataClassification]:
def data(self) -> "SortedSet[DataClassification]":
"""
Specifies the data classification.
Expand All @@ -220,7 +220,7 @@ def data(self, data: Iterable[DataClassification]) -> None:
self._data = SortedSet(data)

@property
def licenses(self) -> SortedSet[LicenseChoice]:
def licenses(self) -> "SortedSet[LicenseChoice]":
"""
A optional list of statements about how this Service is licensed.
Expand All @@ -234,7 +234,7 @@ def licenses(self, licenses: Iterable[LicenseChoice]) -> None:
self._licenses = SortedSet(licenses)

@property
def external_references(self) -> SortedSet[ExternalReference]:
def external_references(self) -> "SortedSet[ExternalReference]":
"""
Provides the ability to document external references related to the Service.
Expand All @@ -248,7 +248,7 @@ def external_references(self, external_references: Iterable[ExternalReference])
self._external_references = SortedSet(external_references)

@property
def services(self) -> SortedSet['Service']:
def services(self) -> "SortedSet['Service']":
"""
A list of services included or deployed behind the parent service.
Expand Down Expand Up @@ -280,7 +280,7 @@ def release_notes(self, release_notes: Optional[ReleaseNotes]) -> None:
self._release_notes = release_notes

@property
def properties(self) -> SortedSet[Property]:
def properties(self) -> "SortedSet[Property]":
"""
Provides the ability to document properties in a key/value store. This provides flexibility to include data not
officially supported in the standard without having to use additional namespaces or create extensions.
Expand Down
Loading

0 comments on commit 2e283ab

Please sign in to comment.