ó
    gzi>  ã                   ó¢   • S r SSKrSSKrSSKJrJr  SSKJrJr  SSK	J
r
  SSKrSSKJr  SSKJr   " S S	5      rS
 r\4S\\   S\\   4S jjrg)z!Decorators for Shapely functions.é    N)ÚCallableÚIterable)Ú	lru_cacheÚwraps)Úunwrap)Úlib©ÚUnsupportedGEOSVersionErrorc                   ó$   • \ rS rSrSrS rS rSrg)Úrequires_geosé   z,Decorator to require a minimum GEOS version.c                 ó�   • UR                  S5      S:w  a  [        S5      e[        S UR                  S5       5       5      U l        g)z8Create a decorator that requires a minimum GEOS version.Ú.é   z.Version must be <major>.<minor>.<patch> formatc              3   ó8   #   • U  H  n[        U5      v •  M     g 7f©N)Úint)Ú.0Úxs     ÚO/home/mande/repo/quber/.venv/lib/python3.13/site-packages/shapely/decorators.pyÚ	<genexpr>Ú)requires_geos.__init__.<locals>.<genexpr>   s   é € Ð@Ò-?¨œS ŸV˜VÒ-?ùs   ‚N)ÚcountÚ
ValueErrorÚtupleÚsplitÚversion)Úselfr   s     r   Ú__init__Úrequires_geos.__init__   s:   € à�=‰=˜Ó Ó"ÜÐMÓNÐNÜÑ@¨W¯]©]¸3Ô-?Ó@Ó@ˆ�ó    c                 ó(  ^^• [         R                  U R                  :¬  n[        R                  R                  S5      S:H  nU(       a	  U(       d  T$ SR                  " TR                  /U R                  Q76 mU(       a  [        T5      U4S j5       nO[        T5      U4S j5       nUR                  nU(       aV  UR                  S5      S-   nSn XVU-      S	:X  a  US
-  nOOM  UR                  SSR                  S	U-  T5      S
5      Ul	        U$ )zReturn the wrapped function.ÚSPHINX_DOC_BUILDÚ1z%'{}' requires at least GEOS {}.{}.{}.c                  ó   >• T" U 0 UD6$ r   © )ÚargsÚkwargsÚfuncs     €r   ÚwrappedÚ'requires_geos.__call__.<locals>.wrapped$   s   ø€ á˜TÐ, VÑ,Ð,r!   c                  ó   >• [        T5      er   r	   )r'   r(   Úmsgs     €r   r*   r+   *   s   ø€ ä1°#Ó6Ð6r!   z

r   r   Ú é   z

{}.. note:: {}

)r   Úgeos_versionr   ÚosÚenvironÚgetÚformatÚ__name__r   Ú__doc__ÚfindÚreplace)	r   r)   Úis_compatibleÚis_doc_buildr*   ÚdocÚpositionÚindentr-   s	    `      @r   Ú__call__Úrequires_geos.__call__   s  ù€ ä×(Ñ(¨D¯L©LÑ8ˆÜ—z‘z—~‘~Ð&8Ó9¸SÑ@ˆÞ¦ØˆKà5×<Ò<Ø�M‰Mð
Ø ŸL™Lò
ˆö ä�4‹[ô-ó ñ-ô
 �4‹[ô7ó ð7ð �o‰oˆÞà—x‘x Ó'¨!Ñ+ˆHàˆFØØ &Ñ(Ñ)¨SÓ0Ø˜a‘K‘Fàñ	 ð
 "Ÿk™kØÐ0×7Ñ7¸¸f¹ÀcÓJÈAóˆGŒOð ˆr!   )r   N)r5   Ú
__module__Ú__qualname__Ú__firstlineno__r6   r   r>   Ú__static_attributes__r&   r!   r   r   r      s   † Ù6òAõ%r!   r   c                 ó0   ^ • [        T 5      U 4S j5       nU$ )zÈEnable multithreading.

To do this, the writable flags of object type ndarrays are set to False.

NB: multithreading also requires the GIL to be released, which is done in
the C extension (ufuncs.c).
c            	      ó¬  >• U  Vs/ s H<  n[        U[        R                  5      (       d  M$  UR                  [        :X  d  M:  UPM>     snUR                  5        VVs/ s HF  u  p2US;  d  M  [        U[        R                  5      (       d  M.  UR                  [        :X  d  MD  UPMH     snn-   nU Vs/ s H  oUR                  R                  PM     nn U H  nSUR                  l        M     T" U 0 UD6[        XF5       H  u  pWXuR                  l        M     $ s  snf s  snnf s  snf ! [        XF5       H  u  pWXuR                  l        M     f = f)N>   ÚoutÚwhereF)	Ú
isinstanceÚnpÚndarrayÚdtypeÚobjectÚitemsÚflagsÚ	writeableÚzip)	r'   r(   ÚargÚnameÚ
array_argsÚarrÚ	old_flagsÚold_flagr)   s	           €r   r*   Ú'multithreading_enabled.<locals>.wrappedI   s$  ø€ ñ  ó
Ú�C¤:¨c´2·:±:×#>‹CÀ3Ç9Á9ÔPVÑCV�C™4ñ
ð $Ÿ\™\œ^ô
â+‘	�ØÐ+Ñ+ó ô ˜3¤§
¡
×+ó ð —	‘	œVÑ#÷	 Ù+ò
ñ
ˆ
ñ 5?Ó?²J¨S—Y‘Y×(Ô(±Jˆ	Ð?ð	/Û!�Ø&+�—	‘	Ö#ñ "á˜Ð( Ñ(ä!$ ZÖ!;‘�Ø&.—	‘	Ö#ò "<ùò
ùó
ùò @øô "% ZÖ!;‘�Ø&.—	‘	Ö#ò "<ús:   †#D­DÁDÁD"Á.D"ÂD"Â%D"Â5D(Ã!D- Ä-&E)r   )r)   r*   s   ` r   Úmultithreading_enabledrX   @   s"   ø€ ô ˆ4ƒ[ô/ó ð/ð& €Nr!   Úshould_be_kwargsÚcategoryc                 ó(   ^ ^• S[         4UU 4S jjnU$ )a÷  Show warning if positional arguments are used that should be keyword.

Parameters
----------
should_be_kwargs : Iterable[str]
    Names of parameters that should be passed as keyword arguments.
category : type[Warning], optional (default: DeprecationWarning)
    Warning category to use for deprecation warnings.

Returns
-------
callable
    Decorator function that adds positional argument deprecation warnings.

Examples
--------
>>> from shapely.decorators import deprecate_positional
>>> @deprecate_positional(['b', 'c'])
... def example(a, b, c=None):
...     return a, b, c
...
>>> example(1, 2)  # doctest: +SKIP
DeprecationWarning: positional argument `b` for `example` is deprecated. ...
(1, 2, None)
>>> example(1, b=2)  # No warnings
(1, 2, None)
r)   c                 ó’  >^ ^^^	• [        T 5      R                  nUR                  S UR                   n[	        U5       VVs0 s H  u  p4XC_M	     nnnT Vs/ s H  nXE;   d  M
  XT   U4PM     snmT(       d  T $ [        T5      S   m	[        S5      S[        4UU 4S jj5       m[        T 5      U
U UU	4S j5       nU$ s  snnf s  snf )Nr   é
   Ún_argsc                 ób  >• T VVs/ s H  u  pX:  d  M  UPM     nnn[        U5      S:X  a  SUS    S3nSnSnOSSnSn[        U5      S:X  a  S	R                  S
 U 5       5      nO'SR                  S US S  5       5      nUSUS    S3-  nSU SU STR                   SU SU S3$ s  snnf )Nr/   Ú`r   Ú ÚisÚsÚarer   z and c              3   ó.   #   • U  H  nS U S 3v •  M     g7f©r`   Nr&   ©r   Úus     r   r   ÚLdeprecate_positional.<locals>.decorator.<locals>.make_msg.<locals>.<genexpr>¡   s   é € Ð+Cºd¸¨a°¨s°!­Hºdùó   ‚z, c              3   ó.   #   • U  H  nS U S 3v •  M     g7frf   r&   rg   s     r   r   ri   £   s   é € Ð(Eº9°a¨1¨Q¨C¨q­º9ùrj   éÿÿÿÿz, and `zpositional argumentr.   z for `z` z( deprecated. Please use keyword argumentz	 instead.)ÚlenÚjoinr5   )	r^   ÚidxrR   ÚusedÚargs_txtÚplrÚisareÚdeprecate_positionsr)   s	          €€r   Úmake_msgÚ9deprecate_positional.<locals>.decorator.<locals>.make_msg•   sÙ   ø€ á*=ÔNÒ*=™Y˜SÀÁ—DÑ*=ˆDÑNä�4‹y˜A‹~Ø˜t A™w˜i q˜>�Ø�Ø‘à�Ø�Ü�t“9 “>Ø&Ÿ|™|Ñ+C¹dÓ+CÓC‘Hà#Ÿy™yÑ(E¸4ÀÀ¹9Ó(EÓE�HØ '¨$¨r©(¨°1Ð 5Ñ5�Hð & c U¨!¨H¨:°V¸D¿M¹M¸?È"Ø�'ÐAÀ#ÀÀiðQðùó Os
   ‡B+–B+c                  ór   >• T" U 0 UD6n[        U 5      nUT:”  a  [        R                  " T" U5      TSS9  U$ )Nr   )rZ   Ú
stacklevel)rm   ÚwarningsÚwarn)r'   r(   ÚresultÚnrZ   r)   ru   Ú	warn_froms       €€€€r   ÚwrapperÚ8deprecate_positional.<locals>.decorator.<locals>.wrapper«   s;   ø€ á˜4Ð* 6Ñ*ˆFä�D“	ˆAØ�9‹}Ü—’™h q›k°HÈÒKàˆMr!   )	r   Ú__code__Úco_varnamesÚco_argcountÚ	enumerateÚminr   r   r   )r)   ÚcodeÚ	pos_namesro   rR   Úname_to_idxr~   rt   ru   r}   rZ   rY   s   `      @@@€€r   Ú	decoratorÚ'deprecate_positional.<locals>.decorator€   sà   ü€ Ü�d‹|×$Ñ$ˆð ×$Ñ$Ð%7 t×'7Ñ'7Ð8ˆ	ä2;¸IÔ2FÔGÒ2F¡Y S�t’yÑ2FˆÑGñ )ó
â(�ØÑ"ó &ˆ[Ñ Ó%Ù(ñ
Ðö #ØˆKô Ð+Ó,¨QÑ/ˆ	ä	�2‹ð	œS÷ 	ó 
ð	ô* 
ˆt‹÷	ó 
ð	ð ˆùó_ Hùò
s   ÁB>Á	CÁ$
C)r   )rY   rZ   rˆ   s   `` r   Údeprecate_positionalrŠ   `   s   ù€ ð@5œ÷ 5ð 5ðn Ðr!   )r6   r1   ry   Úcollections.abcr   r   Ú	functoolsr   r   Úinspectr   ÚnumpyrI   Úshapelyr   Úshapely.errorsr
   r   rX   ÚDeprecationWarningÚstrÚtypeÚWarningrŠ   r&   r!   r   Ú<module>r•      sV   ðÙ 'ã 	Û ß .ß &Ý ã å Ý 6÷.ñ .òbðD 1ñWØ˜s‘mðWà�7‰möWr!   