Skip to content

Commit 2e283ab

Browse files
Fix SortedSet type hints for python < 3.8
Signed-off-by: Rodney Richardson <[email protected]>
1 parent 43ef908 commit 2e283ab

File tree

8 files changed

+50
-50
lines changed

8 files changed

+50
-50
lines changed

cyclonedx/model/__init__.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -505,7 +505,7 @@ def type(self, type_: ExternalReferenceType) -> None:
505505
self._type = type_
506506

507507
@property
508-
def hashes(self) -> SortedSet[HashType]:
508+
def hashes(self) -> "SortedSet[HashType]":
509509
"""
510510
The hashes of the external reference (if applicable).
511511
@@ -1036,7 +1036,7 @@ def name(self, name: Optional[str]) -> None:
10361036
self._name = name
10371037

10381038
@property
1039-
def url(self) -> SortedSet[XsUri]:
1039+
def url(self) -> "SortedSet[XsUri]":
10401040
"""
10411041
Get a list of URLs of the organization. Multiple URLs are allowed.
10421042
@@ -1050,7 +1050,7 @@ def url(self, urls: Iterable[XsUri]) -> None:
10501050
self._url = SortedSet(urls)
10511051

10521052
@property
1053-
def contact(self) -> SortedSet[OrganizationalContact]:
1053+
def contact(self) -> "SortedSet[OrganizationalContact]":
10541054
"""
10551055
Get a list of contact person at the organization. Multiple contacts are allowed.
10561056
@@ -1137,7 +1137,7 @@ def version(self, version: Optional[str]) -> None:
11371137
self._version = version
11381138

11391139
@property
1140-
def hashes(self) -> SortedSet[HashType]:
1140+
def hashes(self) -> "SortedSet[HashType]":
11411141
"""
11421142
The hashes of the tool (if applicable).
11431143
@@ -1151,7 +1151,7 @@ def hashes(self, hashes: Iterable[HashType]) -> None:
11511151
self._hashes = SortedSet(hashes)
11521152

11531153
@property
1154-
def external_references(self) -> SortedSet[ExternalReference]:
1154+
def external_references(self) -> "SortedSet[ExternalReference]":
11551155
"""
11561156
External References provide a way to document systems, sites, and information that may be relevant but which
11571157
are not included with the BOM.

cyclonedx/model/bom.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ def timestamp(self, timestamp: datetime) -> None:
7171
self._timestamp = timestamp
7272

7373
@property
74-
def tools(self) -> SortedSet[Tool]:
74+
def tools(self) -> "SortedSet[Tool]":
7575
"""
7676
Tools used to create this BOM.
7777
@@ -85,7 +85,7 @@ def tools(self, tools: Iterable[Tool]) -> None:
8585
self._tools = SortedSet(tools)
8686

8787
@property
88-
def authors(self) -> SortedSet[OrganizationalContact]:
88+
def authors(self) -> "SortedSet[OrganizationalContact]":
8989
"""
9090
The person(s) who created the BOM.
9191
@@ -157,7 +157,7 @@ def supplier(self, supplier: Optional[OrganizationalEntity]) -> None:
157157
self._supplier = supplier
158158

159159
@property
160-
def licenses(self) -> SortedSet[LicenseChoice]:
160+
def licenses(self) -> "SortedSet[LicenseChoice]":
161161
"""
162162
A optional list of statements about how this BOM is licensed.
163163
@@ -171,7 +171,7 @@ def licenses(self, licenses: Iterable[LicenseChoice]) -> None:
171171
self._licenses = SortedSet(licenses)
172172

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

277277
@property
278-
def components(self) -> SortedSet[Component]:
278+
def components(self) -> "SortedSet[Component]":
279279
"""
280280
Get all the Components currently in this Bom.
281281
@@ -329,7 +329,7 @@ def has_component(self, component: Component) -> bool:
329329
return component in self.components
330330

331331
@property
332-
def services(self) -> SortedSet[Service]:
332+
def services(self) -> "SortedSet[Service]":
333333
"""
334334
Get all the Services currently in this Bom.
335335
@@ -343,7 +343,7 @@ def services(self, services: Iterable[Service]) -> None:
343343
self._services = SortedSet(services)
344344

345345
@property
346-
def external_references(self) -> SortedSet[ExternalReference]:
346+
def external_references(self) -> "SortedSet[ExternalReference]":
347347
"""
348348
Provides the ability to document external references related to the BOM or to the project the BOM describes.
349349

cyclonedx/model/component.py

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,7 @@ def __init__(self, *, licenses: Optional[Iterable[LicenseChoice]] = None,
179179
self.copyright = SortedSet(copyright_ or [])
180180

181181
@property
182-
def licenses(self) -> SortedSet[LicenseChoice]:
182+
def licenses(self) -> "SortedSet[LicenseChoice]":
183183
"""
184184
Optional list of licenses obtained during analysis.
185185
@@ -193,7 +193,7 @@ def licenses(self, licenses: Iterable[LicenseChoice]) -> None:
193193
self._licenses = SortedSet(licenses)
194194

195195
@property
196-
def copyright(self) -> SortedSet[Copyright]:
196+
def copyright(self) -> "SortedSet[Copyright]":
197197
"""
198198
Optional list of copyright statements.
199199
@@ -369,7 +369,7 @@ def diff(self, diff: Optional[Diff]) -> None:
369369
self._diff = diff
370370

371371
@property
372-
def resolves(self) -> SortedSet[IssueType]:
372+
def resolves(self) -> "SortedSet[IssueType]":
373373
"""
374374
Optional list of issues resolved by this patch.
375375
@@ -431,7 +431,7 @@ def __init__(self, *, ancestors: Optional[Iterable['Component']] = None,
431431
self.notes = notes
432432

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

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

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

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

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

939939
@property
940-
def hashes(self) -> SortedSet[HashType]:
940+
def hashes(self) -> "SortedSet[HashType]":
941941
"""
942942
Optional list of hashes that help specify the integrity of this Component.
943943
@@ -951,7 +951,7 @@ def hashes(self, hashes: Iterable[HashType]) -> None:
951951
self._hashes = SortedSet(hashes)
952952

953953
@property
954-
def licenses(self) -> SortedSet[LicenseChoice]:
954+
def licenses(self) -> "SortedSet[LicenseChoice]":
955955
"""
956956
A optional list of statements about how this Component is licensed.
957957
@@ -1041,7 +1041,7 @@ def pedigree(self, pedigree: Optional[Pedigree]) -> None:
10411041
self._pedigree = pedigree
10421042

10431043
@property
1044-
def external_references(self) -> SortedSet[ExternalReference]:
1044+
def external_references(self) -> "SortedSet[ExternalReference]":
10451045
"""
10461046
Provides the ability to document external references related to the component or to the project the component
10471047
describes.
@@ -1056,7 +1056,7 @@ def external_references(self, external_references: Iterable[ExternalReference])
10561056
self._external_references = SortedSet(external_references)
10571057

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

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

11171117
@property
1118-
def dependencies(self) -> SortedSet[BomRef]:
1118+
def dependencies(self) -> "SortedSet[BomRef]":
11191119
"""
11201120
Set of `BomRef` that this Component depends on.
11211121
@@ -1141,7 +1141,7 @@ def add_vulnerability(self, vulnerability: Vulnerability) -> None:
11411141
"""
11421142
self.__vulnerabilites.add(vulnerability)
11431143

1144-
def get_vulnerabilities(self) -> SortedSet[Vulnerability]:
1144+
def get_vulnerabilities(self) -> "SortedSet[Vulnerability]":
11451145
"""
11461146
Get all the Vulnerabilities for this Component.
11471147

cyclonedx/model/dependency.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ def ref(self) -> BomRef:
4141
return self._ref
4242

4343
@property
44-
def depends_on(self) -> SortedSet[BomRef]:
44+
def depends_on(self) -> "SortedSet[BomRef]":
4545
return self._depends_on
4646

4747
@depends_on.setter

cyclonedx/model/issue.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,7 @@ def source(self, source: Optional[IssueTypeSource]) -> None:
188188
self._source = source
189189

190190
@property
191-
def references(self) -> SortedSet[XsUri]:
191+
def references(self) -> "SortedSet[XsUri]":
192192
"""
193193
Any reference URLs related to this issue.
194194

cyclonedx/model/release_note.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ def timestamp(self, timestamp: Optional[datetime]) -> None:
132132
self._timestamp = timestamp
133133

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

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

163163
@property
164-
def resolves(self) -> SortedSet[IssueType]:
164+
def resolves(self) -> "SortedSet[IssueType]":
165165
"""
166166
A collection of issues that have been resolved.
167167
@@ -175,7 +175,7 @@ def resolves(self, resolves: Iterable[IssueType]) -> None:
175175
self._resolves = SortedSet(resolves)
176176

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

192192
@property
193-
def properties(self) -> SortedSet[Property]:
193+
def properties(self) -> "SortedSet[Property]":
194194
"""
195195
Provides the ability to document properties in a name-value store. This provides flexibility to include data not
196196
officially supported in the standard without having to use additional namespaces or create extensions. Unlike

cyclonedx/model/service.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,7 @@ def description(self, description: Optional[str]) -> None:
158158
self._description = description
159159

160160
@property
161-
def endpoints(self) -> SortedSet[XsUri]:
161+
def endpoints(self) -> "SortedSet[XsUri]":
162162
"""
163163
A list of endpoints URI's this service provides.
164164
@@ -206,7 +206,7 @@ def x_trust_boundary(self, x_trust_boundary: Optional[bool]) -> None:
206206
self._x_trust_boundary = x_trust_boundary
207207

208208
@property
209-
def data(self) -> SortedSet[DataClassification]:
209+
def data(self) -> "SortedSet[DataClassification]":
210210
"""
211211
Specifies the data classification.
212212
@@ -220,7 +220,7 @@ def data(self, data: Iterable[DataClassification]) -> None:
220220
self._data = SortedSet(data)
221221

222222
@property
223-
def licenses(self) -> SortedSet[LicenseChoice]:
223+
def licenses(self) -> "SortedSet[LicenseChoice]":
224224
"""
225225
A optional list of statements about how this Service is licensed.
226226
@@ -234,7 +234,7 @@ def licenses(self, licenses: Iterable[LicenseChoice]) -> None:
234234
self._licenses = SortedSet(licenses)
235235

236236
@property
237-
def external_references(self) -> SortedSet[ExternalReference]:
237+
def external_references(self) -> "SortedSet[ExternalReference]":
238238
"""
239239
Provides the ability to document external references related to the Service.
240240
@@ -248,7 +248,7 @@ def external_references(self, external_references: Iterable[ExternalReference])
248248
self._external_references = SortedSet(external_references)
249249

250250
@property
251-
def services(self) -> SortedSet['Service']:
251+
def services(self) -> "SortedSet['Service']":
252252
"""
253253
A list of services included or deployed behind the parent service.
254254
@@ -280,7 +280,7 @@ def release_notes(self, release_notes: Optional[ReleaseNotes]) -> None:
280280
self._release_notes = release_notes
281281

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

0 commit comments

Comments
 (0)