aixplain.enums.supplier
__author__
Copyright 2023 The aiXplain SDK authors
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Author: aiXplain team Date: September 25th 2023 Description: Supplier Enum
clean_name
def clean_name(name: str) -> str
Clean a supplier name by replacing spaces and special characters with underscores.
This function takes a supplier name and performs the following transformations:
- Replaces spaces and hyphens with underscores.
- Removes any non-alphanumeric characters.
- Removes any leading numbers.
Arguments:
name
str - The supplier name to clean.
Returns:
str
- The cleaned supplier name.
load_suppliers
def load_suppliers() -> Enum
Load suppliers from the backend or cache.
This function fetches supplier information from the backend API and creates an Enum class with supplier names as keys.
Returns:
Enum
- An Enum class with supplier names as keys.
Raises:
Exception
- If suppliers cannot be loaded due to invalid API key or other errors.