-
Notifications
You must be signed in to change notification settings - Fork 2
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
pystac extension not handling well name
property
#63
Comments
Can you try replacing by the following and see if that works? @classmethod
def name(cls) -> SchemaName:
return get_args(SchemaName)[0] |
That would return a |
class CMIP6Extension:
name = get_args(SchemaName)[0]
... minimal example: from typing import get_args, Literal
SchemaName = Literal["cmip6"]
class CMIP6Extension:
name = get_args(SchemaName)[0]
...
getattr(CMIP6Extension, "name") # returns "cmip6" Note that if the annotation matters for pydantic we may need to annotate the class variable as well: name: SchemaName = get_args(SchemaName)[0] |
The class where it appears is not a pydantic BaseModel, so a simple class attribute will work. |
Could use Otherwise, the simple class attribute as mentioned by @mishaschwartz also works. |
The
CMIP6Extension
has aname
property:but this is not handled well by pystac.extensions: https://github.com/stac-utils/pystac/blob/ba406cb7991f992ac6f38026aa779adcc6a4f67a/pystac/extensions/base.py#L258
where
getattr(cls, "name")
returns a property object, not the actual name.The text was updated successfully, but these errors were encountered: