Mercurial > genshi > genshi-test
diff genshi/path.py @ 498:5b42b341185a
A couple of minor doc refinements.
author | cmlenz |
---|---|
date | Fri, 01 Jun 2007 12:22:50 +0000 |
parents | 5b248708bbed |
children | 0e5a25f1b83d |
line wrap: on
line diff
--- a/genshi/path.py +++ b/genshi/path.py @@ -77,6 +77,9 @@ """Create the path object from a string. :param text: the path expression + :param filename: the name of the file in which the path expression was + found (used in error messages) + :param lineno: the line on which the expression was found """ self.source = text self.paths = PathParser(text, filename, lineno).parse() @@ -110,6 +113,7 @@ :param namespaces: (optional) a mapping of namespace prefixes to URIs :param variables: (optional) a mapping of variable names to values :return: the substream matching the path, or an empty stream + :rtype: `Stream` """ if namespaces is None: namespaces = {} @@ -159,6 +163,13 @@ ... if test(event, {}, {}): ... print event[0], repr(event[1]) START (QName(u'child'), Attrs([(QName(u'id'), u'2')])) + + :param ignore_context: if `True`, the path is interpreted like a pattern + in XSLT, meaning for example that it will match + at any depth + :return: a function that can be used to test individual events in a + stream against the path + :rtype: ``function`` """ paths = [(p, len(p), [0], [], [0] * len(p)) for p in [ (ignore_context and [_DOTSLASHSLASH] or []) + p for p in self.paths