From d7575a738d420a564e7a22f3347ab8f4442110bb Mon Sep 17 00:00:00 2001 From: Jonathan Ellis Date: Fri, 3 Aug 2007 13:57:40 +0000 Subject: switch (simple) occurences of 'if len(x)' to 'if x': find . -name '*.py' |xargs perl -pi.bak -e 's/if len\((\S+)\):/if $1:/' && find . -name '*.bak' |xargs rm --- doc/build/lib/highlight.py | 4 ++-- doc/build/lib/toc.py | 2 +- doc/build/read_markdown.py | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) (limited to 'doc') diff --git a/doc/build/lib/highlight.py b/doc/build/lib/highlight.py index 1a838408b..2fff3704e 100644 --- a/doc/build/lib/highlight.py +++ b/doc/build/lib/highlight.py @@ -170,7 +170,7 @@ class PythonHighlighter(Highlighter): curc = t[2][1] if self.get_style(t[0], t[1]) != curstyle: - if len(tokens): + if tokens: self.colorize([(string.join(tokens, ''), curstyle)]) tokens = [] curstyle = self.get_style(t[0], t[1]) @@ -187,7 +187,7 @@ class PythonHighlighter(Highlighter): curl = t[3][0] # any remaining content to output, output it - if len(tokens): + if tokens: self.colorize([(string.join(tokens, ''), curstyle)]) if trailingspace: diff --git a/doc/build/lib/toc.py b/doc/build/lib/toc.py index dcad5d5c6..b62951345 100644 --- a/doc/build/lib/toc.py +++ b/doc/build/lib/toc.py @@ -44,7 +44,7 @@ class TOCElement(object): self.next = None self.children = [] if parent: - if len(parent.children): + if parent.children: self.previous = parent.children[-1] parent.children[-1].next = self parent.children.append(self) diff --git a/doc/build/read_markdown.py b/doc/build/read_markdown.py index 858283bde..aad2502d7 100644 --- a/doc/build/read_markdown.py +++ b/doc/build/read_markdown.py @@ -25,7 +25,7 @@ def dump_tree(elem, stream): dump_mako_tag(elem, stream) else: if elem.tag != 'html': - if len(elem.attrib): + if elem.attrib: stream.write("<%s %s>" % (elem.tag, " ".join(["%s=%s" % (key, repr(val)) for key, val in elem.attrib.iteritems()]))) else: stream.write("<%s>" % elem.tag) -- cgit v1.2.1