@@ -271,22 +271,28 @@ class STAC_IO:
271
271
"""
272
272
273
273
@staticmethod
274
- def read_text_method ( uri : str ) -> str :
274
+ def issue_deprecation_warning ( ) -> None :
275
275
warnings .warn (
276
- "STAC_IO is deprecated. "
277
- "Please use instances of StacIO (e.g. StacIO.default())." ,
276
+ "STAC_IO is deprecated and will be removed in v1.0.0 . "
277
+ "Please use instances of StacIO (e.g. StacIO.default()) instead ." ,
278
278
DeprecationWarning ,
279
279
)
280
+
281
+ def __init__ (self ) -> None :
282
+ STAC_IO .issue_deprecation_warning ()
283
+
284
+ def __init_subclass__ (cls ) -> None :
285
+ STAC_IO .issue_deprecation_warning ()
286
+
287
+ @staticmethod
288
+ def read_text_method (uri : str ) -> str :
289
+ STAC_IO .issue_deprecation_warning ()
280
290
return StacIO .default ().read_text (uri )
281
291
282
292
@staticmethod
283
293
def write_text_method (uri : str , txt : str ) -> None :
284
294
"""Default method for writing text."""
285
- warnings .warn (
286
- "STAC_IO is deprecated. "
287
- "Please use instances of StacIO (e.g. StacIO.default())." ,
288
- DeprecationWarning ,
289
- )
295
+ STAC_IO .issue_deprecation_warning ()
290
296
return StacIO .default ().write_text (uri , txt )
291
297
292
298
@staticmethod
@@ -295,11 +301,7 @@ def stac_object_from_dict(
295
301
href : Optional [str ] = None ,
296
302
root : Optional ["Catalog_Type" ] = None ,
297
303
) -> "STACObject_Type" :
298
- warnings .warn (
299
- "STAC_IO is deprecated. "
300
- "Please use instances of StacIO (e.g. StacIO.default())." ,
301
- DeprecationWarning ,
302
- )
304
+ STAC_IO .issue_deprecation_warning ()
303
305
return pystac .serialization .stac_object_from_dict (d , href , root )
304
306
305
307
# This is set in __init__.py
@@ -356,6 +358,7 @@ def read_json(cls, uri: str) -> Dict[str, Any]:
356
358
STAC_IO in order to enable additional URI types, replace that member
357
359
with your own implementation.
358
360
"""
361
+ STAC_IO .issue_deprecation_warning ()
359
362
result : Dict [str , Any ] = json .loads (STAC_IO .read_text (uri ))
360
363
return result
361
364
0 commit comments