@@ -198,7 +198,9 @@ def _where(
198198
199199 w .append (
200200 logic .V (col .name )
201- == logic .S (pg_funcs .cast (pg_funcs .cast (val , "text" ), col .type ))
201+ == logic .S (
202+ pg_funcs .cast (pg_funcs .cast (val , "text" ), col .type )
203+ )
202204 )
203205
204206 if w :
@@ -224,9 +226,13 @@ def _where(
224226
225227 datetime_column = self .datetime_column (dt )
226228 if not datetime_column :
227- raise InvalidDatetimeColumnName (f"Invalid Datetime Column: { dt } ." )
229+ raise InvalidDatetimeColumnName (
230+ f"Invalid Datetime Column: { dt } ."
231+ )
228232
229- wheres .append (self ._datetime_filter_to_sql (datetime , datetime_column .name ))
233+ wheres .append (
234+ self ._datetime_filter_to_sql (datetime , datetime_column .name )
235+ )
230236
231237 # `CQL` filter
232238 if cql is not None :
@@ -242,28 +248,42 @@ def _datetime_filter_to_sql(self, interval: List[str], dt_name: str):
242248
243249 else :
244250 start = (
245- parse_rfc3339 (interval [0 ]) if not interval [0 ] in [".." , "" ] else None
251+ parse_rfc3339 (interval [0 ])
252+ if not interval [0 ] in [".." , "" ]
253+ else None
254+ )
255+ end = (
256+ parse_rfc3339 (interval [1 ])
257+ if not interval [1 ] in [".." , "" ]
258+ else None
246259 )
247- end = parse_rfc3339 (interval [1 ]) if not interval [1 ] in [".." , "" ] else None
248260
249261 if start is None and end is None :
250262 raise InvalidDatetime (
251263 "Double open-ended datetime intervals are not allowed."
252264 )
253265
254266 if start is not None and end is not None and start > end :
255- raise InvalidDatetime ("Start datetime cannot be before end datetime." )
267+ raise InvalidDatetime (
268+ "Start datetime cannot be before end datetime."
269+ )
256270
257271 if not start :
258- return logic .V (dt_name ) <= logic .S (pg_funcs .cast (end , "timestamptz" ))
272+ return logic .V (dt_name ) <= logic .S (
273+ pg_funcs .cast (end , "timestamptz" )
274+ )
259275
260276 elif not end :
261- return logic .V (dt_name ) >= logic .S (pg_funcs .cast (start , "timestamptz" ))
277+ return logic .V (dt_name ) >= logic .S (
278+ pg_funcs .cast (start , "timestamptz" )
279+ )
262280
263281 else :
264282 return pg_funcs .AND (
265- logic .V (dt_name ) >= logic .S (pg_funcs .cast (start , "timestamptz" )),
266- logic .V (dt_name ) < logic .S (pg_funcs .cast (end , "timestamptz" )),
283+ logic .V (dt_name )
284+ >= logic .S (pg_funcs .cast (start , "timestamptz" )),
285+ logic .V (dt_name )
286+ < logic .S (pg_funcs .cast (end , "timestamptz" )),
267287 )
268288
269289 def _features_query (
@@ -342,7 +362,9 @@ async def query(
342362 ) -> Tuple [FeatureCollection , int ]:
343363 """Build and run Pg query."""
344364 if geom and geom .lower () != "none" and not self .geometry_column (geom ):
345- raise InvalidGeometryColumnName (f"Invalid Geometry Column: { geom } ." )
365+ raise InvalidGeometryColumnName (
366+ f"Invalid Geometry Column: { geom } ."
367+ )
346368
347369 sql_query = """
348370 WITH
@@ -460,7 +482,9 @@ async def feature(
460482 def queryables (self ) -> Dict :
461483 """Return the queryables."""
462484 geoms = {
463- col .name : {"$ref" : geojson_schema .get (col .geometry_type .upper (), "" )}
485+ col .name : {
486+ "$ref" : geojson_schema .get (col .geometry_type .upper (), "" )
487+ }
464488 for col in self .geometry_columns
465489 }
466490 props = {
0 commit comments