modelscope / FunASR

A Fundamental End-to-End Speech Recognition Toolkit and Open Source SOTA Pretrained Models, Supporting Speech Recognition, Voice Activity Detection, Text Post-processing etc.
https://www.funasr.com
Other
7.04k stars 752 forks source link

Enhanced the register.py code with few minor changes in the code. #2145

Closed vignesh1507 closed 1 month ago

vignesh1507 commented 1 month ago

Here’s a summary of the changes that i have made to the original code:

  1. Error Handling Key Existence Check: Added a check in the register method to raise a ValueError if a key already exists in the registry, replacing the commented-out assert statement.

  2. Redundant Code Removal Headers Definition: The headers list was defined once in the print method and reused, avoiding duplication.

  3. Logging Configuration Logging Message: Ensured that the log message for adding a new registry table is clear and consistent.

  4. Docstrings Added Docstrings: Included docstrings for the RegisterTables class and its methods (print and register) to improve code documentation and readability.

  5. Type Hints Consistent Type Hints: Added type hints for parameters and return types in the print and register methods to enhance code clarity and IDE support.

  6. Code Formatting Improved Readability: Made minor formatting adjustments for better readability, such as consistent string formatting and spacing.