Skip to content

woodglue.hello

Example namespace with hello methods for testing and demonstration.

hello(name)

Returns the length of a name.

A simple example method that counts characters.

Source code in src/woodglue/hello/__init__.py
def hello(name: str) -> int:
    """Returns the length of a name.

    A simple example method that counts characters.
    """
    return len(name)

pydantic_hello(input)

Reverses name and negates age.

Demonstrates BaseModel input/output round-trip. Given a HelloIn with name and age, returns HelloOut with the name reversed and age negated.

Source code in src/woodglue/hello/__init__.py
def pydantic_hello(input: HelloIn) -> HelloOut:
    """Reverses name and negates age.

    Demonstrates BaseModel input/output round-trip.
    Given a HelloIn with name and age, returns HelloOut
    with the name reversed and age negated.
    """
    return HelloOut(eman=input.name[::-1], ega=-input.age)