Update output.py
This pull request enhances the existing Output class and related functionalities in the codebase. The changes aim to improve code readability, maintainability, and error handling. Here's a summary of the modifications:
Docstrings: Added detailed docstrings to functions and methods, providing information about their purpose, parameters, and return values. This improves code documentation.
Type Hints in Docstrings: Included type hints in docstrings for function parameters and return types, making it easier for developers and documentation tools to understand expected types.
Consistent Naming: Followed consistent naming conventions according to PEP 8. Renamed register_output to register_output_decorator and _output_name to output_name for clarity.
Error Handling: Added error handling in the create_from_name method to handle cases where the name is not found in the dictionary. This helps prevent unexpected behavior.
Optional Types: In the create_from_name method, updated the return value to raise a specific exception or log a warning instead of returning None when the name is not found.
Class Naming: Used a more descriptive exception name (OutputTypeAlreadyRegisteredError) in the register method for better clarity.