1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136
|
<!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"DTD/xhtml1-strict.dtd">
<html>
<head>
<title>API docs for “kiwi.python.enum”</title>
<meta content="text/html;charset=utf-8" http-equiv="Content-Type" />
<link href="apidocs.css" type="text/css" rel="stylesheet" />
</head>
<body>
<h1 class="class">Class k.p.enum(<span title="int">int</span>):</h1>
<p>
<span id="part">Part of <a href="kiwi.html">kiwi</a>.<a href="kiwi.python.html">python</a></span>
<a href="classIndex.html#kiwi.python.enum">View In Hierarchy</a>
</p>
<div>
<p>Known subclasses: <a href="kiwi.enums.Alignment.html">kiwi.enums.Alignment</a>, <a href="kiwi.enums.ComboColumn.html">kiwi.enums.ComboColumn</a>, <a href="kiwi.enums.ComboMode.html">kiwi.enums.ComboMode</a>, <a href="kiwi.enums.Direction.html">kiwi.enums.Direction</a>, <a href="kiwi.enums.ListType.html">kiwi.enums.ListType</a>, <a href="kiwi.enums.SearchFilterPosition.html">kiwi.enums.SearchFilterPosition</a>, <a href="kiwi.ui.search.DateSearchFilter.Type.html">kiwi.ui.search.DateSearchFilter.Type</a></p>
</div>
<div><p>enum is an enumered type implementation in python.</p>
To use it, define an enum subclass like this:
<pre class="py-doctest">
<span class="py-prompt">>>> </span><span class="py-keyword">from</span> kiwi.python <span class="py-keyword">import</span> enum
<span class="py-prompt">>>></span>
<span class="py-prompt">>>> </span><span class="py-keyword">class</span> <span class="py-defname">Status</span>(enum):
<span class="py-prompt">>>> </span> OPEN, CLOSE = range(2)
<span class="py-prompt">>>> </span>Status.OPEN
<span class="py-output">'<Status value OPEN>'</span></pre>
All the integers defined in the class are assumed to be enums and values
cannot be duplicated
<table class="fieldTable"></table></div>
<div id="splitTables">
<table class="children sortable" id="id412">
<tr class="classmethod">
<td>Class Method</td>
<td><a href="kiwi.python.enum.html#__class_init__">__class_init__</a></td>
<td><span class="undocumented">Undocumented</span></td>
</tr><tr class="classmethod">
<td>Class Method</td>
<td><a href="kiwi.python.enum.html#get">get</a></td>
<td><span>Lookup an enum by value
</span></td>
</tr><tr class="method">
<td>Method</td>
<td><a href="kiwi.python.enum.html#__new__">__new__</a></td>
<td><span>Create a new Enum.
</span></td>
</tr><tr class="method">
<td>Method</td>
<td><a href="kiwi.python.enum.html#__str__">__str__</a></td>
<td><span class="undocumented">Undocumented</span></td>
</tr>
</table>
</div>
<div class="function">
<a name="kiwi.python.enum.__class_init__"></a>
<a name="__class_init__"></a>
<div class="functionHeader">
@classmethod<br />
def __class_init__(cls, ns):
</div>
<div class="functionBody">
<div class="undocumented">Undocumented</div>
</div>
</div><div class="function">
<a name="kiwi.python.enum.get"></a>
<a name="get"></a>
<div class="functionHeader">
@classmethod<br />
def get(cls, value):
</div>
<div class="functionBody">
<div>Lookup an enum by value
<table class="fieldTable"><tr class="fieldStart"><td class="fieldName">Parameters</td><td class="fieldArg">value</td><td>the value
</td></tr></table></div>
</div>
</div><div class="function">
<a name="kiwi.python.enum.__new__"></a>
<a name="__new__"></a>
<div class="functionHeader">
def __new__(cls, value, name):
</div>
<div class="functionBody">
<div>Create a new Enum.
<table class="fieldTable"><tr class="fieldStart"><td class="fieldName">Parameters</td><td class="fieldArg">value</td><td>value of the enum
</td></tr><tr><td></td><td class="fieldArg">name</td><td>name of the enum
</td></tr></table></div>
</div>
</div><div class="function">
<a name="kiwi.python.enum.__str__"></a>
<a name="__str__"></a>
<div class="functionHeader">
def __str__(self):
</div>
<div class="functionBody">
<div class="undocumented">Undocumented</div>
</div>
</div>
<address>
<a href="index.html">API Documentation</a> for Kiwi, generated by <a href="http://codespeak.net/~mwh/pydoctor/">pydoctor</a> at 2008-05-29 16:06:17.
</address>
</body>
</html>
|