Skip to content
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

Refactor channel_group_search implementation in tdm_loader #27

Merged
merged 9 commits into from
Mar 22, 2024
8 changes: 5 additions & 3 deletions tdm_loader/tdm_loader.py
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,7 @@ def channel_group_search(self, search_term):
for x in self._root.findall(".//tdm_channelgroup/name")
if x.text is not None
]

EspenEnes marked this conversation as resolved.
Show resolved Hide resolved
search_term = search_term.upper().replace(" ", "")
found_terms = [
name
Expand All @@ -199,10 +200,11 @@ def channel_group_search(self, search_term):

ind = []
for name in found_terms:
i = chg_names.index(name)
ind.append((name, i))
for occurence in range(found_terms.count(name)):
i = self.channel_group_index(name, occurence)
ind.append((name, i))
domna marked this conversation as resolved.
Show resolved Hide resolved

return ind
return set(ind)

def channel_search(self, search_term):
"""Returns a list of channel names that contain ``search term``.
Expand Down
Loading