Repository URL to install this package:
|
Version:
0.1.2 ▾
|
odigos
/
etc
/
odigos-vmagent
/
instrumentations
/
python
/
deprecated
/
__pycache__
/
sphinx.cpython-311.pyc
|
|---|
§
8g( ã ón d Z ddlZddlZddlZddlmZ ddlmZ G d de¦ « Zdd Z dd
Z
ddZdS )
a-
Sphinx directive integration
============================
We usually need to document the life-cycle of functions and classes:
when they are created, modified or deprecated.
To do that, `Sphinx <http://www.sphinx-doc.org>`_ has a set
of `Paragraph-level markups <http://www.sphinx-doc.org/en/stable/markup/para.html>`_:
- ``versionadded``: to document the version of the project which added the described feature to the library,
- ``versionchanged``: to document changes of a feature,
- ``deprecated``: to document a deprecated feature.
The purpose of this module is to defined decorators which adds this Sphinx directives
to the docstring of your function and classes.
Of course, the ``@deprecated`` decorator will emit a deprecation warning
when the function/method is called or the class is constructed.
é N)ÚClassicAdapter)Ú
deprecatedc óB e Zd ZdZdddedf fd Z fdZ fdZ xZS )Ú
SphinxAdaptera
Sphinx adapter -- *for advanced usage only*
This adapter override the :class:`~deprecated.classic.ClassicAdapter`
in order to add the Sphinx directives to the end of the function/class docstring.
Such a directive is a `Paragraph-level markup <http://www.sphinx-doc.org/en/stable/markup/para.html>`_
- The directive can be one of "versionadded", "versionchanged" or "deprecated".
- The version number is added if provided.
- The reason message is obviously added in the directive block if not empty.
Ú NéF c ó |st d¦ « || _ || _ t t | ¦ « ||||¬¦ « dS )a
Construct a wrapper adapter.
:type directive: str
:param directive:
Sphinx directive: can be one of "versionadded", "versionchanged" or "deprecated".
:type reason: str
:param reason:
Reason message which documents the deprecation in your library (can be omitted).
:type version: str
:param version:
Version of your project which deprecates this feature.
If you follow the `Semantic Versioning <https://semver.org/>`_,
the version number has the format "MAJOR.MINOR.PATCH".
:type action: str
:param action:
A warning filter used to activate or not the deprecation warning.
Can be one of "error", "ignore", "always", "default", "module", or "once".
If ``None`` or empty, the the global filtering mechanism is used.
See: `The Warnings Filter`_ in the Python documentation.
:type category: type
:param category:
The warning category to use for the deprecation warning.
By default, the category class is :class:`~DeprecationWarning`,
you can inherit this class to define your own deprecation warning category.
:type line_length: int
:param line_length:
Max line length of the directive text. If non nul, a long text is wrapped in several lines.
z3'version' argument is required in Sphinx directives)ÚreasonÚversionÚactionÚcategoryN)Ú
ValueErrorÚ directiveÚline_lengthÚsuperr Ú__init__)Úselfr r
r r r
r Ú __class__s ú8/tmp/pip-target-r31m1qfr/lib/python/deprecated/sphinx.pyr zSphinxAdapter.__init__, s\ ø ðV ð TåÐRÑSÔSÐSØ"Ø&ÔÝ
mTÑ"Ô"×+Ò+°6À7ÐSYÐdlÐ+ÑmÔmÐmÐmÐmó c ó¨ | j rdnd}| | j | j ¬¦ « g}| j dk r
| j dz
nd}t j | j ¦ « ¦ « }| ¦ « D ]W}|r>| t j
||dd¬¦ « ¦ « ¦ « B| d¦ « X|j pd}| d ¬
¦ « pdg}t |¦ « dk r/t j d |dd
¦ « ¦ « nd}|d
|z }|r&t j dd|t j ¬¦ « dz }nd}|d d |D ¦ « ¦ « z
}||_ | j dv r|S t% t&