<commit_before>import asyncio
from tkinter import Event, Frame, Label, Misc, Tk
from typing import Tuple

import aioreactive as rx
from aioreactive import AsyncAnonymousObserver, AsyncTestSubject
from aioreactive.types import AsyncObservable
from expression.core import MailboxProcessor, pipe


async def main() -> None:
    root = Tk()
    root.title("aioreactive")

    mousemoves: AsyncTestSubject[Tuple[int, int]] = AsyncTestSubject()

    frame = Frame(root, width=800, height=600, bg="white")

    async def worker(mb: MailboxProcessor["Event[Misc]"]) -> None:
        while True:
            event = await mb.receive()
            await mousemoves.asend((event.x, event.y))

    agent = MailboxProcessor.start(worker)
    frame.bind("<Motion>", agent.post)

    text = "TIME FLIES LIKE AN ARROW"
    labels = [Label(frame, text=c, bg="white") for c in text]

    def handle_label(label: Label, i: int) -> AsyncObservable[Tuple[Label, int, int]]:
        label.config(dict(borderwidth=0, padx=0, pady=0))

        def mapper(x: int, y: int) -> Tuple[Label, int, int]:
            """Map mouse-move pos to label and new pos for label."""
            return label, x + i * 12 + 15, y

        return pipe(
            mousemoves,  # stream of mouse-moves
            rx.delay(i / 10.0),  # delay each mouse-move based on index of char
            rx.starmap(mapper),  # place label based on mouse pos and index of char
        )
<commit_msg>Fix import for example<commit_after>import asyncio
from tkinter import Event, Frame, Label, Misc, Tk
from typing import Tuple

import aioreactive as rx
from aioreactive import AsyncAnonymousObserver, AsyncSubject
from aioreactive.types import AsyncObservable
from expression.core import MailboxProcessor, pipe


async def main() -> None:
    root = Tk()
    root.title("aioreactive")

    mousemoves: AsyncSubject[Tuple[int, int]] = AsyncSubject()

    frame = Frame(root, width=800, height=600, bg="white")

    async def worker(mb: MailboxProcessor["Event[Misc]"]) -> None:
        while True:
            event = await mb.receive()
            await mousemoves.asend((event.x, event.y))

    agent = MailboxProcessor.start(worker)
    frame.bind("<Motion>", agent.post)

    text = "TIME FLIES LIKE AN ARROW"
    labels = [Label(frame, text=c, bg="white") for c in text]

    def handle_label(label: Label, i: int) -> AsyncObservable[Tuple[Label, int, int]]:
        label.config(dict(borderwidth=0, padx=0, pady=0))

        def mapper(x: int, y: int) -> Tuple[Label, int, int]:
            """Map mouse-move pos to label and new pos for label."""
            return label, x + i * 12 + 15, y

        return pipe(
            mousemoves,  # stream of mouse-moves
            rx.delay(i / 10.0),  # delay each mouse-move based on index of char
            rx.starmap(mapper),  # place label based on mouse pos and index of char
        )

{'fraction_non_alphanumeric': 0.11291998614478697, 'fraction_numerical': 0.011084170419120194, 'mean_word_length': 2.967032967032967, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 13, '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': '7534184', 'n_tokens_mistral': 913, 'n_tokens_neox': 866, 'n_words': 287}