Skip to content

Fix rfi from string in same node #139

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jan 30, 2025
Merged

Fix rfi from string in same node #139

merged 2 commits into from
Jan 30, 2025

Conversation

Tomperez98
Copy link
Collaborator

No description provided.

@Tomperez98
Copy link
Collaborator Author

from __future__ import annotations

import uuid
from typing import TYPE_CHECKING, Any

from resonate import Context, Promise, Resonate

if TYPE_CHECKING:
    from collections.abc import Generator

    from resonate.typing import Yieldable

resonate = Resonate()


@resonate.register(name="+")
def add(ctx: Context, a: int, b: int) -> int:
    return a + b


@resonate.register()
def calculator(ctx: Context, a: int, b: int) -> Generator[Yieldable, Any, int]:
    p: Promise[int] = yield ctx.rfi("+", a, b)
    return (yield p)


def main() -> None:
    h = resonate.run(uuid.uuid4().hex, calculator, 1, 2)
    v = h.result()
    print(v)  # noqa: T201


if __name__ == "__main__":
    main()

With this fix this golden device passes

Copy link
Member

@dfarr dfarr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you!

@Tomperez98 Tomperez98 merged commit 1751cf7 into main Jan 30, 2025
4 checks passed
@Tomperez98 Tomperez98 deleted the tomas/fix-rfi-by-name branch January 30, 2025 20:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants