1313 CardsearchParams ,
1414 ValuesearchParams ,
1515)
16- from trove .util .propertypath import Propertypath
16+ from trove .util .propertypath import Propertypath , GLOB_PATHSTEP
1717from trove .vocab import mediatypes
1818from trove .vocab import osfmap
1919from trove .vocab .namespaces import TROVE
@@ -77,14 +77,14 @@ def first_page(self) -> dict[str, dict]:
7777 def _column_paths (self ) -> Iterator [Propertypath ]:
7878 _pathlists : list [Iterable [Propertypath ]] = []
7979 if self .trove_params is not None : # hacks
80+ if GLOB_PATHSTEP in self .trove_params .attrpaths_by_type :
81+ _pathlists .append (self .trove_params .attrpaths_by_type ['*' ])
8082 if isinstance (self .trove_params , ValuesearchParams ):
8183 _expected_card_types = set (self .trove_params .valuesearch_type_iris ())
8284 elif isinstance (self .trove_params , CardsearchParams ):
8385 _expected_card_types = set (self .trove_params .cardsearch_type_iris ())
8486 else :
8587 _expected_card_types = set ()
86- if '*' in self .trove_params .attrpaths_by_type :
87- _pathlists .append (self .trove_params .attrpaths_by_type ['*' ])
8888 for _type_iri in sorted (_expected_card_types , key = len ):
8989 try :
9090 _pathlist = self .trove_params .attrpaths_by_type [_type_iri ]
@@ -94,7 +94,15 @@ def _column_paths(self) -> Iterator[Propertypath]:
9494 _pathlists .append (_pathlist )
9595 if not _pathlists :
9696 _pathlists .append (osfmap .DEFAULT_TABULAR_SEARCH_COLUMN_PATHS )
97- return itertools .chain .from_iterable (_pathlists )
97+ return self .iter_unique (itertools .chain .from_iterable (_pathlists ))
98+
99+ @staticmethod
100+ def iter_unique (iterable ):
101+ _seen = set ()
102+ for _item in iterable :
103+ if _item not in _seen :
104+ _seen .add (_item )
105+ yield _item
98106
99107 def _iter_card_pages (self ):
100108 assert not self ._started
0 commit comments