Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions cyclonedx/model/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -457,7 +457,7 @@ def __init__(self, *, reference_type: ExternalReferenceType, url: XsUri, comment
self.url = url
self.comment = comment
self.type = reference_type
self.hashes = SortedSet(hashes or [])
self.hashes = hashes or [] # type: ignore

@property
def url(self) -> XsUri:
Expand Down Expand Up @@ -1018,8 +1018,8 @@ def __init__(self, *, name: Optional[str] = None, urls: Optional[Iterable[XsUri]
'One of name, urls or contacts must be supplied for an OrganizationalEntity - none supplied.'
)
self.name = name
self.url = SortedSet(urls or [])
self.contact = SortedSet(contacts or [])
self.url = urls or [] # type: ignore
self.contact = contacts or [] # type: ignore

@property
def name(self) -> Optional[str]:
Expand Down Expand Up @@ -1091,8 +1091,8 @@ def __init__(self, *, vendor: Optional[str] = None, name: Optional[str] = None,
self.vendor = vendor
self.name = name
self.version = version
self.hashes = SortedSet(hashes or [])
self.external_references = SortedSet(external_references or [])
self.hashes = hashes or [] # type: ignore
self.external_references = external_references or [] # type: ignore

@property
def vendor(self) -> Optional[str]:
Expand Down
14 changes: 7 additions & 7 deletions cyclonedx/model/bom.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,13 +45,13 @@ def __init__(self, *, tools: Optional[Iterable[Tool]] = None,
licenses: Optional[Iterable[LicenseChoice]] = None,
properties: Optional[Iterable[Property]] = None) -> None:
self.timestamp = datetime.now(tz=timezone.utc)
self.tools = SortedSet(tools or [])
self.authors = SortedSet(authors or [])
self.tools = tools or [] # type: ignore
self.authors = authors or [] # type: ignore
self.component = component
self.manufacture = manufacture
self.supplier = supplier
self.licenses = SortedSet(licenses or [])
self.properties = SortedSet(properties or [])
self.licenses = licenses or [] # type: ignore
self.properties = properties or [] # type: ignore

if not tools:
self.tools.add(ThisTool)
Expand Down Expand Up @@ -239,9 +239,9 @@ def __init__(self, *, components: Optional[Iterable[Component]] = None,
"""
self.uuid = uuid4()
self.metadata = BomMetaData()
self.components = SortedSet(components or [])
self.services = SortedSet(services or [])
self.external_references = SortedSet(external_references or [])
self.components = components or [] # type: ignore
self.services = services or [] # type: ignore
self.external_references = external_references or [] # type: ignore

@property
def uuid(self) -> UUID:
Expand Down
28 changes: 14 additions & 14 deletions cyclonedx/model/component.py
Original file line number Diff line number Diff line change
Expand Up @@ -175,8 +175,8 @@ def __init__(self, *, licenses: Optional[Iterable[LicenseChoice]] = None,
'At least one of `licenses` or `copyright_` must be supplied for a `ComponentEvidence`.'
)

self.licenses = SortedSet(licenses or [])
self.copyright = SortedSet(copyright_ or [])
self.licenses = licenses or [] # type: ignore
self.copyright = copyright_ or [] # type: ignore

@property
def licenses(self) -> "SortedSet[LicenseChoice]":
Expand Down Expand Up @@ -334,7 +334,7 @@ def __init__(self, *, type_: PatchClassification, diff: Optional[Diff] = None,
resolves: Optional[Iterable[IssueType]] = None) -> None:
self.type = type_
self.diff = diff
self.resolves = SortedSet(resolves or [])
self.resolves = resolves or [] # type: ignore

@property
def type(self) -> PatchClassification:
Expand Down Expand Up @@ -423,11 +423,11 @@ def __init__(self, *, ancestors: Optional[Iterable['Component']] = None,
'provided for `Pedigree`'
)

self.ancestors = SortedSet(ancestors or [])
self.descendants = SortedSet(descendants or [])
self.variants = SortedSet(variants or [])
self.commits = SortedSet(commits or [])
self.patches = SortedSet(patches or [])
self.ancestors = ancestors or [] # type: ignore
self.descendants = descendants or [] # type: ignore
self.variants = variants or [] # type: ignore
self.commits = commits or [] # type: ignore
self.patches = patches or [] # type: ignore
self.notes = notes

@property
Expand Down Expand Up @@ -732,16 +732,16 @@ def __init__(self, *, name: str, component_type: ComponentType = ComponentType.L
self.version = version
self.description = description
self.scope = scope
self.hashes = SortedSet(hashes or [])
self.licenses = SortedSet(licenses or [])
self.hashes = hashes or [] # type: ignore
self.licenses = licenses or [] # type: ignore
self.copyright = copyright_
self.cpe = cpe
self.purl = purl
self.swid = swid
self.pedigree = pedigree
self.external_references = SortedSet(external_references or [])
self.properties = SortedSet(properties or [])
self.components = SortedSet(components or [])
self.external_references = external_references or [] # type: ignore
self.properties = properties or [] # type: ignore
self.components = components or [] # type: ignore
self.evidence = evidence
self.release_notes = release_notes

Expand All @@ -760,7 +760,7 @@ def __init__(self, *, name: str, component_type: ComponentType = ComponentType.L
'standard', DeprecationWarning
)
if not licenses:
self.licenses = SortedSet([LicenseChoice(license_expression=license_str)])
self.licenses = [LicenseChoice(license_expression=license_str)] # type: ignore

self.__dependencies: "SortedSet[BomRef]" = SortedSet()
self.__vulnerabilites: "SortedSet[Vulnerability]" = SortedSet()
Expand Down
2 changes: 1 addition & 1 deletion cyclonedx/model/dependency.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ class Dependency:

def __init__(self, *, ref: BomRef, depends_on: Optional[Iterable[BomRef]] = None) -> None:
self._ref = ref
self.depends_on = SortedSet(depends_on or [])
self.depends_on = depends_on or [] # type: ignore

@property
def ref(self) -> BomRef:
Expand Down
2 changes: 1 addition & 1 deletion cyclonedx/model/issue.py
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ def __init__(self, *, classification: IssueClassification, id_: Optional[str] =
self.name = name
self.description = description
self.source = source
self.references = SortedSet(references or [])
self.references = references or [] # type: ignore

@property
def type(self) -> IssueClassification:
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 @@ -45,11 +45,11 @@ def __init__(self, *, type_: str, title: Optional[str] = None, featured_image: O
self.social_image = social_image
self.description = description
self.timestamp = timestamp
self.aliases = SortedSet(aliases or [])
self.tags = SortedSet(tags or [])
self.resolves = SortedSet(resolves or [])
self.notes = SortedSet(notes or [])
self.properties = SortedSet(properties or [])
self.aliases = aliases or [] # type: ignore
self.tags = tags or [] # type: ignore
self.resolves = resolves or [] # type: ignore
self.notes = notes or [] # type: ignore
self.properties = properties or [] # type: ignore

@property
def type(self) -> str:
Expand Down
12 changes: 6 additions & 6 deletions cyclonedx/model/service.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,15 +63,15 @@ def __init__(self, *, name: str, bom_ref: Optional[str] = None, provider: Option
self.name = name
self.version = version
self.description = description
self.endpoints = SortedSet(endpoints or [])
self.endpoints = endpoints or [] # type: ignore
self.authenticated = authenticated
self.x_trust_boundary = x_trust_boundary
self.data = SortedSet(data or [])
self.licenses = SortedSet(licenses or [])
self.external_references = SortedSet(external_references or [])
self.services = SortedSet(services or [])
self.data = data or [] # type: ignore
self.licenses = licenses or [] # type: ignore
self.external_references = external_references or [] # type: ignore
self.services = services or [] # type: ignore
self.release_notes = release_notes
self.properties = SortedSet(properties or [])
self.properties = properties or [] # type: ignore

@property
def bom_ref(self) -> BomRef:
Expand Down
20 changes: 10 additions & 10 deletions cyclonedx/model/vulnerability.py
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ class BomTarget:

def __init__(self, *, ref: str, versions: Optional[Iterable[BomTargetVersionRange]] = None) -> None:
self.ref = ref
self.versions = SortedSet(versions or [])
self.versions = versions or [] # type: ignore

@property
def ref(self) -> str:
Expand Down Expand Up @@ -207,7 +207,7 @@ def __init__(self, *, state: Optional[ImpactAnalysisState] = None,
)
self.state = state
self.justification = justification
self.response = SortedSet(responses or [])
self.response = responses or [] # type: ignore
self.detail = detail

@property
Expand Down Expand Up @@ -719,8 +719,8 @@ def __init__(self, *, organizations: Optional[Iterable[OrganizationalEntity]] =
raise NoPropertiesProvidedException(
'One of `organizations` or `individuals` must be populated - neither were'
)
self.organizations = SortedSet(organizations or [])
self.individuals = SortedSet(individuals or [])
self.organizations = organizations or [] # type: ignore
self.individuals = individuals or [] # type: ignore

@property
def organizations(self) -> "SortedSet[OrganizationalEntity]":
Expand Down Expand Up @@ -789,20 +789,20 @@ def __init__(self, *, bom_ref: Optional[str] = None, id: Optional[str] = None,
self._bom_ref = BomRef(value=bom_ref)
self.id = id
self.source = source
self.references = SortedSet(references or [])
self.ratings = SortedSet(ratings or [])
self.cwes = SortedSet(cwes or [])
self.references = references or [] # type: ignore
self.ratings = ratings or [] # type: ignore
self.cwes = cwes or [] # type: ignore
self.description = description
self.detail = detail
self.recommendation = recommendation
self.advisories = SortedSet(advisories or [])
self.advisories = advisories or [] # type: ignore
self.created = created
self.published = published
self.updated = updated
self.credits = credits
self.tools = SortedSet(tools or [])
self.tools = tools or [] # type: ignore
self.analysis = analysis
self.affects = SortedSet(affects_targets or [])
self.affects = affects_targets or [] # type: ignore

if source_name or source_url:
warnings.warn('`source_name` and `source_url` are deprecated - use `source`', DeprecationWarning)
Expand Down