<commit_before>import itertools

import dask.dataframe as dd
import dask.dataframe.groupby as ddgb
import numpy as np
import pandas
import toolz
from pandas import isnull

import ibis
import ibis.expr.operations as ops
from ibis.backends.dask.dispatch import execute_node
from ibis.backends.dask.execution.util import (
    TypeRegistrationDict,
    make_selected_obj,
    register_types_to_dispatcher,
)
from ibis.backends.pandas.core import integer_types, scalar_types
from ibis.backends.pandas.execution.strings import (
    execute_series_join_scalar_sep,
    execute_series_regex_extract,
    execute_series_regex_replace,
    execute_series_regex_search,
    execute_series_right,
    execute_series_translate_scalar_scalar,
    execute_series_translate_scalar_series,
    execute_series_translate_series_scalar,
    execute_series_translate_series_series,
    execute_string_capitalize,
    execute_string_contains,
    execute_string_find,
    execute_string_length_series,
    execute_string_like_series_string,
    execute_string_lower,
    execute_string_lpad,
    execute_string_lstrip,
    execute_string_repeat,
    execute_string_reverse,
    execute_string_rpad,
    execute_string_rstrip,
    execute_string_strip,
    execute_string_upper,
    execute_substring_int_int,
    haystack_to_series_of_lists,
)

DASK_DISPATCH_TYPES: TypeRegistrationDict = {
    ops.StringLength: [((dd.Series,), execute_string_length_series)],
    ops.Substring: [
        (
            (
                dd.Series,
                integer_types,
                integer_types,
            ),
            execute_substring_int_int,
        ),
    ],
    ops.Strip: [((dd.Series,), execute_string_strip)],
    ops.LStrip: [((dd.Series,), execute_string_lstrip)],
    ops.RStrip: [((dd.Series,), execute_string_rstrip)],
    ops.LPad: [
        (
            (
                dd.Series,
                (dd.Series,) + integer_types,
                (dd.Series, str),
            ),
            execute_string_lpad,
        ),
    ],
    ops.RPad: [
        (
            (
                dd.Series,
                (dd.Series,) + integer_types,
                (dd.Series, str),
            ),
            execute_string_rpad,
        ),
    ],
    ops.Reverse: [((dd.Series,), execute_string_reverse)],
    ops.Lowercase: [((dd.Series,), execute_string_lower)],
    ops.Uppercase: [((dd.Series,), execute_string_upper)],
    ops.Capitalize: [((dd.Series,), execute_string_capitalize)],
    ops.Repeat: [
        ((dd.Series, (dd.Series,) + integer_types), execute_string_repeat),
    ],
    ops.StringFind: [
        (
            (
                dd.Series,
                (dd.Series, str),
                (dd.Series, type(None)) + integer_types,
                (dd.Series, type(None)) + integer_types,
            ),
            execute_string_find,
        )
    ],
    ops.StringContains: [
        (
            (
                dd.Series,<commit_msg>feat(dask): implement `StringReplace` execution<commit_after>import itertools

import dask.dataframe as dd
import dask.dataframe.groupby as ddgb
import numpy as np
import pandas
import toolz
from pandas import isnull

import ibis
import ibis.expr.operations as ops
from ibis.backends.dask.dispatch import execute_node
from ibis.backends.dask.execution.util import (
    TypeRegistrationDict,
    make_selected_obj,
    register_types_to_dispatcher,
)
from ibis.backends.pandas.core import integer_types, scalar_types
from ibis.backends.pandas.execution.strings import (
    execute_series_join_scalar_sep,
    execute_series_regex_extract,
    execute_series_regex_replace,
    execute_series_regex_search,
    execute_series_right,
    execute_series_string_replace,
    execute_series_translate_scalar_scalar,
    execute_series_translate_scalar_series,
    execute_series_translate_series_scalar,
    execute_series_translate_series_series,
    execute_string_capitalize,
    execute_string_contains,
    execute_string_find,
    execute_string_length_series,
    execute_string_like_series_string,
    execute_string_lower,
    execute_string_lpad,
    execute_string_lstrip,
    execute_string_repeat,
    execute_string_reverse,
    execute_string_rpad,
    execute_string_rstrip,
    execute_string_strip,
    execute_string_upper,
    execute_substring_int_int,
    haystack_to_series_of_lists,
)

DASK_DISPATCH_TYPES: TypeRegistrationDict = {
    ops.StringLength: [((dd.Series,), execute_string_length_series)],
    ops.Substring: [
        (
            (
                dd.Series,
                integer_types,
                integer_types,
            ),
            execute_substring_int_int,
        ),
    ],
    ops.Strip: [((dd.Series,), execute_string_strip)],
    ops.LStrip: [((dd.Series,), execute_string_lstrip)],
    ops.RStrip: [((dd.Series,), execute_string_rstrip)],
    ops.LPad: [
        (
            (
                dd.Series,
                (dd.Series,) + integer_types,
                (dd.Series, str),
            ),
            execute_string_lpad,
        ),
    ],
    ops.RPad: [
        (
            (
                dd.Series,
                (dd.Series,) + integer_types,
                (dd.Series, str),
            ),
            execute_string_rpad,
        ),
    ],
    ops.Reverse: [((dd.Series,), execute_string_reverse)],
    ops.StringReplace: [
        (
            (dd.Series, (dd.Series, str), (dd.Series, str)),
            execute_series_string_replace,
        )
    ],
    ops.Lowercase: [((dd.Series,), execute_string_lower)],
    ops.Uppercase: [((dd.Series,), execute_string_upper)],
    ops.Capitalize: [((dd.Series,), execute_string_capitalize)],
    ops.Repeat: [
        ((dd.Series, (dd.Series,) + integer_types), execute_string_repeat),
    ],
    ops.StringFind: [
        (
            (
                dd.Series,
                (dd.Series, str),
                (dd.Series, type(None)) + integer_types,
                (dd.Series, type(None)) + integer_types,
            ),
            execute_string_find,
        )
    ],
    ops.StringContains: [
        (
            (
                dd.Series,
{'fraction_non_alphanumeric': 0.09539313039231646, 'fraction_numerical': 0.0, 'mean_word_length': 2.357377049180328, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '808758', 'n_tokens_mistral': 1933, 'n_tokens_neox': 1866, 'n_words': 278}