@@ -41,10 +41,10 @@ class STBox:
4141 _mobilitydb_name = "stbox"
4242
4343 def _get_box (
44- self ,
45- other : Union [shp .BaseGeometry , STBox , Temporal , Time ],
46- allow_space_only : bool = True ,
47- allow_time_only : bool = False ,
44+ self ,
45+ other : Union [shp .BaseGeometry , STBox , Temporal , Time ],
46+ allow_space_only : bool = True ,
47+ allow_time_only : bool = False ,
4848 ) -> STBox :
4949 if allow_space_only and isinstance (other , shp .BaseGeometry ):
5050 other_box = geo_to_stbox (geo_to_gserialized (other , self .geodetic ()))
@@ -68,31 +68,31 @@ def _get_box(
6868
6969 # ------------------------- Constructors ----------------------------------
7070 def __init__ (
71- self ,
72- string : Optional [str ] = None ,
73- * ,
74- xmin : Optional [Union [str , float ]] = None ,
75- xmax : Optional [Union [str , float ]] = None ,
76- ymin : Optional [Union [str , float ]] = None ,
77- ymax : Optional [Union [str , float ]] = None ,
78- zmin : Optional [Union [str , float ]] = None ,
79- zmax : Optional [Union [str , float ]] = None ,
80- tmin : Optional [Union [str , datetime ]] = None ,
81- tmax : Optional [Union [str , datetime ]] = None ,
82- tmin_inc : bool = True ,
83- tmax_inc : bool = True ,
84- geodetic : bool = False ,
85- srid : Optional [int ] = None ,
86- _inner = None ,
71+ self ,
72+ string : Optional [str ] = None ,
73+ * ,
74+ xmin : Optional [Union [str , float ]] = None ,
75+ xmax : Optional [Union [str , float ]] = None ,
76+ ymin : Optional [Union [str , float ]] = None ,
77+ ymax : Optional [Union [str , float ]] = None ,
78+ zmin : Optional [Union [str , float ]] = None ,
79+ zmax : Optional [Union [str , float ]] = None ,
80+ tmin : Optional [Union [str , datetime ]] = None ,
81+ tmax : Optional [Union [str , datetime ]] = None ,
82+ tmin_inc : bool = True ,
83+ tmax_inc : bool = True ,
84+ geodetic : bool = False ,
85+ srid : Optional [int ] = None ,
86+ _inner = None ,
8787 ):
8888 assert (_inner is not None ) or (string is not None ) != (
89- (
90- xmin is not None
91- and xmax is not None
92- and ymin is not None
93- and ymax is not None
94- )
95- or (tmin is not None and tmax is not None )
89+ (
90+ xmin is not None
91+ and xmax is not None
92+ and ymin is not None
93+ and ymax is not None
94+ )
95+ or (tmin is not None and tmax is not None )
9696 ), (
9797 "Either string must be not None or at least a bound pair (xmin/max"
9898 " and ymin/max, or tmin/max) must be not None"
@@ -106,10 +106,10 @@ def __init__(
106106 tstzspan = None
107107 hast = tmin is not None and tmax is not None
108108 hasx = (
109- xmin is not None
110- and xmax is not None
111- and ymin is not None
112- and ymax is not None
109+ xmin is not None
110+ and xmax is not None
111+ and ymin is not None
112+ and ymax is not None
113113 )
114114 hasz = zmin is not None and zmax is not None
115115 if hast :
@@ -224,9 +224,9 @@ def from_time(time: Time) -> STBox:
224224
225225 @staticmethod
226226 def from_geometry_time (
227- geometry : shp .BaseGeometry ,
228- time : Union [datetime , TsTzSpan ],
229- geodetic : bool = False ,
227+ geometry : shp .BaseGeometry ,
228+ time : Union [datetime , TsTzSpan ],
229+ geodetic : bool = False ,
230230 ) -> STBox :
231231 """
232232 Returns a `STBox` from a space and time dimension.
@@ -272,9 +272,9 @@ def from_tpoint(temporal: TPoint) -> STBox:
272272
273273 @staticmethod
274274 def from_expanding_bounding_box (
275- value : Union [shp .BaseGeometry , TPoint , STBox ],
276- expansion : float ,
277- geodetic : Optional [bool ] = False ,
275+ value : Union [shp .BaseGeometry , TPoint , STBox ],
276+ expansion : float ,
277+ geodetic : Optional [bool ] = False ,
278278 ) -> STBox :
279279 """
280280 Returns a `STBox` from a `shp.BaseGeometry`, `TPoint` or `STBox` instance,
@@ -661,7 +661,7 @@ def scale_time(self, duration: timedelta) -> STBox:
661661 return self .shift_scale_time (duration = duration )
662662
663663 def shift_scale_time (
664- self , shift : Optional [timedelta ] = None , duration : Optional [timedelta ] = None
664+ self , shift : Optional [timedelta ] = None , duration : Optional [timedelta ] = None
665665 ) -> STBox :
666666 """
667667 Returns a new `STBox` with the time dimension shifted by `shift` and
@@ -681,7 +681,7 @@ def shift_scale_time(
681681 :meth:`TsTzSpan.shift_scale`
682682 """
683683 assert (
684- shift is not None or duration is not None
684+ shift is not None or duration is not None
685685 ), "shift and scale deltas must not be both None"
686686 result = stbox_shift_scale_time (
687687 self ._inner ,
@@ -792,7 +792,7 @@ def __mul__(self, other):
792792
793793 # ------------------------- Topological Operations ------------------------
794794 def is_adjacent (
795- self , other : Union [shp .BaseGeometry , STBox , Temporal , Time ]
795+ self , other : Union [shp .BaseGeometry , STBox , Temporal , Time ]
796796 ) -> bool :
797797 """
798798 Returns whether ``self`` and `other` are adjacent. Two spatiotemporal
@@ -815,7 +815,7 @@ def is_adjacent(
815815 )
816816
817817 def is_contained_in (
818- self , container : Union [shp .BaseGeometry , STBox , Temporal , Time ]
818+ self , container : Union [shp .BaseGeometry , STBox , Temporal , Time ]
819819 ) -> bool :
820820 """
821821 Returns whether ``self`` is contained in `container`. Note that for
@@ -1177,7 +1177,7 @@ def is_over_or_after(self, other: Union[Box, Temporal, Time]) -> bool:
11771177
11781178 # ------------------------- Distance Operations ---------------------------
11791179 def nearest_approach_distance (
1180- self , other : Union [shp .BaseGeometry , STBox , TPoint ]
1180+ self , other : Union [shp .BaseGeometry , STBox , TPoint ]
11811181 ) -> float :
11821182 """
11831183 Returns the distance between the nearest points of ``self`` and `other`.
@@ -1277,11 +1277,11 @@ def quad_split(self) -> Union[List[List[STBox]], List[List[List[STBox]]]]:
12771277 ]
12781278
12791279 def tile (
1280- self ,
1281- size : Optional [float ] = None ,
1282- duration : Optional [Union [timedelta , str ]] = None ,
1283- origin : Optional [shp .BaseGeometry ] = None ,
1284- start : Union [datetime , str , None ] = None ,
1280+ self ,
1281+ size : Optional [float ] = None ,
1282+ duration : Optional [Union [timedelta , str ]] = None ,
1283+ origin : Optional [shp .BaseGeometry ] = None ,
1284+ start : Union [datetime , str , None ] = None ,
12851285 ) -> List [STBox ]:
12861286 """
12871287 Returns a list of `STBox` instances representing the tiles of
@@ -1306,35 +1306,35 @@ def tile(
13061306 stbox_tile_list
13071307 """
13081308 sz = size or (
1309- max (
1310- self .xmax () - self .xmin (),
1311- self .ymax () - self .ymin (),
1312- (self .zmax () - self .zmin () if self .has_z () else 0 ),
1313- )
1314- + 1
1309+ max (
1310+ self .xmax () - self .xmin (),
1311+ self .ymax () - self .ymin (),
1312+ (self .zmax () - self .zmin () if self .has_z () else 0 ),
1313+ )
1314+ + 1
13151315 )
13161316 dt = (
13171317 timedelta_to_interval (duration )
13181318 if isinstance (duration , timedelta )
1319- else pg_interval_in (duration , - 1 )
1320- if isinstance (duration , str )
1321- else None
1319+ else pg_interval_in (duration , - 1 ) if isinstance (duration , str ) else None
13221320 )
13231321 st = (
13241322 datetime_to_timestamptz (start )
13251323 if isinstance (start , datetime )
1326- else pg_timestamptz_in ( start , - 1 )
1327- if isinstance (start , str )
1328- else pg_timestamptz_in ( "2000-01-03" , - 1 )
1329- if self .has_t ()
1330- else 0
1324+ else (
1325+ pg_timestamptz_in (start , - 1 )
1326+ if isinstance ( start , str )
1327+ else pg_timestamptz_in ( "2000-01-03" , - 1 ) if self .has_t () else 0
1328+ )
13311329 )
13321330 gs = (
13331331 geo_to_gserialized (origin , self .geodetic ())
13341332 if origin is not None
1335- else pgis_geography_in ("Point(0 0 0)" , - 1 )
1336- if self .geodetic ()
1337- else pgis_geometry_in ("Point(0 0 0)" , - 1 )
1333+ else (
1334+ pgis_geography_in ("Point(0 0 0)" , - 1 )
1335+ if self .geodetic ()
1336+ else pgis_geometry_in ("Point(0 0 0)" , - 1 )
1337+ )
13381338 )
13391339 tiles , count = stbox_tile_list (self ._inner , sz , sz , sz , dt , gs , st )
13401340 return [STBox (_inner = tiles + i ) for i in range (count )]
0 commit comments