1
- from typing import Any
1
+ from typing import Any , ClassVar
2
2
3
+ from django .contrib .gis .db .models .fields import GeometryField
4
+ from django .contrib .gis .db .models .sql .conversion import AreaField , DistanceField
3
5
from django .db .backends .base .base import BaseDatabaseWrapper
4
- from django .db .models import Func
6
+ from django .db .models import BinaryField , BooleanField , FloatField , Func , IntegerField , TextField
5
7
from django .db .models import Transform as StandardTransform
6
8
from django .db .models .sql .compiler import SQLCompiler , _AsSqlType
9
+ from django .utils .functional import cached_property
7
10
8
11
NUMERIC_TYPES : Any
9
12
@@ -15,8 +18,8 @@ class GeoFuncMixin:
15
18
class GeoFunc (GeoFuncMixin , Func ): ...
16
19
17
20
class GeomOutputGeoFunc (GeoFunc ):
18
- @property
19
- def output_field (self ) -> Any : ...
21
+ @cached_property
22
+ def output_field (self ) -> GeometryField : ...
20
23
21
24
class SQLiteDecimalToFloatMixin :
22
25
def as_sqlite (self , compiler : SQLCompiler , connection : BaseDatabaseWrapper , ** extra_context : Any ) -> _AsSqlType : ...
@@ -27,42 +30,42 @@ class OracleToleranceMixin:
27
30
28
31
class Area (OracleToleranceMixin , GeoFunc ):
29
32
arity : int
30
- @property
31
- def output_field (self ) -> Any : ...
33
+ @cached_property
34
+ def output_field (self ) -> AreaField : ...
32
35
def as_sqlite (self , compiler : SQLCompiler , connection : BaseDatabaseWrapper , ** extra_context : Any ) -> _AsSqlType : ...
33
36
34
37
class Azimuth (GeoFunc ):
35
- output_field : Any
38
+ output_field : ClassVar [ FloatField ]
36
39
arity : int
37
40
geom_param_pos : Any
38
41
39
42
class AsGeoJSON (GeoFunc ):
40
- output_field : Any
43
+ output_field : ClassVar [ TextField ]
41
44
def __init__ (
42
45
self , expression : Any , bbox : bool = ..., crs : bool = ..., precision : int = ..., ** extra : Any
43
46
) -> None : ...
44
47
def as_oracle (self , compiler : SQLCompiler , connection : BaseDatabaseWrapper , ** extra_context : Any ) -> _AsSqlType : ...
45
48
46
49
class AsGML (GeoFunc ):
47
50
geom_param_pos : Any
48
- output_field : Any
51
+ output_field : ClassVar [ TextField ]
49
52
def __init__ (self , expression : Any , version : int = ..., precision : int = ..., ** extra : Any ) -> None : ...
50
53
def as_oracle (self , compiler : SQLCompiler , connection : BaseDatabaseWrapper , ** extra_context : Any ) -> _AsSqlType : ...
51
54
52
55
class AsKML (GeoFunc ):
53
- output_field : Any
56
+ output_field : ClassVar [ TextField ]
54
57
def __init__ (self , expression : Any , precision : int = ..., ** extra : Any ) -> None : ...
55
58
56
59
class AsSVG (GeoFunc ):
57
- output_field : Any
60
+ output_field : ClassVar [ TextField ]
58
61
def __init__ (self , expression : Any , relative : bool = ..., precision : int = ..., ** extra : Any ) -> None : ...
59
62
60
63
class AsWKB (GeoFunc ):
61
- output_field : Any
64
+ output_field : ClassVar [ BinaryField ]
62
65
arity : int
63
66
64
67
class AsWKT (GeoFunc ):
65
- output_field : Any
68
+ output_field : ClassVar [ TextField ]
66
69
arity : int
67
70
68
71
class BoundingCircle (OracleToleranceMixin , GeomOutputGeoFunc ):
@@ -77,8 +80,8 @@ class Difference(OracleToleranceMixin, GeomOutputGeoFunc):
77
80
geom_param_pos : Any
78
81
79
82
class DistanceResultMixin :
80
- @property
81
- def output_field (self ) -> Any : ...
83
+ @cached_property
84
+ def output_field (self ) -> DistanceField : ...
82
85
def source_is_geography (self ) -> Any : ...
83
86
84
87
class Distance (DistanceResultMixin , OracleToleranceMixin , GeoFunc ):
@@ -97,20 +100,20 @@ class ForcePolygonCW(GeomOutputGeoFunc):
97
100
arity : int
98
101
99
102
class FromWKB (GeoFunc ):
100
- output_field : Any
103
+ output_field : ClassVar [ GeometryField ]
101
104
arity : int
102
105
103
106
class FromWKT (GeoFunc ):
104
- output_field : Any
107
+ output_field : ClassVar [ GeometryField ]
105
108
arity : int
106
109
107
110
class GeoHash (GeoFunc ):
108
- output_field : Any
111
+ output_field : ClassVar [ TextField ]
109
112
def __init__ (self , expression : Any , precision : Any | None = ..., ** extra : Any ) -> None : ...
110
113
def as_mysql (self , compiler : SQLCompiler , connection : BaseDatabaseWrapper , ** extra_context : Any ) -> _AsSqlType : ...
111
114
112
115
class GeometryDistance (GeoFunc ):
113
- output_field : Any
116
+ output_field : ClassVar [ FloatField ]
114
117
arity : int
115
118
function : str
116
119
arg_joiner : str
@@ -122,11 +125,11 @@ class Intersection(OracleToleranceMixin, GeomOutputGeoFunc):
122
125
123
126
class IsEmpty (GeoFuncMixin , StandardTransform ):
124
127
lookup_name : str
125
- output_field : Any
128
+ output_field : ClassVar [ BooleanField ]
126
129
127
130
class IsValid (OracleToleranceMixin , GeoFuncMixin , StandardTransform ):
128
131
lookup_name : str
129
- output_field : Any
132
+ output_field : ClassVar [ BooleanField ]
130
133
def as_oracle (self , compiler : SQLCompiler , connection : BaseDatabaseWrapper , ** extra_context : Any ) -> _AsSqlType : ...
131
134
132
135
class Length (DistanceResultMixin , OracleToleranceMixin , GeoFunc ):
@@ -138,22 +141,22 @@ class Length(DistanceResultMixin, OracleToleranceMixin, GeoFunc):
138
141
def as_sqlite (self , compiler : SQLCompiler , connection : BaseDatabaseWrapper , ** extra_context : Any ) -> _AsSqlType : ...
139
142
140
143
class LineLocatePoint (GeoFunc ):
141
- output_field : Any
144
+ output_field : ClassVar [ FloatField ]
142
145
arity : int
143
146
geom_param_pos : Any
144
147
145
148
class MakeValid (GeomOutputGeoFunc ): ...
146
149
147
150
class MemSize (GeoFunc ):
148
- output_field : Any
151
+ output_field : ClassVar [ IntegerField ]
149
152
arity : int
150
153
151
154
class NumGeometries (GeoFunc ):
152
- output_field : Any
155
+ output_field : ClassVar [ IntegerField ]
153
156
arity : int
154
157
155
158
class NumPoints (GeoFunc ):
156
- output_field : Any
159
+ output_field : ClassVar [ IntegerField ]
157
160
arity : int
158
161
159
162
class Perimeter (DistanceResultMixin , OracleToleranceMixin , GeoFunc ):
0 commit comments