grthtrhthjhtyjytjytkergtrhtrjytjerhrfh4:24 29/09/2026î ¤ f±ã @sñdZdddddgZiZddd„Zdd„ZyeWnek rXYnXd d „Zeeeeƒd d „ZdZ dd„Z dd„Z dd„Z dd„Z iZiZiZdd„Zdd„Zdd„ZdS)z¤Helper to provide extensibility for pickle. This is only useful to add pickle support for extension types defined in C, not for instances of user-defined classes. ÚpickleÚ constructorÚ add_extensionÚremove_extensionÚclear_extension_cacheNcCsBt|ƒstdƒ‚n|t|<|dk r>t|ƒndS)Nz$reduction functions must be callable)ÚcallableÚ TypeErrorÚdispatch_tabler)Úob_typeÚpickle_functionÚconstructor_ob©r ú,/opt/alt/python34/lib64/python3.4/copyreg.pyr s    cCst|ƒstdƒ‚ndS)Nzconstructors must be callable)rr)Úobjectr r r rs cCst|j|jffS)N)ÚcomplexÚrealÚimag)Úcr r r Úpickle_complex"srcCsY|tkrtj|ƒ}n7|j||ƒ}|jtjkrU|j||ƒn|S)N)rÚ__new__Ú__init__)ÚclsÚbaseÚstateÚobjr r r Ú_reconstructor)s  réé cCs=|dkst‚x;|jjD]'}t|dƒr|jt@ rPqqWt}|tkred}n1||jkrŠtd|jƒ‚n||ƒ}|j||f}y |j }Wn[t k rt |ddƒrætdƒ‚ny |j }Wnt k r d}YnXYn X|ƒ}|r/t ||fSt |fSdS)NéÚ __flags__zcan't pickle %s objectsÚ __slots__zNa class that defines __slots__ without defining __getstate__ cannot be pickled)ÚAssertionErrorÚ __class__Ú__mro__ÚhasattrrÚ _HEAPTYPErrÚ__name__Ú __getstate__ÚAttributeErrorÚgetattrÚ__dict__r)ÚselfÚprotorrÚargsÚgetstateÚdictr r r Ú _reduce_ex6s0         r/cGs|j||ŒS)N)r)rr,r r r Ú __newobj__Wsr0cCs|j|||ŽS)zUsed by pickle protocol 4, instead of __newobj__ to allow classes with keyword-only arguments to be pickled correctly. )r)rr,Úkwargsr r r Ú __newobj_ex__Zsr2c Cs|jjdƒ}|dk r"|Sg}t|dƒs:nºx·|jD]¬}d|jkrD|jd}t|tƒr�|f}nxl|D]a}|dkr qˆqˆ|jdƒrÜ|jdƒ rÜ|jd|j |fƒqˆ|j|ƒqˆWqDqDWy ||_ WnYnX|S) a›Return a list of slot names for a given class. This needs to find slots defined by the class and its bases, so we can't simply return the __slots__ attribute. We must walk down the Method Resolution Order and concatenate the __slots__ of each class found there. (This assumes classes don't modify their __slots__ attribute to misrepresent their slots after the class is defined.) Ú __slotnames__Nrr)Ú __weakref__Ú__z_%s%s)z__dict__z __weakref__) r)Úgetr#r"Ú isinstanceÚstrÚ startswithÚendswithÚappendr%r3)rÚnamesrÚslotsÚnamer r r Ú _slotnames`s,       r?cCsÛt|ƒ}d|ko#dkns7tdƒ‚n||f}tj|ƒ|krqtj|ƒ|krqdS|tkrštd|t|fƒ‚n|tkrÃtd|t|fƒ‚n|t|<|t|ÚcodeÚkeyr r r ržs     cCsw||f}tj|ƒ|ks6tj|ƒ|krOtd||fƒ‚nt|=t|=|tkrst|=ndS)z0Unregister an extension code. For testing only.z%key %s is not registered with code %sN)rBr6rCrAÚ_extension_cache)rDr>rErFr r r r°s  cCstjƒdS)N)rGÚclearr r r r r¼si)Ú__doc__Ú__all__rrrrÚ NameErrorrrr$r/r0r2r?rBrCrGrrrr r r r Ús.     !   8