From 44c70b16fa26aad38244f816c2b0ad3c3a170ecc Mon Sep 17 00:00:00 2001 From: Leandro Lucarella Date: Sat, 14 Jul 2012 20:09:47 +0200 Subject: [PATCH] Reduce indentation by returning ASAP --- subdivxget | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/subdivxget b/subdivxget index 5f67edb..1aecc66 100755 --- a/subdivxget +++ b/subdivxget @@ -72,18 +72,19 @@ class SubDivXHTMLParser(HTMLParser.HTMLParser): self.parsing = False def handle_data(self, data): - if self.parsing: - data = data.strip() - if self.attr is not None and data: - self.cur[self.attr] = data - self.attr = None - elif data in ('Downloads:', 'Cds:', 'Comentarios:', - 'Formato:'): - self.attr = data[:-1].lower() - elif data == 'Subido por:': - self.attr = 'autor' - elif data == 'el': - self.attr = 'fecha' + if not self.parsing: + return + data = data.strip() + if self.attr is not None and data: + self.cur[self.attr] = data + self.attr = None + elif data in ('Downloads:', 'Cds:', 'Comentarios:', + 'Formato:'): + self.attr = data[:-1].lower() + elif data == 'Subido por:': + self.attr = 'autor' + elif data == 'el': + self.attr = 'fecha' def subdivx_get_subs(query_str): -- 2.43.0