Skip to content

Fix arro3-core import error #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

Merged
merged 1 commit into from
Mar 5, 2025
Merged
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
1 change: 0 additions & 1 deletion obstore/python/obstore/__init__.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
from typing import TYPE_CHECKING

from .__get import GetOptions, OffsetRange, SuffixRange
from .__list import ListChunkType, ListResult, ObjectMeta
from .__put import PutMode, PutResult, UpdateVersion
from .__sign import HTTP_METHOD
from ._attributes import Attribute, Attributes
Expand Down
54 changes: 0 additions & 54 deletions obstore/python/obstore/__list.py

This file was deleted.

3 changes: 2 additions & 1 deletion obstore/python/obstore/_get.pyi
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
from collections.abc import Sequence

from .__get import GetOptions
from .__list import ObjectMeta
from ._attributes import Attributes
from ._bytes import Bytes
from ._list import ObjectMeta
from .store import ObjectStore

class GetResult:
Expand Down Expand Up @@ -106,6 +106,7 @@ class BytesStream:
file is large, it may exceed the default timeout of 30 seconds. In this case,
you may see an error like:

x
```
GenericError: Generic {
store: "HTTP",
Expand Down
47 changes: 45 additions & 2 deletions obstore/python/obstore/_list.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,56 @@
# ruff: noqa: A001
# Variable `list` is shadowing a Python builtinRuff

from typing import Generic, List, Literal, Self, overload
from datetime import datetime
from typing import Generic, List, Literal, Self, TypedDict, TypeVar, overload

from arro3.core import RecordBatch, Table

from .__list import ListChunkType, ListResult, ObjectMeta
from .store import ObjectStore

class ObjectMeta(TypedDict):
"""The metadata that describes an object."""

path: str
"""The full path to the object"""

last_modified: datetime
"""The last modified time"""

size: int
"""The size in bytes of the object"""

e_tag: str | None
"""The unique identifier for the object

<https://datatracker.ietf.org/doc/html/rfc9110#name-etag>
"""

version: str | None
"""A version indicator for this object"""

ListChunkType = TypeVar("ListChunkType", List[ObjectMeta], RecordBatch, Table) # noqa: PYI001
"""The data structure used for holding list results.

By default, listing APIs return a `list` of [`ObjectMeta`][obstore.ObjectMeta]. However
for improved performance when listing large buckets, you can pass `return_arrow=True`.
Then an Arrow `RecordBatch` will be returned instead.
"""

class ListResult(TypedDict, Generic[ListChunkType]):
"""Result of a list call.

Includes objects, prefixes (directories) and a token for the next set of results.
Individual result sets may be limited to 1,000 objects based on the underlying
object storage's limitations.
"""

common_prefixes: List[str]
"""Prefixes that are common (like directories)"""

objects: ListChunkType
"""Object metadata for the listing"""

class ListStream(Generic[ListChunkType]):
"""A stream of [ObjectMeta][obstore.ObjectMeta] that can be polled in a sync or
async fashion.
Expand Down
3 changes: 3 additions & 0 deletions obstore/python/obstore/_obstore.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,10 @@ from ._get import get_ranges as get_ranges
from ._get import get_ranges_async as get_ranges_async
from ._head import head as head
from ._head import head_async as head_async
from ._list import ListChunkType as ListChunkType
from ._list import ListResult as ListResult
from ._list import ListStream as ListStream
from ._list import ObjectMeta as ObjectMeta
from ._list import list as list # noqa: A004
from ._list import list_with_delimiter as list_with_delimiter
from ._list import list_with_delimiter_async as list_with_delimiter_async
Expand Down
Loading