|
17 | 17 |
|
18 | 18 | """Representation of this very python library.""" |
19 | 19 |
|
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 |
21 | 29 |
|
22 | 30 | from ..contrib.this import this_component as _this_component, this_tool as _this_tool |
23 | 31 |
|
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`. |
25 | 42 |
|
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() |
28 | 49 |
|
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 | | -""" |
34 | 50 |
|
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`. |
37 | 54 |
|
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() |
43 | 61 |
|
44 | 62 | # endregion deprecated re-export |
0 commit comments