From 521b359642470e6403bda548b6096d2020982979 Mon Sep 17 00:00:00 2001 From: Jessica Scheick Date: Sat, 14 Dec 2024 15:34:21 -0500 Subject: [PATCH] add __repr__ for DataGranules --- earthaccess/search.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/earthaccess/search.py b/earthaccess/search.py index 2d394010..0680a3ea 100644 --- a/earthaccess/search.py +++ b/earthaccess/search.py @@ -980,6 +980,9 @@ def __eq__(self, other: 'DataGranules') -> bool: return self.granules == other.granules # TODO: display methods - def __repr__(self) -> str: - reprs = ", ".join([granule.__repr__() for granule in self.granules]) - return f'DataGranules([{reprs}])' + def __repr__(self): + + if (count := len(self)) > 0: + return f'DataGranules().parameters({self.params}).load({count})' + + return f'DataGranules().parameters({self.params})'