Esempio n. 1
0
    def __init__(self, target, **kwargs):
        """`target` should be a generator function that accepts a
        single argument which will be an instance of :class:`BSONInput`,
        and which yields dictionaries to be emitted. The yielded
        dictionaries should conform to the format expected by
        :class:`BSONInput` (i.e. they should have the key defined
        in a field named `_id`).

        Keyword arguments are passed directly to the underlying
        :class:`BSONInput`.
        """

        output = BSONOutput()
        input = BSONInput(**kwargs)

        generator = target(input)
        for mapped in generator:
            output.write(mapped)
Esempio n. 2
0
    def __init__(self, target, **kwargs):
        """`target` should be a generator function that accepts a
        single argument which will be an instance of :class:`BSONInput`,
        and which yields dictionaries to be emitted. The yielded
        dictionaries should conform to the format expected by
        :class:`BSONInput` (i.e. they should have the key defined
        in a field named `_id`).

        Keyword arguments are passed directly to the underlying
        :class:`BSONInput`.
        """

        output = BSONOutput()
        input = BSONInput(**kwargs)

        generator = target(input)
        for mapped in generator:
            output.write(mapped)