
    (&h                     x    d Z ddlZddlZddlZddlmZ ddlZddlm	Z	 ddl
mZ  G d d          Zd Zefd	ZdS )
z!Decorators for Shapely functions.    Nwraps)libUnsupportedGEOSVersionErrorc                       e Zd ZdZd Zd ZdS )requires_geosz,Decorator to require a minimum GEOS version.c                     |                     d          dk    rt          d          t          d |                    d          D                       | _        dS )z8Create a decorator that requires a minimum GEOS version..   z.Version must be <major>.<minor>.<patch> formatc              3   4   K   | ]}t          |          V  d S N)int).0xs     M/var/www/html/reinick/venv/lib/python3.11/site-packages/shapely/decorators.py	<genexpr>z)requires_geos.__init__.<locals>.<genexpr>   s(      @@SVV@@@@@@    N)count
ValueErrortuplesplitversion)selfr   s     r   __init__zrequires_geos.__init__   sV    ==""MNNN@@W]]3-?-?@@@@@r   c                     t           j        | j        k    }t          j                            d          dk    }|r|sS  dj        j        g| j        R  |rt                    fd            }nt                    fd            }|j	        }|re|
                    d          dz   }d}	 |||z            d
k    r|dz  }nn|                    dd                    d
|z            d          |_	        |S )zReturn the wrapped function.SPHINX_DOC_BUILD1z%'{}' requires at least GEOS {}.{}.{}.c                       | i |S r    )argskwargsfuncs     r   wrappedz'requires_geos.__call__.<locals>.wrapped#   s    tT,V,,,r   c                  "    t                    r   r   )r!   r"   msgs     r   r$   z'requires_geos.__call__.<locals>.wrapped)   s    1#666r   z

r   r   T    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__zrequires_geos.__call__   s_   (DL8z~~&899S@ 	 	K<5<M
 L
 
 
  
	74[[- - - - [- -
 4[[7 7 7 7 [7 o 	xx''!+HFx&()S00aKFF	
 "kk077fcJJA GO r   N)r.   
__module____qualname__r/   r   r7   r    r   r   r	   r	      s;        66A A A% % % % %r   r	   c                 <     t                      fd            }|S )zEnable 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                  8   d | D             d |                                 D             z   }d |D             }	 |D ]}d|j        _         | i |t          ||          D ]\  }}||j        _        S # t          ||          D ]\  }}||j        _        w xY w)Nc                 f    g | ].}t          |t          j                  r|j        t          k    ,|/S r    
isinstancenpndarraydtypeobject)r   args     r   
<listcomp>z;multithreading_enabled.<locals>.wrapped.<locals>.<listcomp>J   s@     
 
 
:c2:#>#>
CF9PVCVCVCCVCVCVr   c                 t    g | ]5\  }}|d vr,t          |t          j                  r|j        t          k    3|6S )>   outwherer=   )r   namerC   s      r   rD   z;multithreading_enabled.<locals>.wrapped.<locals>.<listcomp>L   sU     
 
 
c+++3
++ ,	V##	  $##r   c                 &    g | ]}|j         j        S r    )flags	writeable)r   arrs     r   rD   z;multithreading_enabled.<locals>.wrapped.<locals>.<listcomp>S   s    ???SSY(???r   F)itemsrJ   rK   zip)r!   r"   
array_args	old_flagsrL   old_flagr#   s         r   r$   z'multithreading_enabled.<locals>.wrappedH   s    
 

 
 

 
#\\^^
 
 


 @?J???		/! , ,&+	##4(((!$Z!;!; / /X&.	##/Z!;!; / /X&.	##/s   A5 5$Br   )r#   r$   s   ` r   multithreading_enabledrR   ?   s5     4[[/ / / / [/& Nr   c                       fd}|S )zEShow warning if positional arguments are used that should be keyword.c                 B     t                      fd            }|S )Nc                      
| i |}t          j        
          } |j        |  }fd|j                                        D             }|rt          |          dk    rd}d}|d         } nVd}d}t          |          dk     rd	                    |          } n)d
                    |d d                   dz   |d         z   } d| d|  d
j         d| d| d}t          j	        |	d           |S )Nc                 $    g | ]}|v d | d S )`r    )r   rC   should_be_kwargss     r   rD   zLdeprecate_positional.<locals>.decorator.<locals>.wrapper.<locals>.<listcomp>k   s7       *** C


***r   r(    isr   sare   z and z, z, and zpositional argumentr'   z for `z` z) deprecated.  Please use keyword argumentz	 instead.r   )category
stacklevel)
inspect	signaturebind_partial	argumentskeyslenjoinr.   warningswarn)r!   r"   	ret_valuesig	args_bind	warn_argsplrisarer&   r_   r#   rX   s            r   wrapperz8deprecate_positional.<locals>.decorator.<locals>.wrapperc   sr    d-f--I #D))C(($/I   $.3355  I
  Dy>>Q&&C E$Q<DDC!E9~~))&||I66#yy3B3888CiPRmSV# V V V VDM V VV VGJV V V  cHCCCCr   r   )r#   rp   r_   rX   s   ` r   	decoratorz'deprecate_positional.<locals>.decoratorb   s>    	t	 	 	 	 	 	 
	> r   r    )rX   r_   rq   s   `` r   deprecate_positionalrr   _   s+    ! ! ! ! ! !F r   )r/   ra   r*   rh   	functoolsr   numpyr?   shapelyr   shapely.errorsr   r	   rR   DeprecationWarningrr   r    r   r   <module>rx      s    ' '  				                  6 6 6 6 6 6. . . . . . . .b  @ 5G & & & & & &r   