Prv8 Shell
Server : Apache
System : Linux server.mata-lashes.com 3.10.0-1160.90.1.el7.x86_64 #1 SMP Thu May 4 15:21:22 UTC 2023 x86_64
User : matalashes ( 1004)
PHP Version : 8.1.29
Disable Function : NONE
Directory :  /usr/local/lib64/python3.6/site-packages/pyrsistent/__pycache__/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : //usr/local/lib64/python3.6/site-packages/pyrsistent/__pycache__/_field_common.cpython-36.pyc
3

G�Kd
-�@slddlZddlmZmZmZmZmZmZmZm	Z	m
Z
ddlmZddlm
Z
ddlZejddkZdd�Zdd	�Zd
d�Zdd
�Zdd�Zdd�ZGdd�de�ZfZdd�Zdd�Ze�Zdd�Zeeedeefdd�Zdd�ZGdd�de �Z!eded iZ"iZ#d!d"�Z$d#d$�Z%d%d&�Z&d'd(�Z'dffd)d*�Z(dffd+d,�Z)d-d�Z*iZ+d.d/�Z,d0d1�Z-defd2d3�Z.dS)4�N)	�CheckedPMap�CheckedPSet�CheckedPVector�CheckedType�InvariantException�_restore_pickle�get_type�maybe_parse_user_type�maybe_parse_many_user_types)�optional)�wrap_invariant�csZtt�fdd�|D�g��|�<x4t|j��D]$\}}t|t�r.||�|<||=q.WdS)Ncs"g|]}t|jj�i�j���qS�)�list�__dict__�get�items)�.0�b)�namer�>/tmp/pip-build-8nxjc3nm/pyrsistent/pyrsistent/_field_common.py�
<listcomp>szset_fields.<locals>.<listcomp>)�dict�sumrr�
isinstance�_PField)�dct�basesr�k�vr)rr�
set_fieldss
 
r cs4tdd��fdd�|D�D��}|r0t|fd��dS)Ncss|]\}}|s|VqdS)Nr)rZis_okZ
error_coderrr�	<genexpr>sz*check_global_invariants.<locals>.<genexpr>c3s|]}|��VqdS)Nr)r�	invariant)�subjectrrr! szGlobal invariant failed)�tupler)r#Z
invariantsZerror_codesr)r#r�check_global_invariantssr%cCs&t|t�r|tkr|j|�S|||�S)N)rr�PFIELD_NO_SERIALIZER�	serialize)�
serializer�format�valuerrrr'%s
r'csP|jrLt�fdd�|jD��rLt��}dj|j||j�}t|||j||��dS)Nc3s|]}t�t|��VqdS)N)rr)r�t)r*rrr!-szcheck_type.<locals>.<genexpr>z'Invalid type for field {0}.{1}, was {2})�type�anyr)�__name__�
PTypeError)Zdestination_cls�fieldrr*�actual_type�messager)r*r�
check_type,s r3cCs:t|�tkrdSt|�}t|�dkr(dStt|d�|�S)NTrF)r,�setr$�len�
issubclassr)�type_clsZ
field_type�typesrrr�is_type_cls3sr9cCsD|sdSt||j�sdStr.dtj|j�jkSdtj|j�jkSdS)NF�ignore_extra)	r9r,�PY2�inspectZ
getargspec�factory�args�	signatureZ
parameters)r7r0r:rrr�is_field_ignore_extra_complaint<sr@c@s$eZdZdZdd�Zed	d
��ZdS)
rr,r"�initial�	mandatory�_factoryr(cCs(||_||_||_||_||_||_dS)N)r,r"rArBrCr()�selfr,r"rArBr=r(rrr�__init__Nsz_PField.__init__cCs@|jtkr:t|j�dkr:tt|j�d�}t|t�r:|jS|jS)N�r)	rC�PFIELD_NO_FACTORYr5r,rr$r6r�create)rD�typrrrr=Vs

z_PField.factoryN)r,r"rArBrCr()r.�
__module__�__qualname__�	__slots__rE�propertyr=rrrrrKsrcCsdS)NT)TNr)�_rrr�<lambda>asrOcCs|S)Nr)�xrrrrObscCs|S)Nr)rNr*rrrrOdsFc	Csft|tttf�rtt|��}ntt|��}|tkrBt|�rBt|�n|}t	||||||d�}t
|�|S)a
    Field specification factory for :py:class:`PRecord`.

    :param type: a type or iterable with types that are allowed for this field
    :param invariant: a function specifying an invariant that must hold for the field
    :param initial: value of field if not specified when instantiating the record
    :param mandatory: boolean specifying if the field is mandatory or not
    :param factory: function called when field is set.
    :param serializer: function that returns a serialized version of the field
    )r,r"rArBr=r()rrr4r$r
r	�PFIELD_NO_INVARIANT�callablerr�_check_field_parameters)	r,r"rArBr=r(r8Zinvariant_functionr0rrrr0gsr0cs�x8�jD].}t|t�rt|t�rtdjt|����qW�jtk	r�t�j�r��jr�t�fdd��jD��r�tdjt�j����t�j	�s�td��t�j
�s�td��t�j�s�td��dS)Nz Type parameter expected, not {0}c3s|]}t�j|�VqdS)N)rrA)rr+)r0rrr!�sz*_check_field_parameters.<locals>.<genexpr>zInitial has invalid type {0}zInvariant must be callablezFactory must be callablezSerializer must be callable)r,r�str�	TypeErrorr)rA�PFIELD_NO_INITIALrRr-r"r=r()r0r+r)r0rrS�s
 


rScs eZdZdZ�fdd�Z�ZS)r/a
    Raised when trying to assign a value with a type that doesn't match the declared type.

    Attributes:
    source_class -- The class of the record
    field -- Field name
    expected_types  -- Types allowed for the field
    actual_type -- The non matching type
    cs.tt|�j||�||_||_||_||_dS)N)�superr/rE�source_classr0�expected_typesr1)rDrXr0rYr1r>�kwargs)�	__class__rrrE�s
zPTypeError.__init__)r.rJrK�__doc__rE�
__classcell__rr)r[rr/�s	r/ZPVectorZPSetcCst||f}t||�S)z=Unpickling function for auto-generated PVec/PSet field types.)�_seq_field_typesr)�
checked_class�	item_type�data�type_rrr�_restore_seq_field_pickle�srccCsdjdd�|D��S)z4Convert a tuple of types to a human-readable string.�css|]}t|�jj�VqdS)N)rr.�
capitalize)rrIrrrr!�sz"_types_to_names.<locals>.<genexpr>)�join)r8rrr�_types_to_names�srgcsXtj��f�}|dk	r|SG��fdd�d��}t�}t|j�||_|t��f<|S)zFCreate a subclass of the given checked class with the given item type.NcseZdZ�Z��fdd�ZdS)z%_make_seq_field_type.<locals>.TheTypecst��t|�ffS)N)rcr)rD)r_r`rr�
__reduce__�sz0_make_seq_field_type.<locals>.TheType.__reduce__N)r.rJrKZ__type__rhr)r_r`rr�TheType�sri)r^r�SEQ_FIELD_TYPE_SUFFIXESrgZ_checked_typesr.)r_r`rbri�suffixr)r_r`r�_make_seq_field_type�srlcsDt||��|rd�fdd�	}n�j}t|r2t��n�|d||�d�S)a�
    Create checked field for either ``PSet`` or ``PVector``.

    :param checked_class: ``CheckedPSet`` or ``CheckedPVector``.
    :param item_type: The required type for the items in the set.
    :param optional: If true, ``None`` can be used as a value for
        this field.
    :param initial: Initial value to pass to factory.

    :return: A ``field`` containing a checked class.
    NFcs |dkrdS�j|||d�SdS)N)�_factory_fieldsr:)rH)�argumentrmr:)rirrr=�sz _sequence_field.<locals>.factoryT)r,r=rBrA)NF)rlrHr0�
optional_type)r_r`rrAr=r)rir�_sequence_field�s
rpcCstt|||�S)al
    Create checked ``PSet`` field.

    :param item_type: The required type for the items in the set.
    :param optional: If true, ``None`` can be used as a value for
        this field.
    :param initial: Initial value to pass to factory if no value is given
        for the field.

    :return: A ``field`` containing a ``CheckedPSet`` of the given type.
    )rpr)r`rrArrr�
pset_field�srqcCstt|||�S)au
    Create checked ``PVector`` field.

    :param item_type: The required type for the items in the vector.
    :param optional: If true, ``None`` can be used as a value for
        this field.
    :param initial: Initial value to pass to factory if no value is given
        for the field.

    :return: A ``field`` containing a ``CheckedPVector`` of the given type.
    )rpr)r`rrArrr�
pvector_fieldsrrcCsdS)NTrd)Trdr)�itemrrrrOscCst||f}t||�S)z8Unpickling function for auto-generated PMap field types.)�_pmap_field_typesr)�key_type�
value_typerarbrrr�_restore_pmap_field_picklesrwcsZtj��f�}|dk	r|SG��fdd�dt�}djt|j�t|j��|_|t��f<|S)zDCreate a subclass of CheckedPMap with the given key and value types.NcseZdZ�Z�Zdd�ZdS)z%_make_pmap_field_type.<locals>.TheMapcSst|j|jt|�ffS)N)rw�__key_type__�__value_type__r)rDrrrrh%sz0_make_pmap_field_type.<locals>.TheMap.__reduce__N)r.rJrKrxryrhr)rurvrr�TheMap!srzz{0}To{1}PMap)rtrrr)rgZ_checked_key_typesZ_checked_value_typesr.)rurvrbrzr)rurvr�_make_pmap_field_typesr{csBt||��|r�fdd�}n�j}td��|r6t��n�||d�S)ad
    Create a checked ``PMap`` field.

    :param key: The required type for the keys of the map.
    :param value: The required type for the values of the map.
    :param optional: If true, ``None`` can be used as a value for
        this field.
    :param invariant: Pass-through to ``field``.

    :return: A ``field`` containing a ``CheckedPMap``.
    cs|dkrdS�j|�SdS)N)rH)rn)rzrrr=?szpmap_field.<locals>.factoryT)rBrAr,r=r")r{rHr0ro)rurvrr"r=r)rzr�
pmap_field0s
r|)/�sysZpyrsistent._checked_typesrrrrrrrr	r
rrorr<�version_infor;r r%r'r3r9r@�objectrZPFIELD_NO_TYPErQrGrVr&r0rSrUr/rjr^rcrgrlrprqrr�_validrtrwr{r|rrrr�<module>sF,		#

haha - 2025