From 97b61970c53781582c3c6cee6e637e6f2e47d71b Mon Sep 17 00:00:00 2001 From: geoffrey45 Date: Tue, 12 Jul 2022 19:40:10 +0300 Subject: [PATCH] use list instead of set in RemoveDuplicates --- server/app/helpers.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/server/app/helpers.py b/server/app/helpers.py index 0d94b609..aea1912d 100644 --- a/server/app/helpers.py +++ b/server/app/helpers.py @@ -2,6 +2,7 @@ This module contains mini functions for the server. """ import os +from pprint import pprint import threading from datetime import datetime from typing import Dict, List, Set @@ -53,7 +54,13 @@ class RemoveDuplicates: self.tracklist = tracklist def __call__(self) -> List[models.Track]: - uniq_hashes = set(t.uniq_hash for t in self.tracklist) + uniq_hashes = [] + [ + uniq_hashes.append(t.uniq_hash) + for t in self.tracklist + if t.uniq_hash not in uniq_hashes + ] + pprint(uniq_hashes[:5]) tracks = UseBisection(self.tracklist, "uniq_hash", uniq_hashes)() return tracks