Skip to content

Commit 0ee583e

Browse files
committed
tidy
Signed-off-by: Jan Kowalleck <[email protected]>
1 parent 5de7307 commit 0ee583e

File tree

1 file changed

+12
-13
lines changed

1 file changed

+12
-13
lines changed

cyclonedx/model/component_evidence.py

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
from decimal import Decimal
2121
from enum import Enum
2222
from json import loads as json_loads
23-
from typing import Any, Optional, Union, Type
23+
from typing import Any, Optional, Type, Union
2424
from warnings import warn
2525
from xml.etree.ElementTree import Element as XmlElement # nosec B405
2626

@@ -624,7 +624,6 @@ def __repr__(self) -> str:
624624
return f'<CallStack frames={len(self.frames)}>'
625625

626626

627-
628627
@serializable.serializable_class
629628
class ComponentEvidence:
630629
"""
@@ -751,36 +750,37 @@ def __hash__(self) -> int:
751750
def __repr__(self) -> str:
752751
return f'<ComponentEvidence id={id(self)}>'
753752

753+
754754
class _ComponentEvidenceSerializationHelper(serializable.helpers.BaseHelper):
755755
"""THIS CLASS IS NON-PUBLIC API"""
756756

757757
@classmethod
758758
def json_normalize(cls, o: ComponentEvidence, *,
759759
view: Optional[type[serializable.ViewType]],
760-
**__: Any) -> Union[dict,list[dict],None]:
761-
data:dict[str, Any] = json_loads( o.as_json(view))
760+
**__: Any) -> dict[str, Any]:
761+
data: dict[str, Any] = json_loads(o.as_json(view)) # type:ignore[attr-defined]
762762
if view is SchemaVersion1Dot5:
763763
identities = data.get('identity', [])
764-
if il:=len(identities) > 1:
765-
warn(f'CycloneDX 1.5 does not support multiple identity items; dropping {il-1} items.')
764+
if il := len(identities) > 1:
765+
warn(f'CycloneDX 1.5 does not support multiple identity items; dropping {il - 1} items.')
766766
data['identity'] = identities[0]
767767
return data
768768

769769
@classmethod
770-
def json_denormalize(cls, o: dict[str, Any], **__: Any) -> Optional[list[Identity]]:
771-
return ComponentEvidence.from_json(o)
770+
def json_denormalize(cls, o: dict[str, Any], **__: Any) -> Any:
771+
return ComponentEvidence.from_json(o) # type:ignore[attr-defined]
772772

773773
@classmethod
774774
def xml_normalize(cls, o: ComponentEvidence, *,
775775
element_name: str,
776776
view: Optional[Type['serializable.ViewType']],
777777
xmlns: Optional[str],
778778
**__: Any) -> Optional['XmlElement']:
779-
normalized: 'XmlElement' = o.as_xml(view, False, element_name, xmlns)
779+
normalized: 'XmlElement' = o.as_xml(view, False, element_name, xmlns) # type:ignore[attr-defined]
780780
if view is SchemaVersion1Dot5:
781781
identities = normalized.findall(f'./{{{xmlns}}}identity' if xmlns else './identity')
782-
if il:=len(identities) > 1:
783-
warn(f'CycloneDX 1.5 does not support multiple identity items; dropping {il-1} items.')
782+
if il := len(identities) > 1:
783+
warn(f'CycloneDX 1.5 does not support multiple identity items; dropping {il - 1} items.')
784784
for i in identities[1:]:
785785
normalized.remove(i)
786786
return normalized
@@ -789,5 +789,4 @@ def xml_normalize(cls, o: ComponentEvidence, *,
789789
def xml_denormalize(cls, o: 'XmlElement', *,
790790
default_ns: Optional[str],
791791
**__: Any) -> Any:
792-
return ComponentEvidence.from_xml(o, default_ns)
793-
792+
return ComponentEvidence.from_xml(o, default_ns) # type:ignore[attr-defined]

0 commit comments

Comments
 (0)