Skip to content
Open
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
39 changes: 4 additions & 35 deletions python/ee/collection.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,18 +30,7 @@
class Collection(element.Element):
"""Base class for ImageCollection and FeatureCollection."""

_initialized = False

# pylint: disable-next=useless-parent-delegation
@_utils.accept_opt_prefix('opt_varName')
def __init__(
self,
func: function.Function,
args: dict[str, Any],
varName: str | None = None, # pylint: disable=invalid-name
):
"""Constructs a collection by initializing its ComputedObject."""
super().__init__(func, args, varName)
_initialized: bool = False

@classmethod
def initialize(cls) -> None:
Expand Down Expand Up @@ -562,22 +551,6 @@ def geometry(
'Collection.geometry', self, maxError
)

# pylint: disable-next=useless-parent-delegation
def getInfo(self) -> Any | None:
"""Returns all the known information about this collection.

This function makes a REST call to to retrieve all the known information
about this collection.

Returns:
The return contents vary but will include at least:
features: an array containing metadata about the items in the
collection that passed all filters.
properties: a dictionary containing the collection's metadata
properties.
"""
return super().getInfo()

def iterate(
self, algorithm: Callable[[Any, Any], Any], first: Any | None = None
) -> Any:
Expand Down Expand Up @@ -611,7 +584,7 @@ def limit(
self,
maximum: int,
prop: str | None = None,
ascending: bool | None = None,
ascending: bool = True,
) -> Collection:
"""Limit a collection to the specified number of elements.

Expand All @@ -630,7 +603,6 @@ def limit(
args = {'collection': self, 'limit': maximum}
if prop is not None:
args['key'] = prop
if ascending is not None:
args['ascending'] = ascending
return self._cast(
apifunction.ApiFunction.apply_('Collection.limit', args))
Expand Down Expand Up @@ -820,9 +792,8 @@ def size(self) -> ee_number.Number:

return apifunction.ApiFunction.call_('Collection.size', self)

# TODO(user): Make ascending default to True
@_utils.accept_opt_prefix('opt_ascending')
def sort(self, prop: str, ascending: bool | None = None) -> Any:
def sort(self, prop: str, ascending: bool = True) -> Any:
"""Sort a collection by the specified property.

Args:
Expand All @@ -833,9 +804,7 @@ def sort(self, prop: str, ascending: bool | None = None) -> Any:
Returns:
The collection.
"""
args = {'collection': self, 'key': prop}
if ascending is not None:
args['ascending'] = ascending
args = {'collection': self, 'key': prop, 'ascending': ascending}
return self._cast(
apifunction.ApiFunction.apply_('Collection.limit', args))

Expand Down
Loading