mirror of
https://github.com/kennethreitz/simplemind.git
synced 2026-06-05 22:50:18 +00:00
Enhance docstring for find_provider function to include parameters, return type, and exceptions
This commit is contained in:
+12
-1
@@ -7,7 +7,18 @@ _PROVIDER_NAMES = [provider.NAME.lower() for provider in providers]
|
||||
|
||||
|
||||
def find_provider(provider_name: Union[str, None]):
|
||||
"""Find a provider by name."""
|
||||
"""
|
||||
Find and instantiate a provider by name.
|
||||
|
||||
Parameters:
|
||||
provider_name (Union[str, None]): The name of the provider to find.
|
||||
|
||||
Returns:
|
||||
An instance of the provider class if found.
|
||||
|
||||
Raises:
|
||||
ValueError: If the provider is not found, with a suggestion for the closest match.
|
||||
"""
|
||||
if provider_name:
|
||||
for provider_class in providers:
|
||||
if provider_class.NAME.lower() == provider_name.lower():
|
||||
|
||||
Reference in New Issue
Block a user