
    OfN                     @    d Z ddlmZ g dZddlZd Zd Zd	dZd ZdS )
aj  Class advice.

This module was adapted from 'protocols.advice', part of the Python
Enterprise Application Kit (PEAK).  Please notify the PEAK authors
(pje@telecommunity.com and tsarna@sarna.org) if bugs are found or
Zope-specific changes are required, so that the PEAK version of this module
can be kept in sync.

PEAK is a Python application framework that interoperates with (but does
not require) Zope 3 and Twisted.  It provides tools for manipulating UML
models, object-relational persistence, aspect-oriented programming, and more.
Visit the PEAK home page at http://peak.telecommunity.com for more information.
    )FunctionType)determineMetaclassgetFrameInfoisClassAdvisorminimalBasesNc                    | j         }| j        }||u }d|v }d|v }|o|}|o|d         |d         k    }|r%t          j                            |d                   pd}|o|j        |u }|sd}	n|r|sd}	n|r|sd}	n|sd}	nd}	|	|||fS )	zReturn (kind,module,locals,globals) for a frame

    'kind' is one of "exec", "module", "class", "function call", or "unknown".
    
__module____name__Nexecmoduleclasszfunction callunknown)f_locals	f_globalssysmodulesget__dict__)
framer   r   sameNamespace	hasModulehasNamesameNamer   namespaceIsModulekinds
             G/var/www/html/env/lib/python3.11/site-packages/zope/interface/advice.pyr   r   )   s     ~HI	)M(II%G$WHKIj1Xl5KKH?:)>??G4F?6?i#? 	 
y 
	 -  
 9,,    c                 L    t          | t                    ot          | d          S )z(True if 'ob' is a class advisor functionpreviousMetaclass)
isinstancer   hasattr)obs    r   r   r   N   s"    b,''LGB8K,L,LLr   c                     d | D             }||                     |           t          |          dk    r|d         S t          |          }t          |          dk    rt          d|           |d         S )zEDetermine metaclass from 1+ bases and optional explicit __metaclass__c           	      J    g | ] }t          |d t          |                    !S )	__class__)getattrtype).0bs     r   
<listcomp>z&determineMetaclass.<locals>.<listcomp>V   s*    <<<GA{DGG,,<<<r   N   r   zIncompatible metatypes)appendlenr   	TypeError)basesexplicit_mcmeta
candidatess       r   r   r   S   s     =<e<<<D 	K   
4yyA~~Awd##J
:0%888 a=r   c                     g }| D ]K}| D ]}t          ||          r||ur n/||v r|                    |           |                    |           L|S )z?Reduce a list of base classes to its ordered minimum equivalent)
issubclassremover,   )classesr2   mns       r   r   r   k   s    J ! ! 	! 	!A!Q AQJJ J!!!$$$a   r   )N)	__doc__typesr   __all__r   r   r   r   r    r   r   <module>r=      s             


"- "- "-JM M M
   0    r   