%PDF- <> %âãÏÓ endobj 2 0 obj <> endobj 3 0 obj <>/ExtGState<>/ProcSet[/PDF/Text/ImageB/ImageC/ImageI] >>/Annots[ 28 0 R 29 0 R] /MediaBox[ 0 0 595.5 842.25] /Contents 4 0 R/Group<>/Tabs/S>> endobj ºaâÚÎΞ-ÌE1ÍØÄ÷{òò2ÿ ÛÖ^ÔÀá TÎ{¦?§®¥kuµùÕ5sLOšuY>endobj 2 0 obj<>endobj 2 0 obj<>endobj 2 0 obj<>endobj 2 0 obj<> endobj 2 0 obj<>endobj 2 0 obj<>es 3 0 R>> endobj 2 0 obj<> ox[ 0.000000 0.000000 609.600000 935.600000]/Fi endobj 3 0 obj<> endobj 7 1 obj<>/ProcSet[/PDF/Text/ImageB/ImageC/ImageI]>>/Subtype/Form>> stream
a
�_g` � @ s� d Z dZddlZg d�Zdadd� Zdd� Zd d
� Zdd� ZG d
d� de �Z
G dd� de�ZG dd� de
�ZG dd� d�ZG dd� d�ZdZG dd� d�ZG dd� de�ZG dd� de�ZG dd� d�ZdZd$d d!�Zd"d#� ZdS )%a|
Compute a resolution order for an object and its bases.
.. versionchanged:: 5.0
The resolution order is now based on the same C3 order that Python
uses for classes. In complex instances of multiple inheritance, this
may result in a different ordering.
In older versions, the ordering wasn't required to be C3 compliant,
and for backwards compatibility, it still isn't. If the ordering
isn't C3 compliant (if it is *inconsistent*), zope.interface will
make a best guess to try to produce a reasonable resolution order.
Still (just as before), the results in such cases may be
surprising.
.. rubric:: Environment Variables
Due to the change in 5.0, certain environment variables can be used to control
errors and warnings about inconsistent resolution orders. They are listed in
priority order, with variables at the bottom generally overriding variables
above them.
ZOPE_INTERFACE_WARN_BAD_IRO
If this is set to "1", then if there is at least one inconsistent
resolution order discovered, a warning
(:class:`InconsistentResolutionOrderWarning`) will be issued. Use the
usual warning mechanisms to control this behaviour. The warning text will
contain additional information on debugging.
ZOPE_INTERFACE_TRACK_BAD_IRO
If this is set to "1", then zope.interface will log information about each
inconsistent resolution order discovered, and keep those details in memory
in this module for later inspection.
ZOPE_INTERFACE_STRICT_IRO
If this is set to "1", any attempt to use :func:`ro` that would produce a
non-C3 ordering will fail by raising
:class:`InconsistentResolutionOrderError`.
.. important::
``ZOPE_INTERFACE_STRICT_IRO`` is intended to become the default in the
future.
There are two environment variables that are independent.
ZOPE_INTERFACE_LOG_CHANGED_IRO
If this is set to "1", then if the C3 resolution order is different from
the legacy resolution order for any given object, a message explaining the
differences will be logged. This is intended to be used for debugging
complicated IROs.
ZOPE_INTERFACE_USE_LEGACY_IRO
If this is set to "1", then the C3 resolution order will *not* be used.
The legacy IRO will be used instead. This is a temporary measure and will
be removed in the future. It is intended to help during the transition.
It implies ``ZOPE_INTERFACE_LOG_CHANGED_IRO``.
.. rubric:: Debugging Behaviour Changes in zope.interface 5
Most behaviour changes from zope.interface 4 to 5 are related to
inconsistent resolution orders. ``ZOPE_INTERFACE_STRICT_IRO`` is the
most effective tool to find such inconsistent resolution orders, and
we recommend running your code with this variable set if at all
possible. Doing so will ensure that all interface resolution orders
are consistent, and if they're not, will immediately point the way to
where this is violated.
Occasionally, however, this may not be enough. This is because in some
cases, a C3 ordering can be found (the resolution order is fully
consistent) that is substantially different from the ad-hoc legacy
ordering. In such cases, you may find that you get an unexpected value
returned when adapting one or more objects to an interface. To debug
this, *also* enable ``ZOPE_INTERFACE_LOG_CHANGED_IRO`` and examine the
output. The main thing to look for is changes in the relative
positions of interfaces for which there are registered adapters.
�restructuredtext� N)�ro� InconsistentResolutionOrderError�"InconsistentResolutionOrderWarningc C s t d u rdd l} | �t�a t S )Nr )�__logger�logging� getLogger�__name__)r � r
�>/vddos/python/lib/python3.9/site-packages/zope/interface/ro.py�_loggeri s
r c C sH t � }g }t| �D ]0}t|�D ]"}||vr|�|� |�d|� qq|S )a� Merge multiple orderings so that within-ordering order is preserved
Orderings are constrained in such a way that if an object appears
in two or more orderings, then the suffix that begins with the
object must be in both orderings.
For example:
>>> _legacy_mergeOrderings([
... ['x', 'y', 'z'],
... ['q', 'z'],
... [1, 3, 5],
... ['z']
... ])
['x', 'y', 'q', 1, 3, 5, 'z']
r )�set�reversed�add�insert)Z orderings�seen�resultZordering�or
r
r �_legacy_mergeOrderingsq s
r c C s2 | g}d}t |�D ]}|d7 }|j|||�<