Beispiel #1
0
def test_extract_keys():
    # Get the first "a"
    eq_(utils.extract_keys(d, ["a"]), {"a": 1})
    # Get a nested thing
    eq_(utils.extract_keys(d, ["c"]), {"c": 4})
    # Get all "a"s
    eq_(utils.extract_keys(d, ["*a"]), {"a": (1, 3)})
Beispiel #2
0
    def on_object(obj):
        if args.keys:
            obj = extract_keys(obj, args.keys)

        obj = post_process(obj)

        if args.z is None or obj:
            print_(obj)
            print
Beispiel #3
0
    def on_message(message):
        # (method, properties, body) = message
        out = adict(object=message.object,
                    headers=message.headers,
                    rkey=message.rkey)
        if args.keys:
            out.object = extract_keys(out.object, args.keys)

        out.object = post_process(out.object)

        if not args.verbose:
            out = out.object

        if args.z is None or out:
            print_(out)
            print