-
Notifications
You must be signed in to change notification settings - Fork 77
/
__init__.py
50 lines (43 loc) · 1.5 KB
/
__init__.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
# -*- coding: utf-8 -*-
# vim: sw=4:ts=4:expandtab
"""
riko
~~~~
Provides functions for analyzing and processing streams of structured data
Examples:
basic usage::
>>> from itertools import chain
>>> from functools import partial
>>> from riko.modules import itembuilder, strreplace
>>> from riko.collections import SyncPipe
>>>
>>> ib_conf = {
... 'attrs': [
... {'key': 'link', 'value': 'www.google.com', },
... {'key': 'title', 'value': 'google', },
... {'key': 'author', 'value': 'Tommy'}]}
>>>
>>> sr_conf = {
... 'rule': [{'find': 'Tom', 'param': 'first', 'replace': 'Tim'}]}
>>>
>>> items = itembuilder.pipe(conf=ib_conf)
>>> pipe = partial(strreplace.pipe, conf=sr_conf, field='author')
>>> replaced = map(pipe, items)
>>> next(chain.from_iterable(replaced)) == {
... 'link': 'www.google.com', 'title': 'google',
... 'strreplace': 'Timmy', 'author': 'Tommy'}
True
"""
from os import path as p
__version__ = '0.64.0'
__title__ = 'riko'
__package_name__ = 'riko'
__author__ = 'Reuben Cummings'
__description__ = 'A stream processing engine modeled after Yahoo! Pipes.'
__email__ = 'reubano@gmail.com'
__license__ = 'MIT'
__copyright__ = 'Copyright 2015 Reuben Cummings'
PARENT_DIR = p.abspath(p.dirname(__file__))
ENCODING = 'utf-8'
def get_path(name):
return 'file://%s' % p.join(PARENT_DIR, 'data', name)