How to use Pypeline - 10 common examples

To help you get started, we’ve selected a few Pypeline examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github corbt / pypeline / test / test_pypeline.py View on Github external
def test_database_reloading(db_dir):
    test_db = DB(db_dir, create_if_missing=True)
    c1 = test_db.collection('test')
    c1.append(5)
    c1.append(6)

    c1.delete(0)

    test_db.close()

    test_db2 = DB(db_dir)
    assert test_db2.collection('test')[0] == 6
    assert len(test_db2.collection('test')) == 1
github corbt / pypeline / test / test_pypeline.py View on Github external
def test_db_creation(db_dir):
    test_db = DB(db_dir, create_if_missing=True)
    assert os.path.isdir(db_dir) == True
    assert isinstance(test_db, DB) == True
github corbt / pypeline / test / test_pypeline.py View on Github external
def db(request):
    path = tempfile.mkdtemp()
    db = DB(path, create_if_missing=True)

    def finalize():
        db.close()
        shutil.rmtree(path)

    request.addfinalizer(finalize)
    return db
github corbt / pypeline / test / test_pypeline.py View on Github external
def test_db_schema(db_dir):
    test_db = DB(db_dir, create_if_missing=True)
    test_db.close()

    test_levelDB = plyvel.DB(db_dir)
    assert json.loads(test_levelDB.get(b'pypeline-schema-version').decode()) == schema_version
github corbt / pypeline / test / test_pypeline.py View on Github external
def collection(request):
    path = tempfile.mkdtemp()
    db = DB(path, create_if_missing=True)

    collection = db.collection('test')

    def finalize():
        db.close()
        shutil.rmtree(path)

    request.addfinalizer(finalize)
    return collection
github corbt / pypeline / test / test_pypeline.py View on Github external
def test_database_reloading(db_dir):
    test_db = DB(db_dir, create_if_missing=True)
    c1 = test_db.collection('test')
    c1.append(5)
    c1.append(6)

    c1.delete(0)

    test_db.close()

    test_db2 = DB(db_dir)
    assert test_db2.collection('test')[0] == 6
    assert len(test_db2.collection('test')) == 1
github ianj-als / pypeline / src / pypeline / helpers / parallel_helpers.py View on Github external
else:
                        raise ValueError("Test state function has value that is not of type tuple or Future")

                    condition_result = condition_function(a, s)
                    new_a = Left(a) if condition_result else Right(a)

                    return new_a

                # Execute
                new_future = wrapped_state.executor.submit(do_transformation,
                                                           bind_a,
                                                           state)

                # New value/state pair
                return (new_future, wrapped_state)
            return State(test_state_function)
        return test_bind_function
github ianj-als / pypeline / src / pypeline / helpers / parallel_helpers.py View on Github external
# Transform the output of the function
                    transformed_new_a = output_forming_function(new_a, state) if output_forming_function else new_a

                    return transformed_new_a

                # Execute
                new_future = wrapped_state.executor.submit(do_transformation,
                                                           bind_a,
                                                           state)

                # Mutate the state
                next_state = state_mutator(state) if state_mutator else state
                # New value/state pair
                return (new_future, WrappedState(wrapped_state.executor, next_state))
            return State(state_function)
        return bind_function
github ianj-als / pypeline / src / pypeline / helpers / parallel_helpers.py View on Github external
return transformed_new_a

                # Execute
                new_future = wrapped_state.executor.submit(do_transformation,
                                                           bind_a,
                                                           state)

                # Mutate the state
                next_state = state_mutator(state) if state_mutator else state
                # New value/state pair
                return (new_future, WrappedState(wrapped_state.executor, next_state))
            return State(state_function)
        return bind_function

    return KleisliArrow(return_, get_bind_function())
github ianj-als / pypeline / src / pypeline / helpers / helpers.py View on Github external
def cons_split_wire():
    """Construct a wire that duplicates its input and produces a pair from this value. See: ***, first, second, and unsplit arrow operators."""
    return split(return_)