e2>dZddlmZgdZddlZdZdZd dZdZy) ajClass 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 getFrameInfoisClassAdvisor minimalBasesNc,|j}|j}||u}d|v}d|v}|xr|}|xr |d|dk(}|xr"tjj |dxsd}|xr|j |u}|sd} n|r|sd} n|r|sd} n|sd} nd} | |||fS) zReturn (kind,module,locals,globals) for a frame 'kind' is one of "exec", "module", "class", "function call", or "unknown". __module____name__Nexecmoduleclassz function callunknown)f_locals f_globalssysmodulesget__dict__) framerr sameNamespace hasModulehasNamesameNamer namespaceIsModulekinds 7/usr/lib/python3/dist-packages/zope/interface/advice.pyrr's ~~HI )M(II%G$WHIIj18L3IIH  ?:)>? G4F?6??i#?  y -  9 ,,c>t|txr t|dS)z(True if 'ob' is a class advisor functionpreviousMetaclass) isinstancerhasattr)obs rrrKs b & J726I+JJrc |Dcgc]}t|dt|}}||j|t|dk(r|dSt |}t|dkDr t d||dScc}w)zEDetermine metaclass from 1+ bases and optional explicit __metaclass__ __class__rzIncompatible metatypes)getattrtypeappendlenr TypeError)bases explicit_mcbmeta candidatess rrrPs5: :qGAk$q' * :D : K  4y!|Awd#J :q0%88 a=% ;sA4cg}|D]B}|D]}t||s||us||vr|j||j|D|S)z?Reduce a list of base classes to its ordered minimum equivalent) issubclassremover()classesr/mns rrrhsdJ ! !A!A1A: ! J!!!$   a ! r)N) __doc__typesr__all__rrrrrrrr:s1   !-HK 0r