From d3664ad5db742a64d19b21d00e05f8e3f1ab598e Mon Sep 17 00:00:00 2001 From: Jakub Wilk Date: Sat, 15 Apr 2017 14:44:19 +0200 Subject: [PATCH] Fix misuse of flags in re.sub() calls The 4th argument of re.sub() is maximum number of substitutions, not flags. --- beetsplug/beatport.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/beetsplug/beatport.py b/beetsplug/beatport.py index 8a73efa16..fc412d998 100644 --- a/beetsplug/beatport.py +++ b/beetsplug/beatport.py @@ -394,10 +394,10 @@ class BeatportPlugin(BeetsPlugin): # cause a query to return no results, even if they match the artist or # album title. Use `re.UNICODE` flag to avoid stripping non-english # word characters. - query = re.sub(r'\W+', ' ', query, re.UNICODE) + query = re.sub(r'\W+', ' ', query, flags=re.UNICODE) # Strip medium information from query, Things like "CD1" and "disk 1" # can also negate an otherwise positive result. - query = re.sub(r'\b(CD|disc)\s*\d+', '', query, re.I) + query = re.sub(r'\b(CD|disc)\s*\d+', '', query, flags=re.I) albums = [self._get_album_info(x) for x in self.client.search(query)] return albums