Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix TypeError: FileExtensionUpdated() takes no arguments #34

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions src/stactools/sentinel3/file_extension_updated.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from typing import List, Optional
from typing import List, Optional, Union, cast

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

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

@classmethod
def get_schema_uri(cls) -> str:
Expand Down
2 changes: 1 addition & 1 deletion src/stactools/sentinel3/properties.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ def fill_eo_properties(eo_ext: EOExtension, manifest: XmlElement) -> None:
def find_or_throw(attribute: str, xpath: str) -> str:
value = manifest.find_attr(attribute, xpath)
if value is None:
raise RuntimeError(f"Value not found in manifest: {xpath}@{attribute}")
raise RuntimeError(f"Value not in manifest: {xpath}@{attribute}")
return value

product_name = xml.find_text(manifest, ".//sentinel3:productName")
Expand Down