Skip to content

Commit a6e6d18

Browse files
committed
try to bring back previous API
Signed-off-by: Jan Kowalleck <[email protected]>
1 parent b4a133a commit a6e6d18

File tree

2 files changed

+9
-4
lines changed

2 files changed

+9
-4
lines changed

cyclonedx/model/__init__.py

+3
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,9 @@
5151
SchemaVersion1Dot6,
5252
)
5353

54+
# historically, contact-related classes were exposed in this module - se lets keep the API as is
55+
from .contact import OrganizationalContact, OrganizationalEntity
56+
5457

5558
@serializable.serializable_enum
5659
class DataFlow(str, Enum):

cyclonedx/model/contact.py

+6-4
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
# Copyright (c) OWASP Foundation. All Rights Reserved.
1515

1616

17-
from typing import Any, Iterable, Optional, Union
17+
from typing import TYPE_CHECKING, Any, Iterable, Optional, Union
1818

1919
import serializable
2020
from sortedcontainers import SortedSet
@@ -23,9 +23,11 @@
2323
from ..exception.model import NoPropertiesProvidedException
2424
from ..schema.schema import SchemaVersion1Dot6
2525
from ..serialization import BomRefHelper
26-
from . import XsUri
2726
from .bom_ref import BomRef
2827

28+
if TYPE_CHECKING: # pragma: no cover
29+
from . import XsUri
30+
2931

3032
@serializable.serializable_class
3133
class PostalAddress:
@@ -276,7 +278,7 @@ class OrganizationalEntity:
276278
See the CycloneDX Schema definition: https://cyclonedx.org/docs/1.4/xml/#type_organizationalEntity
277279
"""
278280

279-
def __init__(self, *, name: Optional[str] = None, urls: Optional[Iterable[XsUri]] = None,
281+
def __init__(self, *, name: Optional[str] = None, urls: Optional[Iterable['XsUri']] = None,
280282
contacts: Optional[Iterable[OrganizationalContact]] = None,
281283
address: Optional[PostalAddress] = None) -> None:
282284
if not name and not urls and not contacts:
@@ -333,7 +335,7 @@ def urls(self) -> 'SortedSet[XsUri]':
333335
return self._urls
334336

335337
@urls.setter
336-
def urls(self, urls: Iterable[XsUri]) -> None:
338+
def urls(self, urls: Iterable['XsUri']) -> None:
337339
self._urls = SortedSet(urls)
338340

339341
@property

0 commit comments

Comments
 (0)