@@ -277,8 +277,8 @@ def clone(self) -> "Link":
277
277
title = self .title ,
278
278
)
279
279
280
- @staticmethod
281
- def from_dict (d : Dict [str , Any ]) -> "Link" :
280
+ @classmethod
281
+ def from_dict (cls , d : Dict [str , Any ]) -> "Link" :
282
282
"""Deserializes a Link from a dict.
283
283
284
284
Args:
@@ -297,55 +297,56 @@ def from_dict(d: Dict[str, Any]) -> "Link":
297
297
if any (d ):
298
298
properties = d
299
299
300
- return Link (
300
+ return cls (
301
301
rel = rel ,
302
302
target = href ,
303
303
media_type = media_type ,
304
304
title = title ,
305
305
properties = properties ,
306
306
)
307
307
308
- @staticmethod
309
- def root (c : "Catalog_Type" ) -> "Link" :
308
+ @classmethod
309
+ def root (cls , c : "Catalog_Type" ) -> "Link" :
310
310
"""Creates a link to a root Catalog or Collection."""
311
- return Link (pystac .RelType .ROOT , c , media_type = pystac .MediaType .JSON )
311
+ return cls (pystac .RelType .ROOT , c , media_type = pystac .MediaType .JSON )
312
312
313
- @staticmethod
314
- def parent (c : "Catalog_Type" ) -> "Link" :
313
+ @classmethod
314
+ def parent (cls , c : "Catalog_Type" ) -> "Link" :
315
315
"""Creates a link to a parent Catalog or Collection."""
316
- return Link (pystac .RelType .PARENT , c , media_type = pystac .MediaType .JSON )
316
+ return cls (pystac .RelType .PARENT , c , media_type = pystac .MediaType .JSON )
317
317
318
- @staticmethod
319
- def collection (c : "Collection_Type" ) -> "Link" :
318
+ @classmethod
319
+ def collection (cls , c : "Collection_Type" ) -> "Link" :
320
320
"""Creates a link to an item's Collection."""
321
- return Link (pystac .RelType .COLLECTION , c , media_type = pystac .MediaType .JSON )
321
+ return cls (pystac .RelType .COLLECTION , c , media_type = pystac .MediaType .JSON )
322
322
323
- @staticmethod
324
- def self_href (href : str ) -> "Link" :
323
+ @classmethod
324
+ def self_href (cls , href : str ) -> "Link" :
325
325
"""Creates a self link to a file's location."""
326
- return Link (pystac .RelType .SELF , href , media_type = pystac .MediaType .JSON )
326
+ return cls (pystac .RelType .SELF , href , media_type = pystac .MediaType .JSON )
327
327
328
- @staticmethod
329
- def child (c : "Catalog_Type" , title : Optional [str ] = None ) -> "Link" :
328
+ @classmethod
329
+ def child (cls , c : "Catalog_Type" , title : Optional [str ] = None ) -> "Link" :
330
330
"""Creates a link to a child Catalog or Collection."""
331
- return Link (
331
+ return cls (
332
332
pystac .RelType .CHILD , c , title = title , media_type = pystac .MediaType .JSON
333
333
)
334
334
335
- @staticmethod
336
- def item (item : "Item_Type" , title : Optional [str ] = None ) -> "Link" :
335
+ @classmethod
336
+ def item (cls , item : "Item_Type" , title : Optional [str ] = None ) -> "Link" :
337
337
"""Creates a link to an Item."""
338
- return Link (
338
+ return cls (
339
339
pystac .RelType .ITEM , item , title = title , media_type = pystac .MediaType .JSON
340
340
)
341
341
342
- @staticmethod
342
+ @classmethod
343
343
def canonical (
344
+ cls ,
344
345
item_or_collection : Union ["Item_Type" , "Collection_Type" ],
345
346
title : Optional [str ] = None ,
346
347
) -> "Link" :
347
348
"""Creates a canonical link to an Item or Collection."""
348
- return Link (
349
+ return cls (
349
350
pystac .RelType .CANONICAL ,
350
351
item_or_collection ,
351
352
title = title ,
0 commit comments