Closed dilyanpalauzov closed 6 years ago
if len(x) > 0: is equivalent to if len(x): and the latter is equivalent to if x: for all internal types.
if len(x) > 0:
if len(x):
if x:
diff --git a/contrib/repute/repute.py b/contrib/repute/repute.py --- a/contrib/repute/repute.py +++ b/contrib/repute/repute.py @@ -47,13 +47,13 @@ class DKIM(object): "identity": "dkim", } - if res1[0] and len(res1[1]) > 0: + if res1[0] and res1[1]: res1 = res1[1][0] reputons["rating"] = res1[0] reputons["sample-size"] = res1[2] reputons["generated"] = res1[1] - if res2[0] and len(res2[1]) > 0: + if res2[0] and res2[1]: res2 = res2[1][0] reputons['rate'] = res2[0] @@ -79,7 +79,7 @@ class DKIM(object): rows = yield self.cp.runQuery(query, {'domain': domain, 'reporter': reporter}) - if len(rows) > 0: + if rows: ret = dict(itertools.izip(fields, rows[0])) else: ret = 0 @@ -103,7 +103,7 @@ class DKIM(object): fields = ['domain'] + fields rows = yield self.cp.runQuery(query, { 'reporter' : reporter } ) - if len(rows) > 0: + if rows: ret = dict(itertools.izip(fields, rows[0])) request.setHeader('Last-modified', rows[0][3].strftime("%A, %d, %B %Y %H:%M GMT")) else:
Applied in fa570a8 on "develop".
if len(x) > 0:
is equivalent toif len(x):
and the latter is equivalent toif x:
for all internal types.