python (3.11.7)

(root)/
lib/
python3.11/
multiprocessing/
__pycache__/
shared_memory.cpython-311.pyc

eHdZddgZddlmZddlZddlZddlZddlZddlZddl	Z	ej
dkrddlZdZnddl
Z
dZd	d
lmZejejzZdZerdZnd
ZdZGddZdZGddZdS)zProvides shared memory for direct access across processes.

The API of this package is currently provisional. Refer to the
documentation for details.
SharedMemory
ShareableList)partialNntFT)resource_trackerz/psm_wnsm_ctttz
dz}|dks
Jdttj|z}t|tksJ|S)z6Create a random filename for the shared memory object.z_SHM_NAME_PREFIX too long)_SHM_SAFE_NAME_LENGTHlen_SHM_NAME_PREFIXsecrets	token_hex)nbytesnames  Q/BuggyBox/python/3.11.7/bootstrap/lib/python3.11/multiprocessing/shared_memory.py_make_filenamer(sb$c*:&;&;;
AFQ;;;3;;;g/777Dt99-----KceZdZdZdZdZdZdZej	Z
dZerdndZ
ddZd	Zd
ZdZedZed
ZedZdZdZdS)raCreates a new shared memory block or attaches to an existing
    shared memory block.

    Every shared memory block is assigned a unique name.  This enables
    one process to create a shared memory block with a particular name
    so that a different process can attach to that same shared memory
    block using that same name.

    As a resource for sharing data across processes, shared memory blocks
    may outlive the original process that created them.  When one process
    no longer needs access to a shared memory block that might still be
    needed by other processes, the close() method should be called.
    When a shared memory block is no longer needed by any process, the
    unlink() method should be called to ensure proper cleanup.NiTFrcx|dkstd|r.ttjz|_|dkrtd|#|jtjzstdtr*|O	t}	tj	||j|j
|_n#t$rYCwxYw||_
n;|jrd|zn|}tj	||j|j
|_||_
	|r|rtj|j|tj|j}|j}t%j|j||_n##t($r|wxYwt-j|j
dn|r#	|tn|}t1jt0jt0jt0j|d	z	d
z|d
z|}	t1j}|t0jkrZ|Btt>j tj!t>j |t0j	t1j"|t%jd|||_t1j"|n#t1j"|wxYw||_
n||_
t1j#t0j$d
|}	t1j%|t0j$ddd}t1j"|n#t1j"|wxYw	t1j&|}t1j'|n#t1j'|wxYwt%jd|||_||_(tS|j|_*dS)Nrz!'size' must be a positive integerz4'size' must be a positive number different from zeroz&'name' can only be None if create=TrueT)mode/
shared_memory lr)tagnameF)+
ValueError_O_CREXosO_RDWR_flagsO_EXCL
_USE_POSIXr_posixshmemshm_open_mode_fdFileExistsError_name_prepend_leading_slash	ftruncatefstatst_sizemmap_mmapOSErrorunlinkrregister_winapiCreateFileMappingINVALID_HANDLE_VALUENULLPAGE_READWRITEGetLastErrorERROR_ALREADY_EXISTSerrnoEEXISTstrerrorCloseHandleOpenFileMapping
FILE_MAP_READ
MapViewOfFileVirtualQuerySizeUnmapViewOfFile_size
memoryview_buf)	selfrcreatesizestats	temp_nameh_maplast_error_codep_bufs	         r__init__zSharedMemory.__init__Ksqyy@AAA	Y!BI-DKqyy !WXXX<bi 7<EFFF_	?|)++D!#.#7  K!%$$$
+!!! !!%DJ%)%@JsTzzd&/K
"

1d1L4000**}!Ytx66









%dj/BBBB6
?48L 0 0 0dI$54.z1z)!
E3*1*>*@*@*g.JJJ#/&5$)L$&K$=$=$($+$@	'"'"!"!) +E2222&*Yr4%K%K%K
+E2222+E2222!*DJ"
 /)
	/#1-E'....G'....3"3E::D+E2222G+E2222!Yr4>>>

tz**			sJ&B,,
B98B9AE E>4A'J"1J""J8+"L""L8<M%%M;cR	|dS#t$rYdSwxYwN)closer2rHs r__del__zSharedMemory.__del__s:	JJLLLLL			DD	s
&&c.|j|jd|jffS)NF)	__class__rrJrTs r
__reduce__zSharedMemory.__reduce__s#N		

	
rc@|jjd|jd|jdS)N(z, size=))rW__name__rrJrTs r__repr__zSharedMemory.__repr__s*.)LLDILL	LLLLrc|jS)z4A memoryview of contents of the shared memory block.)rGrTs rbufzSharedMemory.bufsyrc|j}tr0|jr)|jdr|jdd}|S)z4Unique name that identifies the shared memory block.rrN)r+r%r,
startswith)rH
reported_names  rrzSharedMemory.namesJ

	/$5	/z$$S))
/ $
122
rc|jS)zSize in bytes.)rErTs rrJzSharedMemory.sizeszrc|j |jd|_|j |jd|_tr-|jdkr$t
j|jd|_dSdSdS)zkCloses access to the shared memory from this instance but does
        not destroy the shared memory block.Nrr)rGreleaser1rSr%r)r!rTs rrSzSharedMemory.closes9 IDI:!JDJ	$(a--HTXDHHH		--rctr<|jr7tj|jt	j|jddSdSdS)zRequests that the underlying shared memory block be destroyed.

        In order to ensure proper cleanup of resources, unlink should be
        called once (and only once) across all processes which have access
        to the shared memory block.rN)r%r+r&
shm_unlinkr
unregisterrTs rr3zSharedMemory.unlinks]	E$*	E"4:...'
ODDDDD	E	E	E	Er)NFr)r\
__module____qualname____doc__r+r)r1rGr!r"r#r(r%r,rPrUrXr]propertyr_rrJrSr3rrrr2s
B
B 
E
CED
YFE%/:TTUl+l+l+l+\


MMMXXXEEEEErutf8cleZdZdZedededededdj	diZ
dZd	d
ddd
Ze
dZd"dddZdZdZdZdZdZdZdZdZedZedZedZedZedZedZedZd Z d!Z!e"e#j$Z%dS)#raPattern for a mutable list-like object shareable via a shared
    memory block.  It differs from the built-in list type in that these
    lists can not change their overall length (i.e. no append, insert,
    etc.)

    Because values are packed into a memoryview as bytes, the struct
    packing format for any storable value must require no more than 8
    characters to describe its format.qdzxxxxxxx?z%dsNzxxxxxx?xc|SrRrmvalues r<lambda>zShareableList.<lambda>src\|dtSN)rstripdecode	_encodingrts rrvzShareableList.<lambda>s g..55i@@rc,|dSrx)rzrts rrvzShareableList.<lambda>sg..rcdSrRrm)_values rrvzShareableList.<lambda>s$r)rrrct|ttdjfsdSt|trdSt|trdSdS)zUsed in concert with _back_transforms_mapping to convert values
        into the appropriate Python objects when retrieving them from
        the list as well as when storing them.Nrrrr)
isinstancestrbytesrWrts r_extract_recreation_codez&ShareableList._extract_recreation_codesW
%#udn!=>>	1
s
#
#	1
u
%
%	11rrc|||pd}fd|D}t|_td|DjksJd}dg_|D]I}||ddkrjnt|ddz
}j|Jfd|D}tjdj	zd	
|zjzjz}t|d
|_nt|_|ttjdj	zjjdjgjRtjd	
|jjjgfd|DRtjjjjjgfd
|DRtjjjjjg|RdSt_t+tjj	jjd_dS)Nrmcg|]v}t|ttfsjt	|n=jt	|jt
|jzdzzfzwS)r)rrr_types_mappingtype
_alignmentr.0itemrHs  r
<listcomp>z*ShareableList.__init__.<locals>.<listcomp>-s	&dS%L99#DJJ//,T$ZZ83t99+G!+KL<rc3<K|]}t|dkVdS)rrN)r)rfmts  r	<genexpr>z)ShareableList.__init__.<locals>.<genexpr>6s,99s3xx1}999999rrrsc:g|]}|Srm)rrs  rrz*ShareableList.__init__.<locals>.<listcomp>?s4!!!8<--d33!!!rrpT)rIrJc3pK|]0}t|tr|n|V1dSrR)rrencoderv_encs  rrz)ShareableList.__init__.<locals>.<genexpr>Zs@PP!Jq#$6$6=!((4...APPPPPPrc3BK|]}|VdSrR)rrs  rrz)ShareableList.__init__.<locals>.<genexpr>`s-33Q!((4..333333rrr)r	_list_lensum_allocated_offsetsrintappendstructcalcsize_format_size_metainfojoin_format_packing_metainfo_format_back_transform_codesrshmr|	pack_intor__offset_data_start_offset_packing_formats_offset_back_transform_codeslistunpack_from)	rHsequencer_formatsoffsetr_recreation_codesrequested_sizers	`       @rrPzShareableList.__init__*s<8/~2H%
H!]]DN9999999T^KKKKF()cD#
7
7SW^^$//S"XN'..v6666!!!!@H!!!$_d00!!"-.12N$DNKKKDHH#D))DHDd00	

)




!!'
QPPPxPPP	




-,
4333(333	




11
$	





!YYDN&*".HL''D###rc4|dkr|n	||jz}||jks|jdkrtdtjd|jj|j|dzzd}|d}|t}|S)z>Gets the packing format for a single value stored in the list.r Requested position out of range.8srrry)
r
IndexErrorrrrr_rrzr{r|)rHpositionrr
fmt_as_strs     r_get_packing_formatz!ShareableList._get_packing_formatss'1}}88(T^2K&&DNQ,>,>?@@@HL(8a<7

	


hhwZZ	**
rc||jks|jdkrtdtjd|jj|j|zd}|j|}|S)z9Gets the back transformation function for a single value.rrb)rrrrrr_r_back_transforms_mapping)rHrtransform_codetransform_functions    r_get_back_transformz!ShareableList._get_back_transformss
&&DNQ,>,>?@@@+HL-8

	

":>J!!rcT||jks|jdkrtdtjd|jj|j|dzz|t|	|}tjd|jj|j
|z|dS)zvSets the packing format and back transformation code for a
        single value in the list at the specified position.rrrrrrN)rrrrrr_rrr|rr)rHrrrurs     r!_set_packing_format_and_transformz/ShareableList._set_packing_format_and_transforms
&&DNQ,>,>?@@@HL(8a<7i((		
	
	
66u==HL-8		
	
	
	
	
rc<|dkr|n	||jz}	|j|j|z}tj|||jj|\}n#t$rtdwxYw|	|}||}|S)Nrzindex out of range)
rrrrrrrr_rr)rHrrrback_transforms     r__getitem__zShareableList.__getitem__s'1}}88(T^2K	3,t/Fx/PPF%((22DQQ
	3	3	31222	311(;;N1sA
AA9c|dkr|n	||jz}	|j|}|j|z}||}n#t$rt	dwxYwt|ttfs|jt|}|}n|j|dz|z
}t|tr|
tn|}t||krtd|ddkr|}n|jt|fz}||||tj||jj||dS)Nrzassignment index out of rangerz(bytes/str item exceeds available storagerr)rrrrrrrrrrrr|rrrrrrr_)	rHrruitem_offsetrcurrent_format
new_format
encoded_valueallocated_lengths	         r__setitem__zShareableList.__setitem__s'1}}88(T^2K	>1(;K,{:F!55h??NN	>	>	><===	>%#u..	,T%[[9J!MM#6x!|D{R!+5# 6 6BU\\)444<A
=!!$444 !KLLLb!S((+

!05$9
	
..	
	
	

	TX\6=IIIIIs,AAcFt|j|jjdfS)Nrrm)rrWrrrTs rrXzShareableList.__reduce__s t~DHM:::B>>rcNtjd|jjddS)Nrpr)rrrr_rTs r__len__zShareableList.__len__s !#tx|Q77::rcZ|jjdt|d|jjdS)NrZz, name=r[)rWr\rrrrTs rr]zShareableList.__repr__s0.)QQDJJQQtx}QQQQrcjdfdtjDS)z=The struct packing format used by all currently stored items.rc3BK|]}|VdSrR)r)rirHs  rrz'ShareableList.format.<locals>.<genexpr>sB

,-D$$Q''





r)rrangerrTs`rformatzShareableList.formatsKww



16t~1F1F




	
rcd|jdzzS)z>The struct packing format used for the items' storage offsets.rprrrTs rrz#ShareableList._format_size_metainfosdnq())rcd|jzS)z>The struct packing format used for the items' packing formats.rrrTs rrz&ShareableList._format_packing_metainfosdn$$rcd|jzS)z>The struct packing format used for the items' back transforms.rrrTs rrz*ShareableList._format_back_transform_codessT^##rc|jdzdzS)NrrrrrTs rrz ShareableList._offset_data_starts"a''rc,|j|jdzS)Nr)rrrTs rrz%ShareableList._offset_packing_formatss&)@)DDDrc&|j|jdzzS)Nrr)rrrTs rrz*ShareableList._offset_back_transform_codess+dnq.@@@rc:tfd|DS)zCL.count(value) -> integer -- return number of occurrences of value.c3$K|]
}|kVdSrRrm)rentryrus  rrz&ShareableList.count.<locals>.<genexpr>
s'44e5E>444444r)r)rHrus `rcountzShareableList.counts(4444t444444rcdt|D]\}}||kr|cSt|d)zpL.index(value) -> integer -- return first index of value.
        Raises ValueError if the value is not present.z not in this container)	enumerater)rHrurrs    rindexzShareableList.indexsO )	A	AOHe~~???@@@rrR)&r\rirjrkrfloatboolrrrWrrrstaticmethodrrPrrrrrrXrr]rlrrrrrrrrrclassmethodtypesGenericAlias__class_getitem__rmrrrrs)**&	S
sjU
u

NJ@@..	  \GdGGGGGR 
"
"
"


,"JJJB???;;;RRR

X
**X*%%X%$$X$((X(
EEXEAAXA555
AAA$E$677r)rk__all__	functoolsrr0r!r<rrrrr5r%r&rrO_CREATr$r r
rrrr|rrmrr<module>rs]
O
-				



7d??NNNJJJ
*ry
 BEBEBEBEBEBEBEBEJ
	]8]8]8]8]8]8]8]8]8]8r