Table of Contents

Module: enumerations ./src/peak/model/enumerations.py

Enumeration support

Imported modules   
from elements import PrimitiveTypeClass, PrimitiveType
from interfaces import *
from peak.api import *
from peak.util.hashcmp import HashAndCompare
Functions   
enums
  enums 
enums ( *values )

A sequence of enumeration literals

This function is a shortcut for creating a series of model.enum() instances. Examples:

        class RGB(model.Enumeration):
            red, green, blue = model.enums("R","G","B")

        class Binary(model.Enumeration):
            zero, one = model.enums(range(2))

        class FooBar(model.Enumeration):
            foo, bar = model.enums(2)

model.enums() accepts a series of arguments, and creates a model.enum() for each one, returning the list (RGB example). If only one argument is supplied, and it's iterable, it is used as the input list. Finally, if only one argument is supplied, and it's not iterable, it is treated as a count of empty model.enum() objects to be returned. In the FooBar example, this is equivalent to saying foo, bar = model.enum(), model.enum().

Classes   

Enumeration

An enumeration type

EnumerationClass

Metaclass for enumeration types

ExtendedEnum

Enumeration that also parses integers

enum

Define an enumeration literal

enumDict

Define a dictionary of enumeration literals


Table of Contents

This document was automatically generated on Mon Aug 12 01:11:12 2019 by HappyDoc version 2.1