# HG changeset patch # User cmlenz # Date 1187041126 0 # Node ID aa5762c7b7f153e29582bc60481d81135bf45177 # Parent 7145e4eba2ec5d521fcce351e8c0d0ba6c997239 Minor, cosmetic tweaks. diff --git a/genshi/core.py b/genshi/core.py --- a/genshi/core.py +++ b/genshi/core.py @@ -316,6 +316,12 @@ return True def __getslice__(self, i, j): + """Return a slice of the attributes list. + + >>> attrs = Attrs([('href', '#'), ('title', 'Foo')]) + >>> attrs[1:] + Attrs([('title', 'Foo')]) + """ return Attrs(tuple.__getslice__(self, i, j)) def __or__(self, attrs): diff --git a/genshi/filters/tests/__init__.py b/genshi/filters/tests/__init__.py --- a/genshi/filters/tests/__init__.py +++ b/genshi/filters/tests/__init__.py @@ -11,7 +11,6 @@ # individuals. For the exact contribution history, see the revision # history and logs, available at http://genshi.edgewall.org/log/. -import doctest import unittest def suite(): diff --git a/genshi/path.py b/genshi/path.py --- a/genshi/path.py +++ b/genshi/path.py @@ -39,6 +39,7 @@ """ from math import ceil, floor +import operator import re from genshi.core import Stream, Attrs, Namespace, QName @@ -771,7 +772,7 @@ string2 = as_string(self.string2(kind, data, pos, namespaces, variables)) return re.search(string2, string1, self.flags) def _map_flags(self, flags): - return reduce(lambda a, b: a | b, + return reduce(operator.or_, [self.flag_map[flag] for flag in flags], re.U) def __repr__(self): return 'contains(%r, %r)' % (self.string1, self.string2)