403Webshell
Server IP : 192.158.238.246  /  Your IP : 3.17.191.196
Web Server : LiteSpeed
System : Linux uniform.iwebfusion.net 4.18.0-553.27.1.lve.1.el8.x86_64 #1 SMP Wed Nov 20 15:58:00 UTC 2024 x86_64
User : jenniferflocom ( 1321)
PHP Version : 8.1.32
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : ON  |  Sudo : OFF  |  Pkexec : OFF
Directory :  /opt/alt/python37/lib64/python3.7/site-packages/guppy/heapy/__pycache__/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /opt/alt/python37/lib64/python3.7/site-packages/guppy/heapy/__pycache__/UniSet.cpython-37.opt-1.pyc
B

�]��@sfddlmZddlmZGdd�de�ZGdd�de�ZGdd�de�ZGd	d
�d
e�ZGdd�de�Z	Gd
d�de�Z
Gdd�de�ZGdd�d�ZGdd�de�Z
Gdd�de
�ZGdd�de�ZGdd�de�ZGdd�de�ZGdd�de
�ZGdd �d e
�ZGd!d"�d"e�ZGd#d$�d$e
�ZGd%d&�d&�Zd'd(�fd)d*�Zd+d(�fd,d-�ZGd.d/�d/�Zd0S)1�)�reduce)�property_expc@sDeZdZdZdZdZdZdd�ZeZdd�Z	d	d
�Z
dd�Zd
d�Zdd�Z
dd�Zdd�Zdd�Zdd�Zdd�Zdd�Zdd�Zdd �Zd!d"�Zd#d$�ZeZd%d&�Zd'd(�Zd)d*�Zd+d,�Zd-d.�ZeZed/d0�d1d2�Z d3d4�Z!ed5d0��Z"d6d7�Z#d8d9�Z$d:d;�Z%d<d=�Z&d>d?�Z'd@dA�Z(edBd0�dCd2�Z)edDd0�dEd2�Z*dFS)G�UniSet)�_hiding_tag_�fam�_origin_z#heapy_UniSet.html#heapykinds.UniSet�z�nodes: ImmNodeSet

The actual objects contained in x. These are called nodes because
they are treated with equality based on address, and not on the
generalized equality that is used by ordinary builtin sets or dicts.cCs|j�d||�S)z,
Return the intersection of self and other.
�and)r�c_binop)�self�other�r
�E/opt/alt/python37/lib64/python3.7/site-packages/guppy/heapy/UniSet.py�__and__szUniSet.__and__cOs|j�|||�S)N)r�c_call)r�args�kwdsr
r
r�__call__�zUniSet.__call__cCs|j�||�S)z<
Return True if other is a member of self, False otherwise.
)r�
c_contains)rrr
r
r�__contains__szUniSet.__contains__cCs||ko||kS)zJ
Return True if self contains the same elements as other,
False otherwise.r
)rrr
r
r�__eq__!sz
UniSet.__eq__cCs|j�|�S)zh
Return an hash based on the kind of the set of self and
the addresses of its elements, if any.
        )r�c_hash)rr
r
r�__hash__'szUniSet.__hash__cCs|j�d|�S)z 
Return the complement of self.
�invert)r�c_unop)rr
r
r�
__invert__.szUniSet.__invert__cCs0||krdSt|t�s"|j�|�}|j�||�S)zT
Return True if self is a superset of (and may be equal to) other,
False otherwise.
T)�
isinstancerr�c_uniset�c_ge)rrr
r
r�__ge__4s

z
UniSet.__ge__cCs||ko||kS)z[
Return True if self is a strict (may not be equal to) superset of other.
False otherwise.
r
)rrr
r
r�__gt__?sz
UniSet.__gt__cs�jjj���fdd��S)z 
Get family-specific attribute.
cs�j����S)N)r�	c_getattrr
)rrr
r�<lambda>Jrz$UniSet.__getattr__.<locals>.<lambda>)r�mod�ViewZenter)rrr
)rrr�__getattr__FszUniSet.__getattr__cCs0||krdSt|t�s"|j�|�}|j�||�S)zR
Return True if self is a subset of (and may be equal to) other,
False otherwise.
T)rrrr�c_le)rrr
r
r�__le__Ls

z
UniSet.__le__cCs|j�||�S)a�
<<This is about to change, does not work as one may expected.
Nov 19 2005. >>>

Return a 'mapping' set, which may be used for specification and test
purposes. It implements the syntax:

        return_spec << argument_spec

The elements of the set returned are the callable objects that return
values in return_spec, when called with arguments according to
argument_spec. The return_spec may be any kind of sets that can test
for element containment. The argument_spec may be a set or a tuple. If
it is a set, it should be able to generate some examples, to allow the
mapping to be tested.  When argument_spec is a set, the mapping will
have a single argument. Any number of arguments may be specified using
an argument_spec which is a tuple.  The arguments are then specified
with sets, that should be able to generate examples. Special features
of the mapping such as optional arguments may be specified in the same
way as when using the 'mapping' function in the Spec.py module.


)r�c_lshift)Zreturn_specZ
argument_specr
r
r�
__lshift__WszUniSet.__lshift__cCs||ko||kS)zY
Return True if self is a strict (may not be equal to) subset of other,
False otherwise.
r
)rrr
r
r�__lt__qsz
UniSet.__lt__cCs$t|t�s|j�|�}|j�||�S)ac
Return the cartesian product of self and other, which is the set of
pairs where the first element is a member of self and the second
element is a member of other.

NOTE: Unlike what one might expect from the way the cartesian product
may be defined mathematically, the operation as implemented here is
nonassociative, i.e.

     a*b*c == (a*b)*c != a*(b*c)


In the mathematical case, a*b*c would be a set of triples, but here it
becomes a set of pairs with the first element in (a*b) and the second
element in c.

To create sets of triples etc. the cprod() factory function in Spec.py
could be used directly.
)rrrr�c_mul)rrr
r
r�__mul__xs
zUniSet.__mul__cCs
||kS)zN
Return True if self does not equal other,
False otherwise. See also: __eq__.
r
)rrr
r
r�__ne__�sz
UniSet.__ne__cCs|j�|�S)z=
Return True if self contains some element,
False otherwise.
)r�	c_nonzero)rr
r
r�__bool__�szUniSet.__bool__cCs|j�d||�S)z%
Return the union of self and other.
�or)rr
)rrr
r
r�__or__�sz
UniSet.__or__cCs|j�|�S)zW
Return a string representing self.  This is usually the same string
as from __str__.

)r�c_repr)rr
r
r�__repr__�szUniSet.__repr__cCs|j�|�S)z�
Return a string representing self. The string is usually the same as the .brief
attribute, but a major exception is the IdentitySet class.

)r�c_str)rr
r
r�__str__�szUniSet.__str__cCs$t|t�s|j�|�}|j�||�S)zq
Return the assymetrical set difference.  That is, the set of elements
in self, except those that are in others.
)rrrr�c_sub)rrr
r
r�__sub__�s
zUniSet.__sub__cCs$t|t�s|j�|�}|j�||�S)z�
Return the assymetrical set difference.  That is, the
set of elements in other, except those that are in self.

This is like __sub__ except it handles the case when the left
argument is not a UniSet (but convertible to a UniSet).
)rrrrr7)rrr
r
r�__rsub__�s
zUniSet.__rsub__cCs$t|t�s|j�|�}|j�||�S)zy
Return the symmetrical set difference.  That is, the set of elements
that are in one of self or other, but not in both.
)rrrr�c_xor)rrr
r
r�__xor__�s
zUniSet.__xor__cCs|j�|�S)N)r�c_get_brief)rr
r
rr#�rzUniSet.<lambda>aA string representation of self, which is brief relative to the
representation returned by __str__ and __repr__. (In many cases it is
the same - both are then brief - but for IdentitySet objects the brief
representation is typically much shorter than the non-brief one.))�doccCs|jjjjj�|�S)N)rr$�_root�guppyr=Z
help_instance)rr
r
r�	_get_help�szUniSet._get_helpcCs|jjjjjj�|�S)N)rr$r>r?ZetcZHelp�dir)rr
r
rr#�rcCs|j�|�S)N)r�	c_get_ckc)rr
r
r�get_ckc�szUniSet.get_ckccCs|j�||�S)z�
Return information about the 'origin' of the set. This was intended to be
used for specification purposes - is experimental, noncomplete, temporary.
)r�c_derive_origin)rr=r
r
r�_derive_origin_�szUniSet._derive_origin_cCs|j�||�S)z�
Return True if self and other are disjoint sets, False otherwise. This
is equivalent to calculating

        (self & other) == Nothing

but may be implemented more efficiently in some cases.
)r�
c_disjoint)rrr
r
r�disjoint�s	zUniSet.disjointcCs|j�||�S)aV
Return an iterable object or an iterator, which provides someexamples
of the elements of self.  (A minimum of 2 examples should normally be
provided, but it may depend on some test configuration options.)

This is used for automatic test generation from specifications.  The
env argument is according to specification of TestEnv in Spec.py,
)r�c_get_examples)r�envr
r
r�get_examples�s	zUniSet.get_examplescCs|j�|�S)a�
Return a function that may be used to render the representation of the
elements of self. This is mainly intended for internal representation
support.

The function returned depends on the kind of elements self
contains. The rendering function is choosen so that it will be
appropriate, and can be used safely, for all objects of that kind.
For the most general kind of objects, the rendering function will only
return an address representation. For more specialized kinds, the
function may provide more information, and can be equivalent to the
builtin repr() when the kind is narrow enough that it would work for
all elements of that kind without exception.

)r�c_get_render)rr
r
r�
get_renderszUniSet.get_rendercCs|j�|||�S)ae
Test if self contains the element object.  This is used mainly for
internal use for automatic (experimental) testing of specifications.

The env argument is according to specification of TestEnv in Spec.py.
It provides support for things that depends on the specific test
situation, such as a test reporting protocol. If test_contains did
find the element to be contained in self, the method will return
(usually True). But if the element was not contained in self, the
method should call env.failed(message), and return whatever may
be returned; though typically env.failed() would raise an exception.
         )r�c_test_contains)r�elementrIr
r
r�
test_containss
zUniSet.test_containscCs|j�|�S)N)r�c_get_biper)rr
r
rr#%rz�A bipartitioning equivalence relation based on x. This may be used to
partition or classify sets into two equivalence classes:

x.biper(0) == x
    The set of elements that are in x.
x.biper(1) == ~x
    The set of elements that are not in x.
        cCs|j�|�S)N)r�c_get_dictof)rr
r
rr#0ra4dictof: UniSet

If x represents a kind of objects with a builtin __dict__ attribute,
x.dictof is the kind representing the set of all those dict
objects. In effect, x.dictof maps lambda e:getattr(e, '__dict__') for
all objects e in x. But it is symbolically evaluated to generate a new
symbolic set (a Kind).N)+�__name__�
__module__�__qualname__�	__slots__�
_help_url_Z_instahelp_Z
_doc_nodesr�__rand__rrrrrr r!r&r(r*r+r-r.r0r2�__ror__r4r6r8r9r;�__rxor__r�briefr@r=rCrErGrJrLrO�biper�dictofr
r
r
rrsT		rc@s eZdZdZdd�Zdd�ZdS)�Kind)�argcCs||_|j|_||_d|_dS)N)rrr^r)rrr^r
r
r�__init__=sz
Kind.__init__cCs|j�||�S)N)r�c_alt)r�cmpr
r
r�altCszKind.altN)rRrSrTrUr_rbr
r
r
rr]:sr]c@sDeZdZdZdZdd�Zdd�Zdd�Zd	d
�ZdUdd�Z	dVdd�Z
dd�Zdd�Zdd�Z
edd�dd�Zedd�dd�Zedd�d d�Zed!d�d"d�Zed#d�d$d�Zed%d�d&d�Zed'd�d(d�Zed)d�d*d�Zed+d�d,d�Zed-d�d.d�Zed/d�d0d�Zed1d�d2d�Zed3d�d4d�Zed5d�d6d�Zed7d�d8d�ZZed9d�d:d�Zed;d�d<d�Z ed=d�d>d�Z!ed?d�d@d�Z"edAd�dBd�Z#edCd�dDd�Z$edEd�dFd�Z%edGd�dHd�Z&edId�dJd�Z'edKd�dLd�Z(ee	dMd�Z)ee
dNd�Z*ee
dOd�Z*ee
dPd�Z+edQd�dRd�Z,edSd�dTd�Z-dS)W�IdentitySet)�_er�
_partitionz(heapy_UniSet.html#heapykinds.IdentitySetcCs|j�||�S)N)r�	c_getitem)r�idxr
r
r�__getitem__KrzIdentitySet.__getitem__cCs|j�|�S)N)r�c_len)rr
r
r�__len__LrzIdentitySet.__len__cCs|j�|�S)N)r�c_iter)rr
r
r�__iter__MrzIdentitySet.__iter__cCs|j�|�S)z{
Return a string representating self. This differs from the .brief
attribute in that it is a tabular representation.

...

)rr5)rr
r
rr6Os	zIdentitySet.__str__NrFc		Cs|jj�|||||||||�	S)a�
x.get_rp(depth=None, er=None, imdom=0, bf=0, src=None, stopkind=None,
        nocyc=False, ref=None)

Return an object representing the pattern of references to the objects in X.
The returned object is of kind ReferencePattern.

Arguments
        depth   The depth to which the pattern will be generated. The
                default is taken from depth of this module.
        er      The equivalence relation to partition the referrers.
                The default is Clodo.

        imdom   If true, the immediate dominators will be used instead
                of the referrers. This will take longer time to
                calculate, but may be useful to reduce the complexity
                of the reference pattern.

        bf      If true, the pattern will be printed in breadth-first
                order instead of depth-first. (Experimental.)
        src     If specified, an alternative reference source instead
                of the default root.
        stopkind
                The referrers of objects of kind stopkind will not be
                followed.
        nocyc   When True, certain cycles will not be followed.
        ref

See also
        rp (a shorthand for common cases)

)r�RefPat�rp)	rZdepth�er�imdomZbf�srcZstopkindZnocyc�refr
r
r�get_rpZs"zIdentitySet.get_rpr
cCs|jj�||||�S)a?x.get_shpaths(draw:[src, avoid_nodes, avoid_edges]) -> Paths

Return an object containing the shortest paths to objects in x.
The optional arguments are:

    src:IdentitySet             An alternative source set of objects
    avoid_nodes:IdentitySet     Nodes to avoid
    avoid_edges:NodeGraph       Edges to avoid

)r�Path�shpaths)rrqZavoid_nodesZavoid_edgesr
r
r�get_shpathsszIdentitySet.get_shpathscCs|j�||�S)z< x.by(er) -> A copy of x, but using er for equiv. relation. )r�get_by)rror
r
r�by�szIdentitySet.bycCs|j|�|j�jS)N)�statrxro)rrr
r
r�diff�szIdentitySet.diffcOs|jj||�dS)zD Dump statistical data to a file
          Shorthand for .stat.dump N)ry�dump)rrrr
r
rr{�szIdentitySet.dumpcCs
|�d�S)N�Clodo)rx)rr
r
rr#�rzIdentitySet.<lambda>z=A copy of self, but with 'Clodo' as the equivalence relation.)r=cCs
|�d�S)N�Idset)rx)rr
r
rr#�rz�A copy of self, but with 'Idset' as the equivalence relation.

Note
    This is mainly for special purpose internal use. The Id
equivalence relation is more efficient when partitioning large
sets.cCs
|�d�S)NZId)rx)rr
r
rr#�rz:A copy of self, but with 'Id' as the equivalence relation.cCs
|�d�S)NZModule)rx)rr
r
rr#�rz>A copy of self, but with 'Module' as the equivalence relation.cCs
|�d�S)NZRcs)rx)rr
r
rr#�rz;A copy of self, but with 'Rcs' as the equivalence relation.cCs
|�d�S)NZSize)rx)rr
r
rr#�rz<A copy of self, but with 'Size' as the equivalence relation.cCs
|�d�S)N�Type)rx)rr
r
rr#�rz<A copy of self, but with 'Type' as the equivalence relation.cCs
|�d�S)N�Unity)rx)rr
r
rr#�rz=A copy of self, but with 'Unity' as the equivalence relation.cCs
|�d�S)NZVia)rx)rr
r
rr#�rz<
A copy of self, but with 'Via' as the equivalence relation.cCs|j�|�S)N)r�get_er)rr
r
rr#�rzUThe equivalence relation used for partitioning when representing /
printing this set.cCs
t|j�S)N)�len�nodes)rr
r
rr#�rz,The number of individual objects in the set.cCs|jj�|�S)N)rr%�dominos)rr
r
rr#�rz�The set 'dominated' by a set of objects. This is the objects that will
become deallocated, directly or indirectly, when the objects in the
set are deallocated.

See also: domisize.cCs|jj�|�S)N)rr%�domisize)rr
r
rr#�rz�The dominated size of a set of objects. This is the total size of
memory that will become deallocated, directly or indirectly, when the
objects in the set are deallocated.

See also: dominos, size.
cCs|jj�|�S)N)rr%rp)rr
r
rr#�rz�The immediate dominators of a set of objects. The immediate dominators
is a subset of the referrers. It includes only those referrers that
are reachable directly, avoiding any other referrer.cCs|jj�|�S)N)rr%�indisize)rr
r
rr#�rz�The total 'individual' size of the set of objects.  The individual
size of an object is the size of memory that is allocated directly in
the object, not including any externally visible subobjects. See also:
domisize.cCs
|j|S)N)ro)rr
r
rr#�rz�The kind of objects in the set. The kind is the union of the
element-wise classifications as determined by the equivalence relation
in use by the set.cCst|�S)N)�MappingProxy)rr
r
rr#�ra�An object that can be used to map operations to the objects in self,
forming a new set of the result. The returned object is an instance of
MappingProxy.

This works currently as follows:

o Getting an attribute of the MappingProxy object will get the
  attribute from each of the objects in the set and form a set of the
  results. If there was an exception when getting some attribute, it
  would be ignored.

o Indexing the MappingProxy object will index into each of the objects
  in the set and return a set of the results. Exceptions will be
  ignored.

Example:

>>> hp.iso({'a':'b'}, {'a':1}).maprox['a'].byid
Set of 2  objects. Total size = 40 bytes.
 Index     Size   %   Cumulative  %   Kind: Name/Value/Address
     0       28  70.0        28  70.0 str: 'b'
     1       12  30.0        40 100.0 int: 1
>>>

<This is an experimental feature, so the name is intentionally made
mystically-sounding, and is a shorthand for 'mapping proxy'.>cCs|j�|�S)N)r�get_more)rr
r
rr#�rz�An object that can be used to show more lines of the string
representation of self. The object returned, a MorePrinter instance,
has a string representation that continues after the end of the
representation of self.cCs|j�|�S)N)r�
get_owners)rr
r
rr#rz�The set of objects that 'own' objects in self. The owner is defined
for an object of type dict, as the object (if any) that refers to the
object via its special __dict__ attribute.cCs|j�|�S)N)r�
get_partition)rr
r
rr#ra�A partition of the set of objects in self. The set is partitioned into
subsets by equal kind, as given by a equivalence relation.  Unless
otherwise specified, the equivalence relation used is 'byclodo', which
means it classifies 'by type or dict owner'. Different
equivalence relations are specified for sets created by the 'by_...'
attributes of any IdentitySet object.

The value is an instance of guppy.heapy.Part.Partition.cCs|j�|�S)N)r�	get_parts)rr
r
rr#rz�An iterable object, that can be used to iterate over the 'parts' of
self. The iteration order is determined by the sorting order the set
has, in the table printed when partitioned.cCs|�|j�S)N)rv�	referrers)rr
r
rr#rz;The paths from the direct referrers of the objects in self.cCs|j�|�S)N)�	referentsrv)rr
r
rr#rz2The paths to the referents of the objects in self.cCs|jj�|�S)N)rr%r�)rr
r
rr#rzOThe set of objects that are directly referred to by any of the objects
in self.cCs|jj�|�S)N)rr%r�)rr
r
rr# rzEThe set of objects that directly refer to any of the objects in self.zprp: ReferencePattern

An object representing the pattern of references to the objects in X.

See also
    get_rpzsx.shpaths: Paths

An object containing the shortest paths to objects in x.

Synonym
    sp
See also
    get_shpathsznx.sp: Paths

An object containing the shortest paths to objects in x.

Synonym
    sp
See also
    get_shpathszsx.sp: Paths

An object containing the shortest paths to objects in x.

Synonym
    shpaths
See also
    get_shpathscCs
|j��S)N)�	partitionZget_stat)rr
r
rr#Frz�x.stat: Stat

An object summarizing the statistics of the partitioning of x. This is
useful when only the statistics is required, not the objects
themselves. The statistics can be dumped to a file, unlike the set of
objects itself.cCs|j�|�S)N)r�
get_theone)rr
r
rr#Nrz�theone: Anything

The one object in a singleton set. In case the set does not contain
exactly one object, the exception ValueError will be raised.
)NNrrNNFN)NNr
).rRrSrTrUrVrhrjrlr6rsrvrxrzr{rZbyclodoZbyidsetZbyidZbymoduleZbyrcsZbysizeZbytypeZbyunityZbyviaro�countr�r�rpr��size�kindZmaproxZmore�ownersr��partsZpathsinZpathsoutr�r�rnruZspry�theoner
r
r
rrcGs�
$
rcc@seZdZdZdd�ZdS)�IdentitySetMulti)r�cCs||_|j|_||_d|_dS)N)rrr�r)rrr�r
r
rr_YszIdentitySetMulti.__init__N)rRrSrTrUr_r
r
r
rr�Vsr�c@s<eZdZdZdZdd�Zedd�dd�Zd	d
�Zee�Z	dS)�IdentitySetSingleton)�_nodez1heapy_UniSet.html#heapykinds.IdentitySetSingletoncCs||_|j|_||_d|_dS)N)rrr�r)rrZnoder
r
rr_dszIdentitySetSingleton.__init__cCs|j�|jf�S)N)r�
immnodesetr�)rr
r
rr#krzIdentitySetSingleton.<lambda>z�x.nodes: ImmNodeSet

The actual objects contained in x. These are called nodes because they
are treated with equality based on address, and not on the generalized
equality that is used by ordinary builtin sets or dicts.)r=cCs|jS)N)r�)rr
r
r�_get_theonersz IdentitySetSingleton._get_theoneN)
rRrSrTrUrVr_rr�r�r�r
r
r
rr�`sr�c@sReZdZdZdZdZddd�Zdd�Zd	d
�Ze	e�Z
dd�Ze	e�Zd
d�Z
dS)�EquivalenceRelationa�An equivalence relation is a binary relation between two elements of a
set which groups them together as being "equivalent" in some way.

An equivalence relation is reflexive, symmetric, and transitive. In
other words, the following must hold for "~" to be an equivalence
relation on X:

    * Reflexivity: a ~ a
    * Symmetry: if a ~ b then b ~ a
    * Transitivity: if a ~ b and b ~ c then a ~ c.

An equivalence relation partitions a set into several disjoint
subsets, called equivalence classes. All the elements in a given
equivalence class are equivalent among themselves, and no element is
equivalent with any element from a different class.
)�
classifier�erargsz0heapy_UniSet.html#heapykinds.EquivalenceRelationr
cCs$||_|j|_||_||_d|_dS)N)rrr�r�r)rrr�r�r
r
rr_�s
zEquivalenceRelation.__init__cCs|j�||�S)N)rrf)rrgr
r
rrh�szEquivalenceRelation.__getitem__cCs|jj�|�S)N)r�ClassifiersZmker_dictof)rr
r
r�_get_dictof�szEquivalenceRelation._get_dictofcCs|jj�|�S)N)rr�Zmker_refdby)rr
r
r�_get_refdby�szEquivalenceRelation._get_refdbycOs|jj|f|�|�S)N)r�Z
get_sokind)rrrr
r
r�sokind�szEquivalenceRelation.sokindN)r
)rRrSrT�__doc__rUrVr_rhr�rr\r�Zrefdbyr�r
r
r
rr�xs
r�c@s(eZdZdZdd�Zdd�Zdd�ZdS)	r�)�_set_cCs
||_dS)N)r�)r�setr
r
rr_�szMappingProxy.__init__cCs&|dkrt�||�S|jj�|j|�S)Nr�)�object�__getattribute__r�r�maprox_getattr)r�namer
r
rr��szMappingProxy.__getattribute__cCs|jj�|j|�S)N)r�r�maprox_getitem)rr�r
r
rrh�szMappingProxy.__getitem__N)rRrSrTrUr_r�rhr
r
r
rr��sr�c@sfeZdZdZdd�Zdd�Zdd�Zdd	�Zd
d�Zdd
�Z	dd�Z
dd�Zdd�Zdd�Z
dd�Zdd�Zdd�Zdd�Zdd�Zd d!�Zd"d#�Zd$d%�Zd&d'�Zd(d)�Zd*ifd+d,�Zd-d.�Zd/d0�Zd1d2�Zd3d4�Zd5d6�Zd7d8�Zd9d:�Zd;d<�Z d=d>�Z!d?d@�Z"dAdB�Z#dCdD�Z$dEdF�Z%dGdH�Z&dIdJ�Z'dKdL�Z(dMdN�Z)dOdP�Z*dQdR�Z+dSdT�Z,dUdV�Z-dS)W�FamilyNcCsL||_|jj|_|j|_|j|_|��|_|jj|_|�|g�|_t	|_
dS)N)r$�_parent�Docr�typesr��	disjoints�export_dict�supersr]�Set)rr$r
r
rr_�s


zFamily.__init__cCs|�||�S)N)r�)rr^r
r
rr�szFamily.__call__cCs|j�||�S)N)r��
add_origin)r�originr
r
rrE�szFamily._derive_origin_cCs,|�||�}|j�||jj|f|���}|S)N)r�r�r��callfunc)r�tup�rr
r
r�specotup�szFamily.specotupcCs(|�||�}|j�||j�||��}|S)N)r�r�r�r�)rr^r�r
r
r�specoarg�szFamily.specoargcCs,|�||�}|j�||jj|f|���}|S)N)r�r�r�r�)rr^r�r�r
r
r�specoargtup�szFamily.specoargtupcCsN|j|jjkr|jj��|_||jkr@|j||k	r@td|��||j|<dS)Nz
Duplicate: %s)r�r$�copy�
ValueError)rr��valuer
r
r�
add_export�s
zFamily.add_exportcCstd|��dS)Nz!No alternative set for family %s.)r�)r�arar
r
rr`�szFamily.c_altcCs,t|t�s|�|�}t|d|�||�}|S)N�c_)rrr�getattr)r�opr��br�r
r
rr
�s

zFamily.c_binopcCst|d|�|�}|S)Nr�)r�)rr�r�r�r
r
rr�sz
Family.c_unopcCs|j�||�S)N)r�r�)rr�r�r
r
rrD�szFamily.c_derive_origincCstd��dS)NzNot callable set)r�)rr�rrr
r
rr�sz
Family.c_callcCs|j}||�|�@|jk	S)N)r$�iso�Nothing)rr�r�r$r
r
rr�szFamily.c_containscCs|jj�|�S)N)r$r�r[)rr�r
r
rrP�szFamily.c_get_bipercCs|jj�|�S)N)r$r�r\)rr�r
r
rrQ�szFamily.c_get_dictofcCs||@|jjkS)N)r$r�)rr�r�r
r
rrF�szFamily.c_disjointcCst|d|jjf�||�S)Nz_factordisjoint_%s)r�r�opname)rr�r�r
r
r�c_factordisjoint�szFamily.c_factordisjointcCsd||�|�fS)Nz[%s %s])r<)rr�rbr
r
r�c_get_brief_altszFamily.c_get_brief_altcCs|j�|�S)N)r$�uniset_from_setcastable)r�Xr
r
rrszFamily.c_unisetcCsgS)Nr
)rr�rIr
r
rrHszFamily.c_get_examplesr
cCs.|j}||kr"|||f|�|�S|�||�S)N)r��
c_getattr2)rr�r�rr�dr
r
rr"szFamily.c_getattrcCst|��dS)N)�AttributeError)rr�r�r
r
rr�szFamily.c_getattr2cCs
|jjjS)N)r$Zsummary_str�str_address)rr�r
r
rrKszFamily.c_get_rendercCs|jS)N)rZ)rr�r�r
r
r�
c_get_str_forszFamily.c_get_str_forcCs,|��}t|d|�}t|dd�}|s(d}|S)N�im_func�_idpart_headerZValue)rLr�)rr��render�hr
r
r�c_get_idpart_header szFamily.c_get_idpart_headercCsd|S)Nz<%s>r
)rr�r
r
r�c_get_idpart_label(szFamily.c_get_idpart_labelcCs
|�|�S)N)rK)rr�r
r
r�c_get_idpart_render+szFamily.c_get_idpart_rendercCs2|�|�}|tkrdSt|d|�}t|d|�}|S)N�IDENTITYr��_idpart_sortrender)r��reprr�)rr�r�r�r
r
r�c_get_idpart_sortrender.s
zFamily.c_get_idpart_sortrendercCs
t|j�S)N)�hashr^)rr�r
r
rr6sz
Family.c_hashcCstd��dS)Nziteration over non-sequence)�	TypeError)rr�r
r
rrk9sz
Family.c_itercCstd��dS)Nzlen() of unsized object)r�)rr�r
r
rri<szFamily.c_lencCsdS)NTr
)rr�r
r
rr/?szFamily.c_nonzerocCs|jjj�||�S)N)r$r��SpecZcprod)rr�r�r
r
rr,BszFamily.c_mulcCs"|j�|�||�|j�d||��S)N�lshift)r�r��c_mapZbinop)rr�r�r
r
rr)EszFamily.c_lshiftcCs>t|t�rt|�}t|t�s"|f}|d|f}|jjjj|�S)Nz->)r�list�tupler$r�r��mapping)rr�r��tr
r
rr�Hs

zFamily.c_mapcCs
|�|�S)N)r5)rr�r
r
rr3Psz
Family.c_reprcCs
|�|�S)N)r<)rr�r
r
rr5SszFamily.c_strcCs
||@S)Nr
)rr�r�r
r
rr7VszFamily.c_subcCs2|�||�s.|�d|j|�|�|�|�f�SdS)Nz%s: %s does not contain %sT)r�failed�	__class__r�)rr�r�rIr
r
rrMYs"zFamily.c_test_containscCs||||BS)Nr
)rr�r�r
r
rr:^szFamily.c_xorcCs|j�||�S)N)r�_or_TERM)rr�r�r
r
r�_or_ORasz
Family._or_ORcCs|�||�S)N)�	_and_ATOM)rr�r�r
r
r�
_rand_ATOMdszFamily._rand_ATOM).rRrSrT�superclr_rrEr�r�r�r�r`r
rrDrrrPrQrFr�r�rrHr"r�rKr�r�r�r�r�rrkrir/r,r)r�r3r5r7rMr:r�r�r
r
r
rr��sV
r�c@s�eZdZdZdZdZdd�Zdd�Zdd�Zd	d
�Z	dd�Z
d
d�Zdd�Zdd�Z
dd�ZeZZZdd�Zdd�ZeZZdd�Zdd�Zdd�ZeZZdd �Zd!d"�Zd#d$�Zd%d&�Zd'd(�Zd)S)*�
AtomFamilyTZATOMcCs t�||�|j|gO_dS)N)r�r_r�)rr$r
r
rr_mszAtomFamily.__init__cCs|j�||�S)N)rr�)rr�r�r
r
r�c_andqszAtomFamily.c_andcCs|j�||�S)N)r$�fam_And)rr�r�r
r
rr�tszAtomFamily._and_ATOMcCs|j�||�S)N)rr�)rr�r�r
r
r�_and_ANDwszAtomFamily._and_ANDcCs|j�||�S)N)r$r�)rr�r�r
r
r�_and_FACTORzszAtomFamily._and_FACTORcCs|j�||�S)N)rr�)rr�r�r
r
r�_and_INVERT}szAtomFamily._and_INVERTcCs |jj|jj@p|jj|jj@S)N)rr�r�)rr�r�r
r
r�_factordisjoint_ATOM�szAtomFamily._factordisjoint_ATOMcCs|j�||�S)N)rr�)rr�r�r
r
r�_factordisjoint_INVERT�sz!AtomFamily._factordisjoint_INVERTcCs|j�||�S)N)r�_ge_ATOM)rr�r�r
r
rr'�szAtomFamily.c_lecCs|jdk	o|j|kS)N)r�)rr�r�r
r
r�_le_ATOM�szAtomFamily._le_ATOMcCs|j�||�S)N)rr�)rr�r�r
r
rr�szAtomFamily.c_gecCs|jjdk	o|jj|kS)N)rr�)rr�r�r
r
rr��szAtomFamily._ge_ATOMcCs|j�||�S)N)r�_or_ATOM)rr�r�r
r
r�c_or�szAtomFamily.c_orcCs|j�||�S)N)r$�fam_Or)rr�r�r
r
rr��szAtomFamily._or_ATOMcCs|j�|�S)N)r$�
fam_Invert)rr�r
r
r�c_invert�szAtomFamily.c_invertcCs||_|j|jjO_dS)N)r�r�r)rr^r
r
r�defrefining�szAtomFamily.defrefiningcGs2|j|O_|j}|dk	r.|j|jjO_dS)N)r�r�r)rr�scr
r
r�defdisjoint�szAtomFamily.defdisjointcCs|�|�|�|j�dS)N)r�r�r)rr^r
r
r�
defrefidis�s
zAtomFamily.defrefidiscCs|jS)N)r�)rr
r
r�	fam_union�szAtomFamily.fam_unionN)rRrSrT�isatom�isfactorr�r_r�r�r�r�r�r�r�r'�_le_AND�
_le_INVERTr�r�
_ge_INVERT�_ge_ANDr�r�r��_or_AND�
_or_INVERTr�r�r�r�r�r
r
r
rr�hs2r�c@s,eZdZdd�Zdd�Zdd�Zdd�Zd	S)
�
ArgAtomFamilycCs|�|�\}}}|�|||�S)N)rBZ
select_ids)rr�r��cla�krar
r
r�_and_ID�szArgAtomFamily._and_IDcCs.||jkr|j|jkS|jjdk	o,|jj|kS)N)rr^r�)rr�r�r
r
rr��s
zArgAtomFamily._ge_ATOMcCs*||jkr|j|jkS|jdk	o(|j|kS)N)rr^r�)rr�r�r
r
rr��s
zArgAtomFamily._le_ATOMcCs|j|jdfS)Nz==)r�r^)rr�r
r
rrB�szArgAtomFamily.c_get_ckcN)rRrSrTrr�r�rBr
r
r
rr�src@s�eZdZdZdZdZdd�Zdd�Zdd�Zd	d
�Z	dd�Z
d
d�ZeZZ
dd�Zdd�Zdd�ZeZZZdd�Zdd�ZeZZZdd�Zdd�Zdd�ZeZZdd �Zd!d"�Zd#d$�Z d%d&�Z!d'd(�Z"d)d*�Z#d+d,�Z$d-d.�Z%d/S)0�	AndFamilyZANDFcCs<||kr|S||kr|S|j�||�r.|jjS|�||f�S)N)rr�r$r��_cons)rr�r�r
r
rr�szAndFamily.__call__cCs<t|�dkr|�|t|��St|�dkr0|dS|jjSdS)N�r)r�r�r�r$r�)rr^r
r
rr
�s
zAndFamily._consc	Cs~g}xt|jD]j}y|�|�}Wntk
r2YqXx@t|�D]4}x.|jD]}||k	rJ|�||�sJPqJW|�|�q>WqW|S)N)r^rJZ
CoverageErrorr��contains�append)rr�rI�ex�ai�eZeiZajr
r
rrH�szAndFamily.c_get_examplescCs|j�||�S)N)rr�)rr�r�r
r
rr��szAndFamily.c_andcCsx|jD]}||M}qW|S)N)r^)rr�r�r
r
rr��szAndFamily._and_ANDcCs^g}xD|jD]:}||kr|S||kr&q|j�||�r<|jjS|�|�qW|�|�|�|�S)N)r^rr�r$r�r
r
)rr�r��xsrr
r
rr�s
zAndFamily._and_FACTORcCs@|jd|@}x,|jdd�D]}||jjkr0P||@}qW|S)Nrr)r^r$r�)rr�r�r
r
rrszAndFamily._and_IDcCs|j�||�S)N)rr)rr�r�r
r
rr'szAndFamily.c_lecCs\||@}|j|k	s&t|j�t|j�kr*dSx,|jD]"}x|jD]}||kr>Pq>WdSq2WdS)NFT)rr�r^)rr�r��x�yr
r
r�_le_TERMszAndFamily._le_TERMcCs|j�||�S)N)rr�)rr�r�r
r
rr-szAndFamily.c_gecCs x|jD]}||ksdSqWdS)NFT)r^)rr�r�r
r
r�_ge_TERM0szAndFamily._ge_TERMcCs|j�||�S)N)rr)rr�r�r
r
rr�8szAndFamily.c_orc
Cs�|jj}x�t|j�D]�\}}xzt|j�D]l\}}||B|kr*|�|jd|�|j|dd��}|�|jd|�|j|dd��}	||	kr*|Sq*WqW|j�||�S)Nr)r$r��	enumerater^r
r�)
rr�r�ZOmega�ir�jZbjZaaZbbr
r
rr;s
&&zAndFamily._or_ANDcCs|||kr|S||kr|Sg}xP|jD]"}||B}|jjrD|�|�q$Pq$W|jj}x|D]}||M}qZW|S|j�||�S)N)r^rr�r
r$r�r�)rr�r�rrZaibr�rr
r
rr�Hs

zAndFamily._or_TERMcCs&|jj}x|jD]}||O}qW|S)N)r$r�r^)rr�r�rr
r
rr�_szAndFamily.c_invertcCs x|jD]}||krdSqWdS)NFT)r^)rr�r�rr
r
rrfszAndFamily.c_containscCs,x&|jD]}|�||d�s|�d�SqWdS)Nr	ZFailedT)r^rOr�)rr�r�rIrr
r
rrMlszAndFamily.c_test_containscCs||@|jjkS)N)r$r�)rr�r�r
r
r�c_disjoint3rszAndFamily.c_disjoint3cCs,x|jD]}|��}|r|SqWdd�}|S)NcSstt|��S)N)�hex�id)�or
r
rr�{sz!AndFamily.c_get_render.<locals>.r)r^rL)r�cr�r�r
r
rrKuszAndFamily.c_get_rendercCs"dd�|jD�}dd�|�dS)NcSsg|]
}|j�qSr
)rZ)�.0r�r
r
r�
<listcomp>�sz)AndFamily.c_get_brief.<locals>.<listcomp>z(%s)z & �))r^�join)rr�namesr
r
rr<szAndFamily.c_get_briefcCs,|jj�dd�|jD��jdt|j�dfS)NcSsg|]
}|j�qSr
)r[)rrr
r
rr�sz'AndFamily.c_get_ckc.<locals>.<listcomp>)rz==)r$r��mker_andr^r�r�)rr�r
r
rrB�szAndFamily.c_get_ckccCsdd�|jD�}dd�|�S)NcSsg|]}t|��qSr
)r�)rrr
r
rr�sz$AndFamily.c_repr.<locals>.<listcomp>z(%s)z & )r^r!)rr��reprsr
r
rr3�szAndFamily.c_reprN)&rRrSrTr�r�r�rr
rHr�r�r�r�r�rr'rr�rr�rrr�rrr�rr�r�rr�rrMrrKr<rBr3r
r
r
rr	�s:	

r	c@seZdZdZdZdZdd�Zdd�Zdd�Zd	d
�Z	dd�Z
d
d�Zdd�Zdd�Z
e
ZZZdd�Zdd�Zdd�ZeZZZdd�Zdd�ZeZZZdd�Zdd �ZeZZZ d!d"�Z!d#d$�Z"d%d&�Z#d'd(�Z$d)d*�Z%d+d,�Z&d-d.�Z'd/d0�Z(d1d2�Z)d3S)4�OrFamily�ORFcCs&||kr|S||kr|S|�||f�S)N)r
)rr�r�r
r
rr�s
zOrFamily.__call__cCsbx$|D]}|jjst|jt�st�qWt|�dkrBt�|t|��St|�dkrV|dS|j	j
SdS)Nrr)rr�rr	�AssertionErrorr�r�rr�r$r�)rr^r�r
r
rr
�s
zOrFamily._conscCs x|jD]}||krdSqWdS)NTF)r^)rr�r�rr
r
rr�szOrFamily.c_containscCs|jjj|j�jt|j�dfS)N�<)r$�UseZfindexr^r�r�)rr�r
r
rrB�szOrFamily.c_get_ckcc	#sz�fdd�|jD�}x`d}xPt|�D]D\}}|dk	r$yt|�VWntk
r^d||<Yq$X|d7}q$W|sPqWdS)Ncsg|]}t��|���qSr
)�iterrJ)rr)rIr
rr�sz+OrFamily.c_get_examples.<locals>.<listcomp>rr)r^r�next�
StopIteration)rr�rIZexa�nrrr
)rIrrH�szOrFamily.c_get_examplescs��|j��fdd�d�S)Ncs��|�d�S)NzSome x)rO)r)r�rIr
rr#�rz*OrFamily.c_test_contains.<locals>.<lambda>r1)Zforsomer^)rr�r�rIr
)r�rIrrM�szOrFamily.c_test_containscCs&||jkr|�||�S|�||�SdS)N)r�_and_OR�	_and_TERM)rr�r�r
r
rr��s
zOrFamily.c_andcCs(|jj}x|jD]}|||@O}qW|S)N)r$r�r^)rr�r�r�r
r
rr/�szOrFamily._and_TERMcCs8|jj}x*|jD] }x|jD]}|||@O}qWqW|S)N)r$r�r^)rr�r�r�Zbir
r
rr.�s
zOrFamily._and_ORcCsF|jd}|j�||�}x(|jdd�D]}||j�||�O}q(W|S)Nrr)r^rr)rr�r�rr�r
r
rr�s

zOrFamily._and_IDcCsL||@}|j|kr@|j|jk	s2t|j�t|j�kr6dSdsHt�n||kSdS)NFr)rr�r^r')rr�r�r
r
rr�s
 
zOrFamily._ge_TERMcCs&|j|kr|�||�S|�||�SdS)N)rr'r)rr�r�r
r
rr�s
z
OrFamily.c_gecCs x|jD]}||ksdSqWdS)NFT)r^)rr�r�rr
r
rr'�sz
OrFamily.c_lecCs|j�||�S)N)rr�)rr�r�r
r
rr��sz
OrFamily.c_orcCsNg}d}x,|jD]"}||ks|�|�||krd}qW|sD|�|�|�|�S)NFT)r^r
r
)rr�r�r�ltr
r
rr��s

zOrFamily._or_TERMcCst|j|j�}|�|�S)N)�maximalsr^r
)rr�r�rr
r
rr�szOrFamily._or_ORcCs2|jd}x |jdd�D]}||M}qW|S)Nrr)r^)rr�r�rr
r
rr�szOrFamily.c_invertcCsP|j�dd�|jD��}t|�dkr0t|�dSdd�}d|_dd	�|_|SdS)
NcSsg|]}|���qSr
)rL)rr�r
r
rrsz)OrFamily.c_get_render.<locals>.<listcomp>rrcSstt|��S)N)rr)rr
r
rr�sz OrFamily.c_get_render.<locals>.r�AddresscSst|�S)N)r)rr
r
rr#rz'OrFamily.c_get_render.<locals>.<lambda>)r$�
mutnodesetr^r�r�r�r�)rrZrendersr�r
r
rrKs
zOrFamily.c_get_rendercCs*dd�|jD�}|��dd�|�dS)NcSsg|]
}|j�qSr
)rZ)rr�r
r
rr#sz(OrFamily.c_get_brief.<locals>.<listcomp>�(z | r )r^�sortr!)rrr"r
r
rr<"szOrFamily.c_get_briefcCsdS)NZBriefr
)rr�r
r
rr�'szOrFamily.c_get_idpart_headercCsdS)Nz<mixed>r
)rr�r
r
rr�*szOrFamily.c_get_idpart_labelcs.|jjj}|j��j�i����fdd�}|S)Ncsb��|�}��|�}|dkrJ��|�}��|�j}|��}||f}|�|<|\}}d|||�fS)Nz%s: %s)�classify�get�get_kindrZrL)rr�brr�r�r�)�brmemor�clir
rr�4s


z,OrFamily.c_get_idpart_render.<locals>.render)r$r)r|r�r;)rr�ror�r
)r:rr;rr�-s
zOrFamily.c_get_idpart_rendercs.|jjj}|j��j�i����fdd�}|S)Ncsp��|�}��|�}|dkrP��|�}��|�j}|j�|�}||f}|�|<n|\}}|dkrh||�}||fS)Nr�)r6r7r8rZrr�)rrr9r�r�r�)r:rr;r
rr�Ks



z0OrFamily.c_get_idpart_sortrender.<locals>.render)r$r)r|r�r;)rr�ror�r
)r:rr;rr�Ds
z OrFamily.c_get_idpart_sortrendercCs&dd�|jD�}|��dd�|�S)NcSsg|]}t|��qSr
)r�)rrr
r
rr\sz#OrFamily.c_repr.<locals>.<listcomp>z(%s)z | )r^r5r!)rr�r$r
r
rr3[szOrFamily.c_reprN)*rRrSrTr�r�r�rr
rrBrHrMr�r/r�r�r�r.rrr�rrrr'r�rr�r�r�r�rrr�r�rKr<r�r�r�r�r3r
r
r
rr%�s>	
r%c@s�eZdZdZdZdZdd�Zdd�Zdd	�Zd
d�Z	e	Z
dd
�ZeZZ
dd�Zdd�Zdd�Zdd�ZeZdd�Zdd�Zdd�ZeZZZdd�ZeZdd�ZeZZd d!�Zd"d#�Zd$d%�Z d&d'�Z!d(d)�Z"d*S)+�InvertFamilyZINVERTFTcCs0|jjst�||jjkr |jjSt�||�SdS)N)rr�r'r$r��
NotNothingr�r)rr�r
r
rrfszInvertFamily.__call__cCs|�|j|d�S)Nr<)Ztest_contains_notr^)rr�r�rIr
r
rrMmszInvertFamily.c_test_containscCs
||jkS)N)r^)rr�r�r
r
rrpszInvertFamily.c_containscCs|j�||�S)N)rr�)rr�r�r
r
rr�sszInvertFamily.c_andcCs(|j|@}|jjr||�}|j�||�S)N)r^rr�r$r�)rr�r�rr
r
rr�xs
zInvertFamily._and_FACTORcCs|||j@S)N)r^)rr�r�r
r
rr�szInvertFamily._and_IDcCs
||jkS)N)r^)rr�r�r
r
rr��sz!InvertFamily._factordisjoint_ATOMcCsdS)NFr
)rr�r�r
r
rr��sz#InvertFamily._factordisjoint_INVERTcCs|j�||�S)N)rr)rr�r�r
r
rr'�szInvertFamily.c_lecCsdS)NFr
)rr�r�r
r
rr��szInvertFamily._le_ATOMcCs|j|jkS)N)r^)rr�r�r
r
rr�szInvertFamily._le_INVERTcCs|j�|�S)N)r^rG)rr�r�r
r
rr�szInvertFamily.c_gecCs|j�||�S)N)rr)rr�r�r
r
rr��szInvertFamily.c_orcCs<|j|kr|jjS|j|@}||jjkr.|S|j�||�S)N)r^r$r�r�)rr�r�rr
r
r�
_or_FACTOR�s


zInvertFamily._or_FACTORcCs|jS)N)r^)rr�r
r
rr��szInvertFamily.c_invertcCs
|j��S)N)r^rL)rr�r
r
rrK�szInvertFamily.c_get_rendercCs4|jj}|�d�s,|�d�s,d|kr,d|}d|S)Nr4r(� z(%s)z~%s)r^rZ�
startswith)rr�r-r
r
rr<�s
zInvertFamily.c_get_briefcCs|jjjddfS)Nrz!=)r^r[r�)rr�r
r
rrB�szInvertFamily.c_get_ckccCsdt|j�S)Nz~%s)r�r^)rr�r
r
rr3�szInvertFamily.c_reprN)#rRrSrTr�r�r�rrMrr�r�r�r�r�rr�r�r'r�r�rrr�rrr�rr>r�rr�rKr<rBr3r
r
r
rr<as8		
r<c@s$eZdZdd�Zdd�Zdd�ZdS)�FamilyFamilycCs t�||�|�ddd��dS)N�unioncSs
|j��S)N)r^r�)rr
r
rr#�rz'FamilyFamily.__init__.<locals>.<lambda>)r�r_r�)rr$r
r
rr_�szFamilyFamily.__init__cCst|t�o|j|jkS)N)rrrr^)rr�r�r
r
rr�szFamilyFamily.c_containscCsd|jjS)Nz<Family: %s>)r^r�)rrr
r
rr<�szFamilyFamily.c_get_briefN)rRrSrTr_rr<r
r
r
rrA�srAc@sFeZdZdd�Zdd�ZdHdd�Zdd	�Zd
d�Zdd
�Zdd�Z	dd�Z
dd�Zdd�Zdd�Z
dd�Zdd�Zdd�ZeZZZdd�ZeZZZZd d!�Zd"d#�Zd$d%�Zd&d'�Zd(d)�Zd*d+�Zd,d-�Zd.d/�Z d0d1�Z!d2d3�Z"d4d5�Z#d6d7�Z$d8d9�Z%d:d;�Z&d<d=�Z'd>d?�Z(dId@dA�Z)dJdBdC�Z*dDdE�Z+dFdG�Z,dS)K�IdentitySetFamilycCsLt�||�|�|j�|j|_|j|_|j|_|j|_|j|_|j	|_	dS)N)
r�r_r�ZAnythingr��Partrtrmr%r))rr$r
r
rr_�szIdentitySetFamily.__init__cOs|j|f|�S)N)r
)rrrr
r
rr�szIdentitySetFamily.__call__NcCs2|�|�}|s|jjSt||�}|dk	r.||_|S)N)r�r$r�r�rd)rr^ror�r
r
rr
�s

zIdentitySetFamily._conscCsH|j|kr|�|j|j@�S|j|jjkr6|�||�S|j�||�SdS)N)rr
r�r$r�r�r)rr�r�r
r
rr��s

zIdentitySetFamily.c_andcCs.|j|kr|�|j|j@�S|j�||�SdS)N)rr
r�r)rr�r�r
r
rr��s
zIdentitySetFamily._and_ATOMcCs|j�||�S)N)rr)rr�r�r
r
rr�szIdentitySetFamily._and_ANDcCs|�|j|j@�S)N)r
r�)rr�r�r
r
rrszIdentitySetFamily._and_IDcCsB|jj|kr |�|j|jj�S||jjkr0|S|j�||�SdS)N)r^rr
r�r$r=r)rr�r�r
r
rr�
s
zIdentitySetFamily._and_INVERTcCs|jjjj|jdfS)Nz<=)r$r�r}r�r�)rr�r
r
rrBszIdentitySetFamily.c_get_ckccCs
t|j�S)N)r�r�)rr�r
r
rrszIdentitySetFamily.c_hashcCstd��dS)Nziteration over non-sequence)r�)rr�r
r
rrkszIdentitySetFamily.c_itercCs|jjS)N)r�Znumrows)rr�r
r
rriszIdentitySetFamily.c_lencCs
||jkS)N)r�)rr�r�r
r
rr%szIdentitySetFamily.c_containscCs$|j|k	r|j�||�}|j|jkS)N)rrr�)rr�r�r
r
rr'(s
zIdentitySetFamily.c_lecCs@|j|kr|�|j|jB�S||j�||�}|j�||�SdS)N)rr
r�rr�)rr�r�r
r
rr�/s
zIdentitySetFamily.c_orcCs
|�|�S)N)�get_str_summary)rrr
r
rr<8szIdentitySetFamily.c_get_briefcCs
|j��S)N)r�rL)rr�r
r
rrK;szIdentitySetFamily.c_get_rendercCs|j�|�S)N)r�Zget_set)rr�rgr
r
rrf>szIdentitySetFamily.c_getitemcCs,|jjj��}|j�|��|�|����S)N)	r$r��OutputHandlingZ
output_bufferrr�Zppob�getvalue�rstrip)rr�Zobr
r
rr5AszIdentitySetFamily.c_strc	CsZ|j��}x<|jD]2}yt||�}Wntk
r8YqX|�|�qW|�|j�|��S)N)r$r3r�r�r��addr
r�)rr�r��nsr�vr
r
rr�Fs
z IdentitySetFamily.maprox_getattrc
Cs\|j��}x>|jD]4}y||}Wnttfk
r:YqX|�|�qW|�|j�|��S)N)r$r3r��KeyError�
IndexErrorrIr
r�)rr�rgrJrrKr
r
rr�Qs
z IdentitySetFamily.maprox_getitemcCsdS)NzKind: Name/Value/Addressr
)rr�r
r
rr�\sz%IdentitySetFamily.c_get_idpart_headercCsdS)Nrr
)rr�r
r
rr�_sz$IdentitySetFamily.c_get_idpart_labelcs�fdd�}|S)Ncs"�j�|�}|j�d��d�}|S)Nz<1 �>)r$r�rZ�lstriprH)rr�)rr
rr�csz5IdentitySetFamily.c_get_idpart_render.<locals>.renderr
)rr�r�r
)rrr�bsz%IdentitySetFamily.c_get_idpart_renderc	Csg}t|t�r|�|�n�y|�d�}Wntk
rDtd��YnX|dgkrTg}xb|D]Z}y*|��rr|�d�rzd|}t|j	|�}Wn t
k
r�td|��YnX|�|�qZW|s�|j	j}n,|d}x"t
dt|��D]}|||M}q�W|j|k	�r|j|j|d�}|S)	N�&z.by(): Equivalence relation or string expected.rZer_z;by(): No such equivalence relation defined in heapy.Use: %rrr)ro)rr�r
�split�	Exceptionr��istitler@r�r)r�r�r�ranger�ror
r�)rr�ro�ersZss�srr
r
rrwis6



zIdentitySetFamily.get_bycCs4y
|j}Wn$tk
r.|jjj}||_YnX|S)N)rdr�r$r)r|)rr�ror
r
rr��s

zIdentitySetFamily.get_ercCs|jj�||j�S)N)r$rFZbasic_more_printerr�)rr�r
r
rr��szIdentitySetFamily.get_morecCs|jjjj�|�S)N)r$r)r|r�r�)rr�r
r
rr��szIdentitySetFamily.get_ownerscCsHy
|j}Wn8tk
rB|jj��|jj�||j�}||_YnX|S)N)rer�rr%Zclear_checkrDr�ro)rr��pr
r
rr��s
zIdentitySetFamily.get_partitioncCs|j�||�}|S)N)rr�)rr�rrVr
r
r�get_str_idpart�sz IdentitySetFamily.get_str_idpartcCs�g}|�d|j�|�|j�||��|�d�|�|�|||td�|����d�|�}t|�|kr~|d|d�d}|S)Nz%d z: r�z...)r
r�rr��get_str_renderedr�r!)rr�r�
max_length�strsrVr
r
r�get_str_refpat�s

z IdentitySetFamily.get_str_refpatc	Cs�|dkrd}g}d}|��}xZ|jD]P}||�}|rZ|t|�d|krZ|dd7<P|t|�d7}|�|�q$W|��d�|�S)N�2r����z...z, )rLr�r�r
r5r!)	rr�rr[r\Zlensr�rWZrsr
r
rrZ�sz"IdentitySetFamily.get_str_renderedcCs2|dkr|jj}|dkr|j}|j}|j�|�}dd�|D�}tdd�|�}dt|�|j�	||�f}|d7}t|�}	g}
xb|D]Z\}}|�
||||	�}t|�dkr�d|j||f}|
�|�|	t|�d	7}	|	|kr�Pq�Wt|
�dkr�|
j
d
d�d�|d�|
�d
7}t|�|k�r.|d|d�d}|S)NcSsg|]\}}|�qSr
r
)rrrKr
r
rr�sz5IdentitySetFamily.get_str_summary.<locals>.<listcomp>cSs||BS)Nr
)rrr
r
rr#�rz3IdentitySetFamily.get_str_summary.<locals>.<lambda>z<%d %sz: rz<%d %s: %s>rYcSs||�d�d�S)Nr?)�index)rr
r
rr#�r)�keyz | rN�z...>)r$�max_summary_lengthror�r�r�rr�rr�rZr�r
r5r!)rrr[ror��items�keysrrVZbslenZbstrsZcssr
r
rrE�s4
z!IdentitySetFamily.get_str_summarycCsdd�|j��D�S)NcSsg|]}|�qSr
r
)rrr
r
rr�sz/IdentitySetFamily.get_parts.<locals>.<listcomp>)r�Zget_sets)rr�r
r
rr��szIdentitySetFamily.get_partscCs(t|j�dkrt|j�dStd��dS)Nrrztheone requires a singleton set)r�r�r�r�)rr�r
r
rr��szIdentitySetFamily.get_theone)N)N)NN)-rRrSrTr_rr
r�r�r�rr�rBrrkrirr'r�rr�r�r�rrr�r<rKrfr5r�r�r�r�r�rwr�r�r�r�rXr]rZrEr�r�r
r
r
rrC�sJ
 	

rCc@s�eZdZdd�Zdd�ZeZZZZZ	dd�Z
dd�ZeZZ
Zd	d
�Zdd�Zd
d�Zdd�ZeZZZdd�Zdd�Zdd�ZeZZZZdd�Zdd�Zdd�ZdS)�EmptyFamilycCst�||�dS)N)rCr_)rr$r
r
rr_�szEmptyFamily.__init__cCs|S)Nr
)rr�r�r
r
rr��szEmptyFamily.c_andcCsdS)NFr
)rr�r�r
r
rr�szEmptyFamily.c_containscCs||krdSdS)NTFr
)rr�r�r
r
rr�szEmptyFamily.c_gecCsdS)Nz	<Nothing>r
)rr�r
r
rr<szEmptyFamily.c_get_briefcCsd|jjjdfS)Nz%s%sr�)r$r)Zreprefix)rr�r
r
rr3szEmptyFamily.c_reprcCstd�S)Nr
)r*)rr�r
r
rrkszEmptyFamily.c_itercCsdS)NTr
)rr�r�r
r
rr'szEmptyFamily.c_lecCsdS)Nrr
)rr�r
r
rriszEmptyFamily.c_lencCsdS)NFr
)rr�r
r
rr/szEmptyFamily.c_nonzerocCs|S)Nr
)rr�r�r
r
rr�szEmptyFamily.c_orcCs
|�|�S)N)r<)rr�r
r
rr5szEmptyFamily.c_strcCs|S)Nr
)rr�r�r
r
rr7!szEmptyFamily.c_subcCs|S)Nr
)rr�r�r
r
rr:$szEmptyFamily.c_xorN) rRrSrTr_r�r�r�r�r.rrrr�rrr<r3rkr'r�rr�rir/r�r�rrr�r5r7r:r
r
r
rrg�s$rgc@sdeZdZdd�Zdd�Zdd�Zdd�Zd	d
�Zdd�Zd
d�Z	dd�Z
dd�Zdd�Zdd�Z
dS)�EquivalenceRelationFamilycCs&t�||�t|_|j|_|j|_dS)N)r�r_r�r�r)r�)rr$r
r
rr_)sz"EquivalenceRelationFamily.__init__cOs |||�}|�||�}||_|S)N)r�ro)r�constructorrrZclror
r
rr/s
z"EquivalenceRelationFamily.__call__cCshyt|�|��dkStk
rby|��}Wntk
rBdSX|dj|ko\|ddkSYnXdS)NrFrr_z==)r�rxr�rCrRro)rr�r�Zckcr
r
rr7sz$EquivalenceRelationFamily.c_containscCs:|j}yt|d�}Wntk
r0t|��YnX||�S)NZget_attr_for_er)r�r�r�)rr�r�r��gr
r
rr"Csz#EquivalenceRelationFamily.c_getattrcCs�|j|k	rt�|||�Sg}x.||fD]"}|jr>|�|j�q&|�|�q&Wt|�}t|�dkrh|dS|j�	|�}t
|�|_|S)Nrr)rr�r�r��extendr
�minimalsr�r�r#r�)rr�r�rUrror
r
rr�Ks

zEquivalenceRelationFamily.c_andcCs|j|kr|j|jjkSdS)NF)rr��super_classifiers)rr�r�r
r
rr�[s
z"EquivalenceRelationFamily._ge_ATOMcCs|j|kr|j|jjkSdS)NF)rr�rm)rr�r�r
r
rr�`s
z"EquivalenceRelationFamily._le_ATOMcCs|jj||�S)N)r�Zget_userkind)rr�rrr
r
rresz EquivalenceRelationFamily.c_callcCs
d|jS)NzEquiv. relation %s)r�)rr�r
r
rr<hsz%EquivalenceRelationFamily.c_get_briefcCs|j�|j�|��S)N)r�Zrelimgr$�
nodeset_adapt)rr�rgr
r
rrfksz#EquivalenceRelationFamily.c_getitemcCs
|j��S)N)r�Zget_reprname)rr�r
r
rr3nsz EquivalenceRelationFamily.c_reprN)rRrSrTr_rrr"r�r�r�rr<rfr3r
r
r
rrh(srhc@s�eZdZdd�Zd/dd�Zdd�Zdd	�Zd
e_ee_	dd�Z
d
e
_ee
_	dd�Zde_dd�Zde_dd�Z
de
_dd�Zde_dd�Zde_dd�Zde_dd �Zde_d!d"�Zd#e_d$e_	eZd%d&�Zd'e_d0d(d)�Zde_d*d+�Zd,d-�e_d.S)1�Summary_strc&Cs8||_|jj}i|_x2t|j���D] \}}t|t�r$d||j|<q$Wx.t|j	���D]\}}t|t�rX||j|<qXWi|_
x(dD] }t||��d�}||j
|<q�W|j
|jt|j|j|j|j|jt|jt|jt|j|j|j|j|jt|jt|jtd�|j|j|j|j |j!|j"|j#t$|j%t&|j%t'|jt|j(i|_)dS)Nztypes.%s)�module�functionr~)*r$r��_module�invtypes�sorted�__dict__rer�type�__builtins__�shorter_invtypesr��
capitalize�NodeSet�str_address_len�bool�str_repr�BuiltinFunctionType�str_builtin_function�CodeType�str_code�complex�dict�float�	FrameType�	str_frame�FunctionType�str_function�intr��
MethodType�
str_method�
ModuleType�
str_module�
TracebackType�
str_traceback�bytes�str_limrepr�strr��str_type�table)rr$r�rrKr�r�r
r
rr_ss@



zSummary_str.__init__FcsT|j�|���dkr,t|t�r&|j�n|j��rLd�jjjkrL��fdd�S�SdS)N�longercs�|�d�S)N)r�r
)r)r�rr
rr#�rz&Summary_str.__call__.<locals>.<lambda>)	r�r7�
issubclassrvr�r��__func__�__code__�co_varnames)rrbr�r
)r�rrr�s
zSummary_str.__call__cCs||j|<dS)N)r�)rrv�funcr
r
r�set_function�szSummary_str.set_functioncCstt|��S)N)rr)rrr
r
rr��szSummary_str.str_addressr2cCs|�|�|�|�S)N)r��str_len)rrr
r
rr{�szSummary_str.str_address_lenzAddress*LengthcCs$|j}|j}|dkr d||f}|S)N�builtinsz%s.%s)rRrS)rrr-�mr
r
rr�s
z Summary_str.str_builtin_function�NamecCs"d|jjjj�|j�|j|jfS)Nz%s:%d:%s)r$r>�os�path�basename�co_filename�co_firstlineno�co_name)rrr
r
rr��szSummary_str.str_codezFile:Line:NamecCsd|jj|�|�fS)Nz
<%s at %s>)�f_coder�r�)rrr
r
rr��szSummary_str.str_framezName at AddresscCsd|j|jfS)Nz%s.%s)rSrR)rrr
r
rr��szSummary_str.str_functioncCsdt|�S)Nz*%d)r�)rrr
r
rr��szSummary_str.str_lenZLengthcCsd|�|jj�}|jdk	r,d||�|j�f}|j}y
|j}Wntk
rV|j}YnXd||fS)Nz
<%s at %s>z%s.%s)r��__self__r�r�r�r�rR)rrZcnr�Z	func_namer
r
rr��s

zSummary_str.str_methodzType/<Type at address> . methodcCs|jS)N)rR)rrr
r
rr��szSummary_str.str_modulecCs|jjj�|�S)N)r$r>�reprlibr�)rrr
r
rr��szSummary_str.str_limreprzRepresentation (limited)r�cCsd|�|j�|�|�fS)Nz<in frame %s at %s>)r��tb_framer�)rrr
r
rr��szSummary_str.str_tracebackzFrame at AddresscCs<||jkr|s|j|S||jkr,|j|Sd|j|jfS)Nz%s.%s)rxrsrSrR)rrr�r
r
rr��s



zSummary_str.str_typecCs$||jkr|j|Sd|j|jfS)Nz%s.%s)rsrSrR)rrr
r
r�str_type_longer�s

zSummary_str.str_type_longercCstS)N)r�)rr
r
rr#�rzSummary_str.<lambda>N)F)F)rRrSrTr_rr�r�r�rr�r{rr�r�r�r�r�r�r�r�r}r�r�r�Z_longer_methodr
r
r
rrorsB)


rocCs||kS)Nr
)rrr
r
rr#�rr#cCs^g}xT|D]L}xF|D]}|||�r|||�sPqWx"|D]}|||�r8Pq8W|�|�q
W|S)z< Find the maximal element(s) of a partially ordered sequence)r
)�A�ler�rr�r
r
rr1�s



r1cCs||kS)Nr
)rrr
r
rr#rcCs^g}xT|D]L}xF|D]}|||�r|||�sPqWx"|D]}|||�r8Pq8W|�|�q
W|S)zH Find the minimal element(s) of a sequence of partially ordered elements)r
)r�r�r�rr�r
r
rrls



rlc@s�eZdZdZdZdZdZdZdZdd�Z	d	d
�Z
dd�Zd
d�Zdd�Z
dd�Zdd�Zdd�Zdd�Zdd�Zdd�Zdd�Zdd �Zd!d"�Zd2d$d%�Zd&d'�Zd(d)�Zd*d+�Zd,d-�Zd3d.d/�Zd0d1�Zd#S)4�_GLUECLAMP_�PTF)rr%rtrm)rd�out_reach_module_names�auto_convert_type�auto_convert_iter�output)z_parent:Classifiersz_parent:ImpSetz_parent.ImpSet:emptynodesetz_parent.ImpSet:immnodesetz_parent.ImpSet:mutnodesetz_parent.ImpSet:NodeSetz_parent:Partz_parent:Pathz_parent:RefPatz_parent:OutputHandlingz_parent:Viewz_parent.View:_hiding_tag_z_parent.View:hvz_parent:Usez_root:typescCs|jjj�d�S)N)r)rr�r8)rr
r
r�
_get_Anything9rz_GLUECLAMP_._get_AnythingcCstt|�|j�S)N)r�rgZemptynodeset)rr
r
r�_get_Nothing:sz_GLUECLAMP_._get_NothingcCst�|j|j�S)N)r�rr�r�)rr
r
r�_get_NotNothing<sz_GLUECLAMP_._get_NotNothingcCsti}xjt|j���D]X\}}t|dd�}xB|D]:}t||�}||kr`|||k	r`td||f��|||<q.WqW|S)NZ_uniset_exportsr
z#Duplicate export: %r defined in: %r)r�Zout_reach_dictrer��RuntimeError)rr�rrKr�rr
r
r�_get_export_dict?s

z_GLUECLAMP_._get_export_dictcCs(i}x|jD]}t|j|�||<qW|S)N)r�r�r�)rr�r�r
r
r�_get_out_reach_dictKsz_GLUECLAMP_._get_out_reach_dictcCs
|�|�S)N)ro)rr
r
r�_get_summary_strQrz_GLUECLAMP_._get_summary_strcCs
|�|�S)N)r	)rr
r
r�_get_fam_AndSrz_GLUECLAMP_._get_fam_AndcCst|�S)N)rh)rr
r
r�_get_fam_EquivalenceRelationTsz(_GLUECLAMP_._get_fam_EquivalenceRelationcCs
|�|�S)N)r%)rr
r
r�_get_fam_OrWrz_GLUECLAMP_._get_fam_OrcCs
|�|�S)N)rC)rr
r
r�_get_fam_IdentitySetXrz _GLUECLAMP_._get_fam_IdentitySetcCs
|�|�S)N)r<)rr
r
r�_get_fam_InvertYrz_GLUECLAMP_._get_fam_InvertcCs
|�|�S)N)rA)rr
r
r�_get_fam_FamilyZrz_GLUECLAMP_._get_fam_Familycsi���fdd�}|S)NcsJ����}|dkr:G�fdd�d��j�}�j|_|��<|�f|�|�S)NcseZdZ�fdd�ZdS)z8_GLUECLAMP_._get_fam_mixin_argatom.<locals>.f.<locals>.Ccs&|j�||��j||f|�|�dS)N)rr_)rr$rr)�Mixinr
rr_cszA_GLUECLAMP_._get_fam_mixin_argatom.<locals>.f.<locals>.C.__init__N)rRrSrTr_r
)r�r
r�Cbsr�)r7rrR)r�rrr�)�memor)r�r�f_s
z-_GLUECLAMP_._get_fam_mixin_argatom.<locals>.fr
)rr�r
)r�rr�_get_fam_mixin_argatom\sz"_GLUECLAMP_._get_fam_mixin_argatomcCsRt||j�r|}n(t||j�r*|�|�}ntdt|���|j|jk	rNtd��|S)Nz(IdentitySet or NodeSet expected, got %r.zPThe argument has wrong _hiding_tag_, you may convert it by Use.idset or Use.iso.)rrcrz�idsetr�rvrr�)rr�Zidsr
r
r�idset_adaptlsz_GLUECLAMP_.idset_adaptNcCs|jj|�|�|d�S)N)ro)�fam_IdentitySetr
r�)r�iterableror
r
rr�ysz_GLUECLAMP_.idsetcCs|jS)N)r�)rr
r
r�_get_iso|sz_GLUECLAMP_._get_isocCst||j�S)N)rr)r�objr
r
r�isunisetsz_GLUECLAMP_.isunisetcCsNt||j�r|}n$t||j�r&|j}ntdt|���|j|jk	rJtd��|S)Nz(IdentitySet or NodeSet expected, got %r.zPThe argument has wrong _hiding_tag_, you may convert it by Use.idset or Use.iso.)rrzrcr�r�rvrr�)rr�rJr
r
rrn�sz_GLUECLAMP_.nodeset_adaptcCst||j�s|�|�}|S)N)rrcr�)rr�r
r
r�retset�s
z_GLUECLAMP_.retsetcCs@|s
|jS|d}x|dd�D]}||O}q W|S|j�|�S)Nrr)r�r1r�r
)rrZ	maximizedr�r�r
r
rrB�sz_GLUECLAMP_.unioncCs�t|t�r|j|jkr|S|j}t|t�r<|jr<|j�|�St||j�r^|j|jkr^|�	|�S|j
r�yt|�}Wntk
r�YnX|�	|�Std��dS)NzPArgument is not automatically convertible to a UniSet with correct _hiding_tag_.)
rrrr�rvr�r)r~rzr�r�r*r�)rr�r��itr
r
rr��s

z#_GLUECLAMP_.uniset_from_setcastable)N)F)rRrSrTrdr�r�r�Z	_chgable_Z	_imports_r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�rnr�rBr�r
r
r
rr�s6


r�N)�	functoolsrZguppy.etc.Descriptorrr�rr]rcr�r�r�r�r�r�rr	r%r<rArCrgrhror1rlr�r
r
r
r�<module>s@6

,6T@Rl=J

Youez - 2016 - github.com/yon3zu
LinuXploit