Skip to content

Commit 93518a4

Browse files
lmizzonigadomski
authored andcommitted
Fix TypeError: FileExtensionUpdated() takes no arguments
1 parent 4c8f722 commit 93518a4

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

src/stactools/sentinel3/file_extension_updated.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
from typing import List, Optional
1+
from typing import List, Optional, Union, cast
22

33
import pystac
44
from pystac.extensions.file import ByteOrder, FileExtension, MappingObject
@@ -32,10 +32,11 @@ def local_path(self, v: Optional[str]) -> None:
3232

3333
@classmethod
3434
def ext(
35-
cls, obj: pystac.Asset, add_if_missing: bool = False
35+
cls, obj: Union[pystac.Asset, pystac.Link], add_if_missing: bool = False
3636
) -> "FileExtensionUpdated":
37-
super().ext(obj, add_if_missing)
38-
return cls(obj)
37+
if not isinstance(obj, pystac.Asset):
38+
raise TypeError("FileExtensionUpdated only supports pystac.Asset objects.")
39+
return cast(FileExtensionUpdated, super().ext(obj, add_if_missing))
3940

4041
@classmethod
4142
def get_schema_uri(cls) -> str:

0 commit comments

Comments
 (0)