Mercurial > jpath
changeset 5:e69a0207568a
some small cleaup
| author | sheep@wintermute |
|---|---|
| date | Wed, 14 Apr 2010 11:39:51 +0200 |
| parents | c0c786f4bbb5 |
| children | ba0f10adb44b |
| files | jpath.py |
| diffstat | 1 files changed, 5 insertions(+), 4 deletions(-) [+] |
line wrap: on
line diff
--- a/jpath.py Wed Apr 14 11:36:13 2010 +0200 +++ b/jpath.py Wed Apr 14 11:39:51 2010 +0200 @@ -13,6 +13,8 @@ import itertools import operator +__all__ = ['get', 'get_all'] + class Tokenizer: # list of all token classes marked with @Tokenizer.use tokens = {} @@ -248,7 +250,7 @@ def get_all(jpath, data): """ - Gets list of all the values matching given jpath in the data datastructure. + Get list of all elements matched by given jpath in the data datastructure. >>> get_all('', 1) [1] @@ -276,12 +278,11 @@ [[1, 2]] """ - tokens = list(TOKENIZER.tokenize(jpath)) - return list(Token.apply(tokens, data)) + return list(Token.apply(TOKENIZER.tokenize(jpath), data)) def get(jpath, data): """ - Gets the first element matched by given jpath in the data datastructure. + Get the first element matched by given jpath in the data datastructure. >>> get('', 3) 3
