Skip to content

Commit

Permalink
Rename List(Async)Iterator to List(Async)Iterable to reflect the corr…
Browse files Browse the repository at this point in the history
…ect behavior
  • Loading branch information
gtsystem committed Jan 9, 2025
1 parent 2892bbb commit 29b108a
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 13 deletions.
6 changes: 3 additions & 3 deletions lightkube/core/async_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

from ..config.kubeconfig import SingleConfig, KubeConfig
from ..core import resource as r
from .generic_client import GenericAsyncClient, ListAsyncIterator
from .generic_client import GenericAsyncClient, ListAsyncIterable
from ..core.exceptions import ConditionError, ObjectDeleted
from ..types import OnErrorHandler, PatchType, CascadeType, on_error_raise
from .internal_resources import core_v1
Expand Down Expand Up @@ -234,7 +234,7 @@ def list(
chunk_size: int = None,
labels: LabelSelector = None,
fields: FieldSelector = None,
) -> ListAsyncIterator[GlobalResource]: ...
) -> ListAsyncIterable[GlobalResource]: ...

@overload
def list(
Expand All @@ -245,7 +245,7 @@ def list(
chunk_size: int = None,
labels: LabelSelector = None,
fields: FieldSelector = None,
) -> ListAsyncIterator[NamespacedResource]: ...
) -> ListAsyncIterable[NamespacedResource]: ...

def list(self, res, *, namespace=None, chunk_size=None, labels=None, fields=None):
"""Return an iterator of objects matching the selection criteria.
Expand Down
6 changes: 3 additions & 3 deletions lightkube/core/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
from ..config.kubeconfig import SingleConfig, KubeConfig
from .. import operators
from ..core import resource as r
from .generic_client import GenericSyncClient, ListIterator
from .generic_client import GenericSyncClient, ListIterable
from ..core.exceptions import ConditionError, ObjectDeleted
from ..types import OnErrorHandler, PatchType, CascadeType, on_error_raise
from .internal_resources import core_v1
Expand Down Expand Up @@ -237,7 +237,7 @@ def list(
chunk_size: int = None,
labels: LabelSelector = None,
fields: FieldSelector = None,
) -> ListIterator[GlobalResource]: ...
) -> ListIterable[GlobalResource]: ...

@overload
def list(
Expand All @@ -248,7 +248,7 @@ def list(
chunk_size: int = None,
labels: LabelSelector = None,
fields: FieldSelector = None,
) -> ListIterator[NamespacedResource]: ...
) -> ListIterable[NamespacedResource]: ...

def list(self, res, *, namespace=None, chunk_size=None, labels=None, fields=None):
"""Return an iterator of objects matching the selection criteria.
Expand Down
12 changes: 6 additions & 6 deletions lightkube/core/generic_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ def process_one_line(self, line):
T = TypeVar("T")


class ListIterator(Iterable[T]):
class ListIterable(Iterable[T]):

_resourceVersion: Optional[str] = None

Expand All @@ -111,7 +111,7 @@ def __iter__(self) -> Iterator[T]:
yield from chunk


class ListAsyncIterator(AsyncIterable[T]):
class ListAsyncIterable(AsyncIterable[T]):

_resourceVersion: Optional[str] = None

Expand Down Expand Up @@ -390,8 +390,8 @@ def list_chunks(self, br: BasicRequest) -> Iterator[Tuple[str, Iterator]]:
cont, rv, chunk = self.handle_response("list", resp, br)
yield rv, chunk

def list(self, br: BasicRequest) -> ListIterator:
return ListIterator(self.list_chunks(br))
def list(self, br: BasicRequest) -> ListIterable:
return ListIterable(self.list_chunks(br))


class GenericAsyncClient(GenericClient):
Expand Down Expand Up @@ -452,8 +452,8 @@ async def list_chunks(
cont, rv, chunk = self.handle_response("list", resp, br)
yield rv, chunk

def list(self, br: BasicRequest) -> ListAsyncIterator:
return ListAsyncIterator(self.list_chunks(br))
def list(self, br: BasicRequest) -> ListAsyncIterable:
return ListAsyncIterable(self.list_chunks(br))

async def close(self):
await self._client.aclose()
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

setup(
name='lightkube',
version="0.17.0",
version="0.17.1",
description='Lightweight kubernetes client library',
long_description=Path("README.md").read_text(),
long_description_content_type="text/markdown",
Expand Down

0 comments on commit 29b108a

Please sign in to comment.