https://t.me/RX1948
Server : Apache
System : Linux iad1-shared-b8-43 6.6.49-grsec-jammy+ #10 SMP Thu Sep 12 23:23:08 UTC 2024 x86_64
User : dh_edsupp ( 6597262)
PHP Version : 8.2.26
Disable Function : NONE
Directory :  /lib/python3/dist-packages/django/contrib/gis/db/models/__pycache__/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : //lib/python3/dist-packages/django/contrib/gis/db/models/__pycache__/lookups.cpython-310.pyc
o

�a�,�@sddlmZddlmZddlmZddlmZmZm	Z	ddl
mZddlm
Z
Gdd�de	�ZGd	d
�d
e�ZejGdd�de��ZejGd
d�de��ZejGdd�de��ZejGdd�de��ZejGdd�de��ZejGdd�de��ZejGdd�de��ZejGdd�de��ZejGdd�de��Ze�ed�ejGdd�de��ZejGd d!�d!e��ZejGd"d#�d#e��ZejGd$d%�d%e��ZejGd&d'�d'e��ZejGd(d)�d)e��ZejGd*d+�d+e��Z ejGd,d-�d-e��Z!ejGd.d/�d/e��Z"ejGd0d1�d1e��Z#ejGd2d3�d3e��Z$ejGd4d5�d5e��Z%ejGd6d7�d7e��Z&ejGd8d9�d9e��Z'ejGd:d;�d;e��Z(Gd<d=�d=e�Z)ejGd>d?�d?e)��Z*Gd@dA�dAe)�Z+ejGdBdC�dCe+��Z,ejGdDdE�dEe+��Z-ejGdFdG�dGe+��Z.ejGdHdI�dIe+��Z/dJS)K�)�BaseSpatialField)�Distance)�NotSupportedError)�
Expression�Lookup�	Transform)�Query)�_lazy_re_compilec@�eZdZdd�ZdS)�RasterBandTransformcCs|�|j�S�N)�compile�lhs)�self�compiler�
connection�r�F/usr/lib/python3/dist-packages/django/contrib/gis/db/models/lookups.py�as_sql
szRasterBandTransform.as_sqlN��__name__�
__module__�__qualname__rrrrrr	�rcsfeZdZdZdZdZdZdZ�fdd�Zdd�Z	ddd�Z
d	d
�Z�fdd�Zd
d�Z
dd�Z�ZS)�	GISLookupNFcs>t|ttf�r	|n|g^}|_t��||�i|_|��dSr)�
isinstance�list�tuple�
rhs_params�super�__init__�template_params�process_rhs_params)rr�rhs��	__class__rrr szGISLookup.__init__cCsn|jr't|j�|jdkrdndkr|��dSt|j�dkr%td|j��dSt|jt�r5|jdd�dSdS)N�relate��zTuple too long for lookup %s.T)�only_lhs)r�len�lookup_name�process_band_indices�
ValueErrorrrr�rrrrr"s��zGISLookup.process_rhs_paramscCsP|rd|_|jjd|_dSt|jt�r|jjd|_nd|_|j^|_|_dS)z
        Extract the lhs band index from the band transform class and the rhs
        band index from the input tuple.
        r(N)�band_rhsr�
band_index�band_lhsrrr)rr)rrrr,%szGISLookup.process_band_indicescCsd|j�|�gfS)N�%s)�ops�Adapter)r�valuerrrr�get_db_prep_lookup8szGISLookup.get_db_prep_lookupcsjt|jt�r
t��||�St|jt�r|j�|j�|_t��||�\}}|j�	|j
j|j|�}|||fSr)rr#rr�process_rhsr�resolve_expression�queryr3�get_geom_placeholderr�output_field)rrrr#r�placeholderr$rrr7<szGISLookup.process_rhscCs|jj|jSr)r3�
gis_operatorsr+)rrr#rrr�
get_rhs_opFszGISLookup.get_rhs_opc
Cs\|�||�\}}|�||�\}}g|�|�R}||dd�|j�}|�||�}	|	�||||�S)Nr2)rr#r5)�process_lhsr7r!r>r)
rrr�lhs_sql�
lhs_params�rhs_sqlr�
sql_paramsr!�rhs_oprrrrLszGISLookup.as_sql)F)rrr�sql_template�transform_func�distancer/r1r r"r,r6r7r>r�
__classcell__rrr$rrs


rc@�eZdZdZdZdS)�OverlapsLeftLookupzy
    The overlaps_left operator returns true if A's bounding box overlaps or is to the
    left of B's bounding box.
    �
overlaps_leftN�rrr�__doc__r+rrrrrJZ�rJc@rI)�OverlapsRightLookupz}
    The 'overlaps_right' operator returns true if A's bounding box overlaps or is to the
    right of B's bounding box.
    �overlaps_rightNrLrrrrrOcrNrOc@rI)�OverlapsBelowLookupzs
    The 'overlaps_below' operator returns true if A's bounding box overlaps or is below
    B's bounding box.
    �overlaps_belowNrLrrrrrQlrNrQc@rI)�OverlapsAboveLookupzs
    The 'overlaps_above' operator returns true if A's bounding box overlaps or is above
    B's bounding box.
    �overlaps_aboveNrLrrrrrSurNrSc@rI)�
LeftLookupzo
    The 'left' operator returns true if A's bounding box is strictly to the left
    of B's bounding box.
    �leftNrLrrrrrU~rNrUc@rI)�RightLookupzq
    The 'right' operator returns true if A's bounding box is strictly to the right
    of B's bounding box.
    �rightNrLrrrrrW�rNrWc@rI)�StrictlyBelowLookupzp
    The 'strictly_below' operator returns true if A's bounding box is strictly below B's
    bounding box.
    �strictly_belowNrLrrrrrY�rNrYc@rI)�StrictlyAboveLookupzp
    The 'strictly_above' operator returns true if A's bounding box is strictly above B's
    bounding box.
    �strictly_aboveNrLrrrrr[�rNr[c@rI)�SameAsLookupz�
    The "~=" operator is the "same as" operator. It tests actual geometric
    equality of two features. So if A and B are the same feature,
    vertex-by-vertex, the operator returns true.
    �same_asNrLrrrrr]�sr]�exactc@rI)�BBContainsLookupzq
    The 'bbcontains' operator returns true if A's bounding box completely contains
    by B's bounding box.
    �
bbcontainsNrLrrrrr`�rNr`c@rI)�BBOverlapsLookupz_
    The 'bboverlaps' operator returns true if A's bounding box overlaps B's bounding box.
    �
bboverlapsNrLrrrrrb�srbc@rI)�ContainedLookupzt
    The 'contained' operator returns true if A's bounding box is completely contained
    by B's bounding box.
    �	containedNrLrrrrrd�rNrdc@�eZdZdZdS)�ContainsLookup�containsN�rrrr+rrrrrg��rgc@rf)�ContainsProperlyLookup�contains_properlyNrirrrrrk�rjrkc@rf)�CoveredByLookup�	coveredbyNrirrrrrm�rjrmc@rf)�CoversLookup�coversNrirrrrro�rjroc@rf)�
CrossesLookup�crossesNrirrrrrq�rjrqc@rf)�DisjointLookup�disjointNrirrrrrs�rjrsc@rf)�EqualsLookup�equalsNrirrrrru�rjruc@rf)�IntersectsLookup�
intersectsNrirrrrrw�rjrwc@rf)�OverlapsLookup�overlapsNrirrrrry�rjrycs,eZdZdZdZed�Z�fdd�Z�ZS)�RelateLookupr&z%(func)s(%(lhs)s, %(rhs)s, %%s)z^[012TF\*]{9}$csp|jd}|jj|j}t|d�r|�|�nt|t�r"|j�	|�s(t
d|��t��||�\}}|||gfS)Nr�check_relate_argumentz)Invalid intersection matrix pattern "%s".)
rr3r=r+�hasattrr|r�str�
pattern_regex�matchr-rr7)rrr�pattern�
backend_op�sql�paramsr$rrr7s

zRelateLookup.process_rhs)	rrrr+rEr	rr7rHrrr$rr{�s
r{c@rf)�
TouchesLookup�touchesNrirrrrr�rjr�c@rf)�WithinLookup�withinNrirrrrr�rjr�c@s$eZdZdZdZdd�Zdd�ZdS)�DistanceLookupBaseTz+%(func)s(%(lhs)s, %(rhs)s) %(op)s %(value)scCs~dt|j�kr
dksntd|j��t|j�dkr'|jddkr'td��t|j�dkr;|jddkr=|��dSdSdS)Nr(�z22, 3, or 4-element tuple required for '%s' lookup.r'�spheroidzHFor 4-element tuples the last argument must be the 'spheroid' directive.)r*rr-r+r,r.rrrr"s�z%DistanceLookupBase.process_rhs_paramscCsB|jd}t|d�r|�|�|j��Sd|j�|jj|j|j	�fS)Nrr8r2)
rr}r
r8r9r3�get_distancerr;r+�rrr�
dist_paramrrr�process_distance$s
���z#DistanceLookupBase.process_distanceN)rrrrGrEr"r�rrrrr�s

r�cs0eZdZdZdZ�fdd�Z�fdd�Z�ZS)�
DWithinLookup�dwithinz%%(func)s(%(lhs)s, %(rhs)s, %(value)s)cs<|jd}|jjst|d�rt|t�std��t��||�S)Nrr8zXThis backend does not support expressions for specifying distance in the dwithin lookup.)	r�features�supports_dwithin_distance_exprr}rrrrr�r�r$rrr�2s
����zDWithinLookup.process_distancecs8|�||�\}}||jd<t��||�\}}|||fS)Nr5)r�r!rr7)rrr�dist_sql�dist_paramsrBr�r$rrr7?s
zDWithinLookup.process_rhs)rrrr+rEr�r7rHrrr$rr�-s

r�c@r
)�DistanceLookupFromFunctionc	Csvt|j�dkr|jddkpd}|jj|j|j|d�}|�|�|j��\}}|�	||�\}}d||j
|d�||fS)Nr'���r�)r�z%(func)s %(op)s %(dist)s)�func�op�dist)r*rr3�distance_expr_for_lookuprr#r
r8r9r�r�)	rrrr��
distance_exprr�r�r�r�rrrrGs �z!DistanceLookupFromFunction.as_sqlNrrrrrr�Frr�c@rI)�DistanceGTLookup�distance_gt�>N�rrrr+r�rrrrr�R�r�c@rI)�DistanceGTELookup�distance_gtez>=Nr�rrrrr�Xr�r�c@rI)�DistanceLTLookup�distance_lt�<Nr�rrrrr�^r�r�c@rI)�DistanceLTELookup�distance_ltez<=Nr�rrrrr�dr�r�N)0�#django.contrib.gis.db.models.fieldsr�django.contrib.gis.measurer�	django.dbr�django.db.modelsrrr�django.db.models.sql.queryr�django.utils.regex_helperr	rr�register_lookuprJrOrQrSrUrWrYr[r]r`rbrdrgrkrmrorqrsrurwryr{r�r�r�r�r�r�r�r�r�rrrr�<module>s�L	

https://t.me/RX1948 - 2025