From 3190d1ec5a2fb1ed96ee8fa1a12c775310653ac4 Mon Sep 17 00:00:00 2001 From: pictuga Date: Tue, 2 Jun 2020 13:57:45 +0200 Subject: [PATCH] feeds: remove useless if(len) before loop --- morss/feeds.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/morss/feeds.py b/morss/feeds.py index afef75b..f246403 100644 --- a/morss/feeds.py +++ b/morss/feeds.py @@ -734,11 +734,10 @@ class FeedXML(Feed, ParserXML): stylesheets = [x for x in self.root_siblings() if isinstance(x, etree.PIBase) and x.target == 'xml-stylesheet'] - if len(stylesheets): + for stylesheet in stylesheets: # remove all stylesheets present (be that ours or others') - for stylesheet in stylesheets: - self.root.append(stylesheet) # needed as we can't delete root siblings https://stackoverflow.com/a/60232366 - self.root.remove(stylesheet) + self.root.append(stylesheet) # needed as we can't delete root siblings https://stackoverflow.com/a/60232366 + self.root.remove(stylesheet) self.root.addprevious(etree.PI('xml-stylesheet', 'type="text/xsl" href="/sheet.xsl"'))