@@ -198,9 +198,7 @@ def _where(
198198
199199 w .append (
200200 logic .V (col .name )
201- == logic .S (
202- pg_funcs .cast (pg_funcs .cast (val , "text" ), col .type )
203- )
201+ == logic .S (pg_funcs .cast (pg_funcs .cast (val , "text" ), col .type ))
204202 )
205203
206204 if w :
@@ -226,13 +224,9 @@ def _where(
226224
227225 datetime_column = self .datetime_column (dt )
228226 if not datetime_column :
229- raise InvalidDatetimeColumnName (
230- f"Invalid Datetime Column: { dt } ."
231- )
227+ raise InvalidDatetimeColumnName (f"Invalid Datetime Column: { dt } ." )
232228
233- wheres .append (
234- self ._datetime_filter_to_sql (datetime , datetime_column .name )
235- )
229+ wheres .append (self ._datetime_filter_to_sql (datetime , datetime_column .name ))
236230
237231 # `CQL` filter
238232 if cql is not None :
@@ -248,42 +242,28 @@ def _datetime_filter_to_sql(self, interval: List[str], dt_name: str):
248242
249243 else :
250244 start = (
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
245+ parse_rfc3339 (interval [0 ]) if not interval [0 ] in [".." , "" ] else None
259246 )
247+ end = parse_rfc3339 (interval [1 ]) if not interval [1 ] in [".." , "" ] else None
260248
261249 if start is None and end is None :
262250 raise InvalidDatetime (
263251 "Double open-ended datetime intervals are not allowed."
264252 )
265253
266254 if start is not None and end is not None and start > end :
267- raise InvalidDatetime (
268- "Start datetime cannot be before end datetime."
269- )
255+ raise InvalidDatetime ("Start datetime cannot be before end datetime." )
270256
271257 if not start :
272- return logic .V (dt_name ) <= logic .S (
273- pg_funcs .cast (end , "timestamptz" )
274- )
258+ return logic .V (dt_name ) <= logic .S (pg_funcs .cast (end , "timestamptz" ))
275259
276260 elif not end :
277- return logic .V (dt_name ) >= logic .S (
278- pg_funcs .cast (start , "timestamptz" )
279- )
261+ return logic .V (dt_name ) >= logic .S (pg_funcs .cast (start , "timestamptz" ))
280262
281263 else :
282264 return pg_funcs .AND (
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" )),
265+ logic .V (dt_name ) >= logic .S (pg_funcs .cast (start , "timestamptz" )),
266+ logic .V (dt_name ) < logic .S (pg_funcs .cast (end , "timestamptz" )),
287267 )
288268
289269 def _features_query (
@@ -362,9 +342,7 @@ async def query(
362342 ) -> Tuple [FeatureCollection , int ]:
363343 """Build and run Pg query."""
364344 if geom and geom .lower () != "none" and not self .geometry_column (geom ):
365- raise InvalidGeometryColumnName (
366- f"Invalid Geometry Column: { geom } ."
367- )
345+ raise InvalidGeometryColumnName (f"Invalid Geometry Column: { geom } ." )
368346
369347 sql_query = """
370348 WITH
@@ -482,9 +460,7 @@ async def feature(
482460 def queryables (self ) -> Dict :
483461 """Return the queryables."""
484462 geoms = {
485- col .name : {
486- "$ref" : geojson_schema .get (col .geometry_type .upper (), "" )
487- }
463+ col .name : {"$ref" : geojson_schema .get (col .geometry_type .upper (), "" )}
488464 for col in self .geometry_columns
489465 }
490466 props = {
0 commit comments