コード例 #1
0
ファイル: util.py プロジェクト: jelitox/ibis
def register_types_to_dispatcher(dispatcher: TraceTwoLevelDispatcher,
                                 types: TypeRegistrationDict):
    """
    Many dask operations utilize the functions defined in the pandas backend
    without modification. This function helps perform registrations in bulk
    """
    for ibis_op, registration_list in types.items():
        for types_to_register, fn in registration_list:
            dispatcher.register(ibis_op, *types_to_register)(fn)
コード例 #2
0
ファイル: dispatch.py プロジェクト: ibis-project/ibis
from functools import partial

from multipledispatch import Dispatcher

import ibis.common.exceptions as com
import ibis.expr.operations as ops
from ibis.backends.base import BaseBackend
from ibis.backends.pandas.trace import TraceTwoLevelDispatcher
from ibis.expr.scope import Scope

# Individual operation execution
execute_node = TraceTwoLevelDispatcher(
    'execute_node',
    doc=(
        'Execute an individual operation given the operation and its computed '
        'arguments'
    ),
)


@execute_node.register(ops.Node)
def execute_node_without_scope(node, **kwargs):
    raise com.UnboundExpressionError(
        (
            'Node of type {!r} has no data bound to it. '
            'You probably tried to execute an expression without a data '
            'source.'
        ).format(type(node).__name__)
    )