diff --git a/src/fsub/fsub.py b/src/fsub/fsub.py index 481ccea..f61910b 100755 --- a/src/fsub/fsub.py +++ b/src/fsub/fsub.py @@ -241,9 +241,7 @@ class SubripFile: # Remove lines matching any expression for regexp in expressions: - subs = filter(lambda sub: not sub.matches(regexp), self.subs) - - self.subs = list(subs) + self.subs = [sub for sub in self.subs if not sub.matches(regexp)] def shift(self, ms): for sub in self.subs: diff --git a/tests/samples/blacklist b/tests/samples/blacklist index b317114..e82a4ad 100644 --- a/tests/samples/blacklist +++ b/tests/samples/blacklist @@ -1 +1,2 @@ Even +whether the tag diff --git a/tests/samples/sample1-cleaned-stripped-shifted-1h.srt b/tests/samples/sample1-cleaned-stripped-shifted-1h.srt index e76e652..03af53a 100644 --- a/tests/samples/sample1-cleaned-stripped-shifted-1h.srt +++ b/tests/samples/sample1-cleaned-stripped-shifted-1h.srt @@ -4,16 +4,10 @@ This one is full of HTML tags. Above, below, everywhere 2 -01:00:53,500 --> 01:00:55,200 -The script should not -care whether the tag is -valid or not - -3 01:00:56,000 --> 01:00:57,000 It should just strip all of them mercilessly -4 +3 01:00:58,100 --> 01:00:59,600 Including this one! diff --git a/tests/samples/sample1-cleaned-stripped.srt b/tests/samples/sample1-cleaned-stripped.srt index 3d658d6..f94da61 100644 --- a/tests/samples/sample1-cleaned-stripped.srt +++ b/tests/samples/sample1-cleaned-stripped.srt @@ -4,16 +4,10 @@ This one is full of HTML tags. Above, below, everywhere 2 -00:00:53,500 --> 00:00:55,200 -The script should not -care whether the tag is -valid or not - -3 00:00:56,000 --> 00:00:57,000 It should just strip all of them mercilessly -4 +3 00:00:58,100 --> 00:00:59,600 Including this one! diff --git a/tests/samples/sample1-cleaned.srt b/tests/samples/sample1-cleaned.srt index f3abc62..44bf94d 100644 --- a/tests/samples/sample1-cleaned.srt +++ b/tests/samples/sample1-cleaned.srt @@ -4,16 +4,10 @@ Above, below, everywhere 2 -00:00:53,500 --> 00:00:55,200 -The script should not -care whether the tag is -valid or not - -3 00:00:56,000 --> 00:00:57,000

It should just strip all of them mercilessly

-4 +3 00:00:58,100 --> 00:00:59,600