JFIFxxC      C  " }!1AQa"q2#BR$3br %&'()*456789:CDEFGHIJSTUVWXYZcdefghijstuvwxyz w!1AQaq"2B #3RbrJFIFxxC      C  " }!1AQa"q2#BR$3br %&'()*456789:CDEFGHIJSTUVWXYZcdefghijstuvwxyz w!1AQaq"2B #3RbrB [@sddlZddlmZmZmZmZddlmZmZm Z m Z m Z ddl m Z mZGdddeZeeGddde eZGd d d e jZdS) N) CheckedType_restore_pickleInvariantExceptionstore_invariants) set_fields check_typePFIELD_NO_INITIAL serializecheck_global_invariants)PMappmapcseZdZfddZZS) _PRecordMetacsvt||ddt||ddtdd|dD|d<tdd|dD|d <d |d <tt|||||S) N_precord_fields)name_precord_invariantsZ __invariant__css|]\}}|jr|VqdS)N) mandatory).0rfieldrF/opt/alt/python37/lib64/python3.7/site-packages/pyrsistent/_precord.py sz'_PRecordMeta.__new__.._precord_mandatory_fieldscss&|]\}}|jtk r||jfVqdS)N)initialr)rkrrrrrs_precord_initial_valuesr __slots__)rrsetitemsdictsuperr __new__)Zmcsrbasesdct) __class__rrr s z_PRecordMeta.__new__)__name__ __module__ __qualname__r __classcell__rr)r#rr sr cs\eZdZdZfddZfddZddZdd Zedd d Z ddZ dddZ Z S)PRecordau A PRecord is a PMap with a fixed set of specified fields. Records are declared as python classes inheriting from PRecord. Because it is a PMap it has full support for all Mapping methods such as iteration and element access using subscript notation. More documentation and examples of PRecord usage is available at https://github.com/tobgu/pyrsistent c sd|kr,d|kr,tt|||d|dS|dd}|}|jrdtdd|jD}||t|t |d}x|D]\}}|||<q~W| S)N _precord_size_precord_buckets_factory_fieldscss(|] \}}|t|r|n|fVqdS)N)callable)rrvrrrr-sz"PRecord.__new__..)r+) rr(r poprrrupdate_PRecordEvolverr persistent)clskwargsZfactory_fieldsZinitial_valueserr-)r#rrr "s   zPRecord.__new__cs(|rtt||d|dS||S)a Set a field in the record. This set function differs slightly from that in the PMap class. First of all it accepts key-value pairs. Second it accepts multiple key-value pairs to perform one, atomic, update of multiple fields. r)rr(rr/)selfargsr3)r#rrr7s z PRecord.setcCs t|j|S)z4 Returns an evolver of this object. )r0r#)r6rrrevolverEszPRecord.evolvercCs$d|jjddd|DS)Nz{0}({1})z, css"|]\}}d|t|VqdS)z{0}={1}N)formatrepr)rrr-rrrrMsz#PRecord.__repr__..)r9r#r$joinr)r6rrr__repr__Ks zPRecord.__repr__NFcs8t|rS|r&fdd|jD|fd|iS)a< Factory method. Will create a new PRecord of the current type and assign the values specified in kwargs. :param ignore_extra: A boolean which when set to True will ignore any keys which appear in kwargs that are not in the set of fields on the PRecord. csi|]}|kr||qSrr)rr)r3rr \sz"PRecord.create..r+) isinstancer)r2r3r+Z ignore_extrar)r3rcreateOs zPRecord.createcCst|jt|ffS)N)rr#r)r6rrr __reduce__`szPRecord.__reduce__cstfddDS)z Serialize the current PRecord using custom serializer functions for fields where such have been supplied. c3s*|]"\}}|tj|j|fVqdS)N)r rZ serializer)rrr-)r9r6rrrisz$PRecord.serialize..)rr)r6r9r)r9r6rr dszPRecord.serialize)NF)N) r$r%r&__doc__r rr8r< classmethodr?r@r r'rr)r#rr(s   r(csBeZdZdZd fdd ZddZfddZfd d ZZS) r0)_destination_cls_invariant_error_codes_missing_fieldsr+Ncs,tt||||_g|_g|_||_dS)N)rr0__init__rCrDrEr+)r6r2Z original_pmapr+)r#rrrFos z_PRecordEvolver.__init__cCs|||dS)N)r)r6keyoriginal_valuerrr __setitem__vsz_PRecordEvolver.__setitem__c s|jj|}|r|jdks&||jkrzy||}Wq~tk rv}z$|j|j7_|j|j 7_|Sd}~XYq~Xn|}t |j|||| |\}}|s|j |t t|||Std||jjdS)Nz/'{0}' is not among the specified fields for {1})rCrgetr+factoryrrDZinvariant_errorsrEZmissing_fieldsrZ invariantappendrr0rAttributeErrorr9r$)r6rGrHrvaluer4Zis_okZ error_code)r#rrrys  z_PRecordEvolver.setcs|j|}tt|}|s*t|s<|j|jd}n|}jrt|j t fddjt | D7_ |j s|j rtt |j t |j dt|j|S)N)r*r)c3s|]}dj|VqdS)z{0}.{1}N)r9r$)rf)r2rrrsz-_PRecordEvolver.persistent..zField invariant failed)rCis_dirtyrr0r1r>Z_buckets_sizerrEtuplerkeysrDrr r)r6rPZpmresult)r#)r2rr1s  z_PRecordEvolver.persistent)N) r$r%r&rrFrIrr1r'rr)r#rr0ls  r0)sixZpyrsistent._checked_typesrrrrZpyrsistent._field_commonrrrr r Zpyrsistent._pmapr r typer Z add_metaclassr(Z_Evolverr0rrrrs R