Task: Implement a Python package dianna with a submodule that provides a specific hello function
What to implement
Create a Python package located at /app/dianna/ (or, alternatively, a single module at /app/dianna.py; tests are built to import dianna.my_module, so the package approach is recommended).
Inside the package, create a submodule dianna.my_module containing a function with the following signature and behavior:
def hello(name: str) -> str
If name == 'nobody', raise a ValueError with the exact message containing: "Can not say hello to nobody"
Otherwise, return the string "Hello {name}!" (exact formatting, including the exclamation point)
What the tests expect
The function hello('nlesc') returns 'Hello nlesc!'
Calling hello('nobody') raises ValueError and the error message includes 'Can not say hello to nobody'
The function works with a fixture name, e.g., for name 'Jane Smith' it returns 'Hello Jane Smith!'
Package structure (actionable)
/app/dianna/init.py (can be empty)
/app/dianna/my_module.py containing:
from typing import Any
def hello(name: str) -> str:
if name == 'nobody':
raise ValueError("Can not say hello to nobody")
return f"Hello {name}!"
Notes
Ensure the module is importable via: from dianna.my_module import hello
The implementation should not require any external dependencies.
If you prefer a single-file alternative, you may place the same logic in /app/dianna.py, but the tests are written to import dianna.my_module, so prefer the package structure at /app/dianna/.