Skip to content

Description of extra_fields #318

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

Closed
schwehr opened this issue Apr 30, 2021 · 3 comments
Closed

Description of extra_fields #318

schwehr opened this issue Apr 30, 2021 · 3 comments

Comments

@schwehr
Copy link
Collaborator

schwehr commented Apr 30, 2021

Another argument for working towards more type annotations.

The doc strings say dict or None, but in catalog.py:

    def __init__(self,
                 id,
                 description,
                 title=None,
                 stac_extensions=None,
                 extra_fields=None,
                 href=None,
                 catalog_type=CatalogType.ABSOLUTE_PUBLISHED):
        super().__init__(stac_extensions)

        self.id = id
        self.description = description
        self.title = title
        if extra_fields is None:
            self.extra_fields = {}  # <--- This isn't None
        else:
            self.extra_fields = extra_fields

I think these should just say Dict.

catalog.py says:

    Attributes:
        id (str): Identifier for the catalog.
        description (str): Detailed multi-line description to fully explain the catalog.
        title (str or None): Optional short descriptive one-line title for the catalog.
        stac_extensions (List[str] or None): Optional list of extensions the Catalog implements.
        extra_fields (dict or None): Extra fields that are part of the top-level JSON properties
            of the Catalog.
        links (List[Link]): A list of :class:`~pystac.Link` objects representing
            all links associated with this Catalog.
        catalog_type (str or None): The catalog type, or None if not known.

collections.py says:

    Attributes:
        id (str): Identifier for the collection.
        description (str): Detailed multi-line description to fully explain the collection.
        extent (Extent): Spatial and temporal extents that describe the bounds of
            all items contained within this Collection.
        title (str or None): Optional short descriptive one-line title for the collection.
        stac_extensions (List[str]): Optional list of extensions the Collection implements.
        keywords (List[str] or None): Optional list of keywords describing the collection.
        providers (List[Provider] or None): Optional list of providers of this Collection.
        properties (dict or None): Optional dict of common fields across referenced items.
        summaries (dict or None): An optional map of property summaries,
            either a set of values or statistics such as a range.
        links (List[Link]): A list of :class:`~pystac.Link` objects representing
            all links associated with this Collection.
        extra_fields (dict or None): Extra fields that are part of the top-level JSON properties
            of the Catalog.
@lossyrob
Copy link
Member

lossyrob commented May 1, 2021

Have you seen #309? This places full type annotations into the library. Btw, that just became ready for review, so thoughts are appreciated, though there are known issues with docstrings.

I think now that there are type annotations (once that pr is merged) I'd recommend removing type information from the docstrings. It would be great to get help with this.

@schwehr
Copy link
Collaborator Author

schwehr commented May 1, 2021

Cool. I'll take a look. Happy to help. I'm still just a beginner at type annotations, but I've been doing more of them lately.

@lossyrob
Copy link
Member

lossyrob commented May 4, 2021

Will be solved by #323

@lossyrob lossyrob closed this as completed May 4, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants