lisa.utils.deduplicate#

lisa.utils.deduplicate(seq, keep_last=True, key=<function <lambda>>)[source]#

Deduplicate items in the given sequence and return a list. :param seq: Sequence to deduplicate :type Seq: collections.abc.Sequence

Parameters:
  • key (collections.abc.Callable) – Key function that will be used to determine duplication. It takes one item at a time, returning a hashable key value

  • keep_last (bool) – If True, will keep the last occurence of each duplicated items. Otherwise, keep the first occurence.