Skip to content

Commit 885d47e

Browse files
committed
feat: prepare "contrib" area
Signed-off-by: Jan Kowalleck <[email protected]>
1 parent 3947eb7 commit 885d47e

File tree

3 files changed

+50
-28
lines changed

3 files changed

+50
-28
lines changed

cyclonedx/__test.py

Lines changed: 0 additions & 5 deletions
This file was deleted.

cyclonedx/builder/this.py

Lines changed: 34 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -17,28 +17,46 @@
1717

1818
"""Representation of this very python library."""
1919

20-
__all__ = ['this_component', 'this_tool', ]
20+
__all__ = ['this_component', 'this_tool']
21+
22+
import sys
23+
from typing import TYPE_CHECKING
24+
25+
if sys.version_info >= (3, 13):
26+
from warnings import deprecated
27+
else:
28+
from typing_extensions import deprecated
2129

2230
from ..contrib.this import this_component as _this_component, this_tool as _this_tool
2331

24-
# endregion deprecated re-export
32+
# region deprecated re-export
33+
34+
if TYPE_CHECKING:
35+
from ..model.component import Component
36+
from ..model.tool import Tool
37+
38+
39+
@deprecated('Deprecated re-export location - see docstring of "this_component" for details.')
40+
def this_component() -> 'Component':
41+
"""Deprecated — alias of :func:`~cyclonedx.contrib.this.this_component`.
2542
26-
this_component = _this_component
27-
"""Deprecated — Alias of :func:`cyclonedx.contrib.this.this_component`.
43+
.. deprecated:: next
44+
This re-export location is deprecated.
45+
Use ``from cyclonedx.contrib.this import this_component`` instead.
46+
The exported symbol itself is NOT deprecated — only this import path.
47+
"""
48+
return _this_component()
2849

29-
.. deprecated:: next
30-
This re-export location is deprecated.
31-
Use ``from cyclonedx.contrib.this import this_component`` instead.
32-
The exported symbol itself is NOT deprecated - only this import path.
33-
"""
3450

35-
this_tool = _this_tool
36-
"""Deprecated — Alias of :func:`cyclonedx.contrib.this.this_tool`.
51+
@deprecated('Deprecated re-export location - see docstring of "this_tool" for details.')
52+
def this_tool() -> 'Tool':
53+
"""Deprecated — alias of :func:`~cyclonedx.contrib.this.this_tool`.
3754
38-
.. deprecated:: next
39-
This re-export location is deprecated.
40-
Use ``from cyclonedx.contrib.this import this_tool`` instead.
41-
The exported symbol itself is NOT deprecated - only this import path.
42-
"""
55+
.. deprecated:: next
56+
This re-export location is deprecated.
57+
Use ``from cyclonedx.contrib.this import this_tool`` instead.
58+
The exported symbol itself is NOT deprecated — only this import path.
59+
"""
60+
return _this_tool()
4361

4462
# endregion deprecated re-export

cyclonedx/factory/license.py

Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -17,17 +17,26 @@
1717

1818
__all__ = ['LicenseFactory']
1919

20+
import sys
21+
22+
if sys.version_info >= (3, 13):
23+
from warnings import deprecated
24+
else:
25+
from typing_extensions import deprecated
26+
2027
from ..contrib.license import LicenseFactory as _LicenseFactory
2128

2229
# region deprecated re-export
2330

24-
LicenseFactory = _LicenseFactory
25-
"""Deprecated — Alias of :class:`cyclonedx.contrib.license.LicenseFactory`.
2631

27-
.. deprecated:: next
28-
This re-export location is deprecated.
29-
Use ``from cyclonedx.contrib.license import LicenseFactory`` instead.
30-
The exported symbol itself is NOT deprecated - only this import path.
31-
"""
32+
@deprecated('Deprecated re-export location - see docstring of "LicenseFactory" for details.')
33+
class LicenseFactory(_LicenseFactory):
34+
"""Deprecated — Alias of :class:`cyclonedx.contrib.license.LicenseFactory`.
35+
36+
.. deprecated:: next
37+
This re-export location is deprecated.
38+
Use ``from cyclonedx.contrib.license import LicenseFactory`` instead.
39+
The exported symbol itself is NOT deprecated - only this import path.
40+
"""
3241

3342
# endregion deprecated re-export

0 commit comments

Comments
 (0)