Skip to content

Switch obstore requirement to obspec protocol #28

@kylebarron

Description

@kylebarron

store: ObjectStore | None = None,

This ties to obstore specifically, but is unnecessarily strict for what's required. At the end of the day it looks like the store is only used for GeoTIFF.open

geotiff = await GeoTIFF.open(path, store=store)

I'd suggest only requiring the ObspecInput type, which is just:

from typing import Protocol

from obspec import GetRangeAsync, GetRangesAsync


class ObspecInput(GetRangeAsync, GetRangesAsync, Protocol):
    """Supported obspec input to reader.

    Anything that implements [GetRangeAsync][obspec.GetRangeAsync] and
    [GetRangesAsync][obspec.GetRangesAsync] can be used as an input to the TIFF reader.
    """

So it's defined as requiring just GetRangeAsync and GetRangesAsync

It also seems like the typing is a bit lax:

store: Any | None

Ideally we'd avoid the use of Any where we have a known type such as here

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions