caikit.core.data_model.enums ============================ .. py:module:: caikit.core.data_model.enums .. autoapi-nested-parse:: Enumeration data structures map from strings to integers and back. Functions --------- .. autoapisummary:: caikit.core.data_model.enums.import_enum caikit.core.data_model.enums.import_enums Module Contents --------------- .. py:function:: import_enum(proto_enum: google.protobuf.internal.enum_type_wrapper.EnumTypeWrapper, enum_class: Optional[Type[enum.Enum]] = None) -> Tuple[str, str] Import a single enum into the global enum module by name Args: proto_enum (EnumTypeWrapper): The enum to import enum_class (Optional[Type[Enum]]): A pre-existing enum class that this proto enum binds to Returns: name: str The name of the enum global rev_name: str The name of the reversed enum global .. py:function:: import_enums(current_globals) Add all enums and their reverse enum mappings a module's global symbol table. Note that we also update __all__. In general, __all__ controls the stuff that comes with a wild (*) import. Examples tend to make stuff like this easier to understand. Let's say the first name we hit is the Entity Mention Type. Then, after the first cycle through the loop below, you'll see something like: '__all__': ['import_enums', 'EntityMentionType', 'EntityMentionTypeRev'] 'EntityMentionType': { "MENTT_UNSET": 0, "MENTT_NAM": 1, ... , "MENTT_NONE": 4} 'EntityMentionTypeRev': { "0": "MENTT_UNSET", "1": "MENTT_NAM", ... , "4": "MENTT_NONE"} since this is called explicitly below, you can thank this function for automagically syncing your enums (as importable from this file) with the data model. Args: current_globals (dict): global dictionary from your data model package __init__ file.