Skip to content

Commit 64825db

Browse files
committed
refactor(api)!: make GeoSpatialValue.contains positional-only
1 parent 94758b1 commit 64825db

File tree

1 file changed

+28
-25
lines changed

1 file changed

+28
-25
lines changed

ibis/expr/types/geospatial.py

Lines changed: 28 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ def as_ewkb(self) -> ir.BinaryValue:
111111
"""
112112
return ops.GeoAsEWKB(self).to_expr()
113113

114-
def contains(self, right: GeoSpatialValue) -> ir.BooleanValue:
114+
def contains(self, right: GeoSpatialValue, /) -> ir.BooleanValue:
115115
"""Check if the geometry contains the `right`.
116116
117117
Parameters
@@ -153,7 +153,7 @@ def contains(self, right: GeoSpatialValue) -> ir.BooleanValue:
153153
"""
154154
return ops.GeoContains(self, right).to_expr()
155155

156-
def contains_properly(self, right: GeoSpatialValue) -> ir.BooleanValue:
156+
def contains_properly(self, right: GeoSpatialValue, /) -> ir.BooleanValue:
157157
"""Check if the first geometry contains the second one.
158158
159159
Excludes common border points.
@@ -170,7 +170,7 @@ def contains_properly(self, right: GeoSpatialValue) -> ir.BooleanValue:
170170
"""
171171
return ops.GeoContainsProperly(self, right).to_expr()
172172

173-
def covers(self, right: GeoSpatialValue) -> ir.BooleanValue:
173+
def covers(self, right: GeoSpatialValue, /) -> ir.BooleanValue:
174174
"""Check if the first geometry covers the second one.
175175
176176
Parameters
@@ -215,7 +215,7 @@ def covers(self, right: GeoSpatialValue) -> ir.BooleanValue:
215215
"""
216216
return ops.GeoCovers(self, right).to_expr()
217217

218-
def covered_by(self, right: GeoSpatialValue) -> ir.BooleanValue:
218+
def covered_by(self, right: GeoSpatialValue, /) -> ir.BooleanValue:
219219
"""Check if the first geometry is covered by the second one.
220220
221221
Parameters
@@ -280,7 +280,7 @@ def covered_by(self, right: GeoSpatialValue) -> ir.BooleanValue:
280280
"""
281281
return ops.GeoCoveredBy(self, right).to_expr()
282282

283-
def crosses(self, right: GeoSpatialValue) -> ir.BooleanValue:
283+
def crosses(self, right: GeoSpatialValue, /) -> ir.BooleanValue:
284284
"""Check if the geometries have at least one, but not all, interior points in common.
285285
286286
Parameters
@@ -345,6 +345,8 @@ def crosses(self, right: GeoSpatialValue) -> ir.BooleanValue:
345345
def d_fully_within(
346346
self,
347347
right: GeoSpatialValue,
348+
/,
349+
*,
348350
distance: ir.FloatingValue,
349351
) -> ir.BooleanValue:
350352
"""Check if `self` is entirely within `distance` from `right`.
@@ -363,7 +365,7 @@ def d_fully_within(
363365
"""
364366
return ops.GeoDFullyWithin(self, right, distance).to_expr()
365367

366-
def disjoint(self, right: GeoSpatialValue) -> ir.BooleanValue:
368+
def disjoint(self, right: GeoSpatialValue, /) -> ir.BooleanValue:
367369
"""Check if the geometries have no points in common.
368370
369371
Parameters
@@ -468,7 +470,7 @@ def d_within(
468470
"""
469471
return ops.GeoDWithin(self, right, distance).to_expr()
470472

471-
def geo_equals(self, right: GeoSpatialValue) -> ir.BooleanValue:
473+
def geo_equals(self, right: GeoSpatialValue, /) -> ir.BooleanValue:
472474
"""Check if the geometries are equal.
473475
474476
Parameters
@@ -507,7 +509,7 @@ def geo_equals(self, right: GeoSpatialValue) -> ir.BooleanValue:
507509
"""
508510
return ops.GeoEquals(self, right).to_expr()
509511

510-
def geometry_n(self, n: int | ir.IntegerValue) -> GeoSpatialValue:
512+
def geometry_n(self, n: int | ir.IntegerValue, /) -> GeoSpatialValue:
511513
"""Get the 1-based Nth geometry of a multi geometry.
512514
513515
Parameters
@@ -556,7 +558,7 @@ def geometry_type(self) -> ir.StringValue:
556558
"""
557559
return ops.GeoGeometryType(self).to_expr()
558560

559-
def intersects(self, right: GeoSpatialValue) -> ir.BooleanValue:
561+
def intersects(self, right: GeoSpatialValue, /) -> ir.BooleanValue:
560562
"""Check if the geometries share any points.
561563
562564
Parameters
@@ -632,7 +634,7 @@ def is_valid(self) -> ir.BooleanValue:
632634
"""
633635
return ops.GeoIsValid(self).to_expr()
634636

635-
def ordering_equals(self, right: GeoSpatialValue) -> ir.BooleanValue:
637+
def ordering_equals(self, right: GeoSpatialValue, /) -> ir.BooleanValue:
636638
"""Check if two geometries are equal and have the same point ordering.
637639
638640
Returns true if the two geometries are equal and the coordinates
@@ -650,7 +652,7 @@ def ordering_equals(self, right: GeoSpatialValue) -> ir.BooleanValue:
650652
"""
651653
return ops.GeoOrderingEquals(self, right).to_expr()
652654

653-
def overlaps(self, right: GeoSpatialValue) -> ir.BooleanValue:
655+
def overlaps(self, right: GeoSpatialValue, /) -> ir.BooleanValue:
654656
"""Check if the geometries share space, have the same dimension, and are not completely contained by each other.
655657
656658
Parameters
@@ -695,7 +697,7 @@ def overlaps(self, right: GeoSpatialValue) -> ir.BooleanValue:
695697
"""
696698
return ops.GeoOverlaps(self, right).to_expr()
697699

698-
def touches(self, right: GeoSpatialValue) -> ir.BooleanValue:
700+
def touches(self, right: GeoSpatialValue, /) -> ir.BooleanValue:
699701
"""Check if the geometries have at least one point in common, but do not intersect.
700702
701703
Parameters
@@ -740,7 +742,7 @@ def touches(self, right: GeoSpatialValue) -> ir.BooleanValue:
740742
"""
741743
return ops.GeoTouches(self, right).to_expr()
742744

743-
def distance(self, right: GeoSpatialValue) -> ir.FloatingValue:
745+
def distance(self, right: GeoSpatialValue, /) -> ir.FloatingValue:
744746
"""Compute the distance between two geospatial expressions.
745747
746748
Parameters
@@ -840,7 +842,7 @@ def perimeter(self) -> ir.FloatingValue:
840842
"""
841843
return ops.GeoPerimeter(self).to_expr()
842844

843-
def max_distance(self, right: GeoSpatialValue) -> ir.FloatingValue:
845+
def max_distance(self, right: GeoSpatialValue, /) -> ir.FloatingValue:
844846
"""Returns the 2-dimensional max distance between two geometries in projected units.
845847
846848
If `self` and `right` are the same geometry the function will return
@@ -859,7 +861,7 @@ def max_distance(self, right: GeoSpatialValue) -> ir.FloatingValue:
859861
"""
860862
return ops.GeoMaxDistance(self, right).to_expr()
861863

862-
def union(self, right: GeoSpatialValue) -> GeoSpatialValue:
864+
def union(self, right: GeoSpatialValue, /) -> GeoSpatialValue:
863865
"""Merge two geometries into a union geometry.
864866
865867
Returns the pointwise union of the two geometries.
@@ -1070,7 +1072,7 @@ def end_point(self) -> PointValue:
10701072
"""
10711073
return ops.GeoEndPoint(self).to_expr()
10721074

1073-
def point_n(self, n: ir.IntegerValue) -> PointValue:
1075+
def point_n(self, n: ir.IntegerValue, /) -> PointValue:
10741076
"""Return the Nth point in a single linestring in the geometry.
10751077
10761078
Negative values are counted backwards from the end of the LineString,
@@ -1145,7 +1147,7 @@ def srid(self) -> ir.IntegerValue:
11451147
"""
11461148
return ops.GeoSRID(self).to_expr()
11471149

1148-
def set_srid(self, srid: ir.IntegerValue) -> GeoSpatialValue:
1150+
def set_srid(self, srid: ir.IntegerValue, /) -> GeoSpatialValue:
11491151
"""Set the spatial reference identifier for the `ST_Geometry`.
11501152
11511153
Parameters
@@ -1160,7 +1162,7 @@ def set_srid(self, srid: ir.IntegerValue) -> GeoSpatialValue:
11601162
"""
11611163
return ops.GeoSetSRID(self, srid=srid).to_expr()
11621164

1163-
def buffer(self, radius: float | ir.FloatingValue) -> GeoSpatialValue:
1165+
def buffer(self, radius: float | ir.FloatingValue, /) -> GeoSpatialValue:
11641166
"""Return all points whose distance from this geometry is less than or equal to `radius`.
11651167
11661168
Calculations are in the Spatial Reference System of this Geometry.
@@ -1290,7 +1292,7 @@ def envelope(self) -> ir.PolygonValue:
12901292
"""
12911293
return ops.GeoEnvelope(self).to_expr()
12921294

1293-
def within(self, right: GeoSpatialValue) -> ir.BooleanValue:
1295+
def within(self, right: GeoSpatialValue, /) -> ir.BooleanValue:
12941296
"""Check if the first geometry is completely inside of the second.
12951297
12961298
Parameters
@@ -1326,7 +1328,7 @@ def within(self, right: GeoSpatialValue) -> ir.BooleanValue:
13261328
"""
13271329
return ops.GeoWithin(self, right).to_expr()
13281330

1329-
def azimuth(self, right: GeoSpatialValue) -> ir.FloatingValue:
1331+
def azimuth(self, right: GeoSpatialValue, /) -> ir.FloatingValue:
13301332
"""Return the angle in radians from the horizontal of the vector defined by the inputs.
13311333
13321334
Angle is computed clockwise from down-to-up on the clock: 12=0; 3=PI/2; 6=PI; 9=3PI/2.
@@ -1343,7 +1345,7 @@ def azimuth(self, right: GeoSpatialValue) -> ir.FloatingValue:
13431345
"""
13441346
return ops.GeoAzimuth(self, right).to_expr()
13451347

1346-
def intersection(self, right: GeoSpatialValue) -> GeoSpatialValue:
1348+
def intersection(self, right: GeoSpatialValue, /) -> GeoSpatialValue:
13471349
"""Return the intersection of two geometries.
13481350
13491351
Parameters
@@ -1382,7 +1384,7 @@ def intersection(self, right: GeoSpatialValue) -> GeoSpatialValue:
13821384
"""
13831385
return ops.GeoIntersection(self, right).to_expr()
13841386

1385-
def difference(self, right: GeoSpatialValue) -> GeoSpatialValue:
1387+
def difference(self, right: GeoSpatialValue, /) -> GeoSpatialValue:
13861388
"""Return the difference of two geometries.
13871389
13881390
Parameters
@@ -1433,6 +1435,7 @@ def difference(self, right: GeoSpatialValue) -> GeoSpatialValue:
14331435

14341436
def simplify(
14351437
self,
1438+
*,
14361439
tolerance: ir.FloatingValue,
14371440
preserve_collapsed: ir.BooleanValue,
14381441
) -> GeoSpatialValue:
@@ -1452,7 +1455,7 @@ def simplify(
14521455
"""
14531456
return ops.GeoSimplify(self, tolerance, preserve_collapsed).to_expr()
14541457

1455-
def transform(self, srid: ir.IntegerValue) -> GeoSpatialValue:
1458+
def transform(self, srid: ir.IntegerValue, /) -> GeoSpatialValue:
14561459
"""Transform a geometry into a new SRID.
14571460
14581461
Parameters
@@ -1529,7 +1532,7 @@ def convert(
15291532
"""
15301533
return ops.GeoConvert(self, source, target).to_expr()
15311534

1532-
def line_locate_point(self, right: PointValue) -> ir.FloatingValue:
1535+
def line_locate_point(self, right: PointValue, /) -> ir.FloatingValue:
15331536
"""Locate the distance a point falls along the length of a line.
15341537
15351538
Returns a float between zero and one representing the location of the
@@ -1631,7 +1634,7 @@ class GeoSpatialScalar(NumericScalar, GeoSpatialValue):
16311634
@public
16321635
class GeoSpatialColumn(NumericColumn, GeoSpatialValue):
16331636
def unary_union(
1634-
self, where: bool | ir.BooleanValue | None = None
1637+
self, *, where: bool | ir.BooleanValue | None = None
16351638
) -> ir.GeoSpatialScalar:
16361639
"""Aggregate a set of geometries into a union.
16371640

0 commit comments

Comments
 (0)