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 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234
|
<!doctype html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html><head><title>Python: module Asterisk.Util</title>
</head><body bgcolor="#f0f0f8">
<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="heading">
<tr bgcolor="#7799ee">
<td valign=bottom> <br>
<font color="#ffffff" face="helvetica, arial"> <br><big><big><strong><a href="Asterisk.html"><font color="#ffffff">Asterisk</font></a>.Util</strong></big></big></font></td
><td align=right valign=bottom
><font color="#ffffff" face="helvetica, arial"><a href=".">index</a><br><a href="file:/usr/src/ks-voip/py-asterisk/Asterisk/Util.py">/usr/src/ks-voip/py-asterisk/Asterisk/Util.py</a></font></td></tr></table>
<p><tt>Asterisk/Util.py: utility classes.</tt></p>
<p>
<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section">
<tr bgcolor="#aa55cc">
<td colspan=3 valign=bottom> <br>
<font color="#fffff" face="helvetica, arial"><big><strong>Modules</strong></big></font></td></tr>
<tr><td bgcolor="#aa55cc"><tt> </tt></td><td> </td>
<td width="100%"><table width="100%" summary="list"><tr><td width="25%" valign=top><a href="Asterisk.html">Asterisk</a><br>
</td><td width="25%" valign=top><a href="Asterisk.Logging.html">Asterisk.Logging</a><br>
</td><td width="25%" valign=top><a href="copy.html">copy</a><br>
</td><td width="25%" valign=top><a href="sys.html">sys</a><br>
</td></tr></table></td></tr></table><p>
<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section">
<tr bgcolor="#ee77aa">
<td colspan=3 valign=bottom> <br>
<font color="#ffffff" face="helvetica, arial"><big><strong>Classes</strong></big></font></td></tr>
<tr><td bgcolor="#ee77aa"><tt> </tt></td><td> </td>
<td width="100%"><dl>
<dt><font face="helvetica, arial"><a href="Asterisk.html#BaseException">Asterisk.BaseException</a>(<a href="exceptions.html#Exception">exceptions.Exception</a>)
</font></dt><dd>
<dl>
<dt><font face="helvetica, arial"><a href="Asterisk.Util.html#SubscriptionError">SubscriptionError</a>
</font></dt></dl>
</dd>
<dt><font face="helvetica, arial"><a href="Asterisk.Logging.html#InstanceLogger">Asterisk.Logging.InstanceLogger</a>(<a href="__builtin__.html#object">__builtin__.object</a>)
</font></dt><dd>
<dl>
<dt><font face="helvetica, arial"><a href="Asterisk.Util.html#EventCollection">EventCollection</a>
</font></dt></dl>
</dd>
<dt><font face="helvetica, arial"><a href="__builtin__.html#dict">__builtin__.dict</a>(<a href="__builtin__.html#object">__builtin__.object</a>)
</font></dt><dd>
<dl>
<dt><font face="helvetica, arial"><a href="Asterisk.Util.html#AttributeDict">AttributeDict</a>
</font></dt></dl>
</dd>
</dl>
<p>
<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section">
<tr bgcolor="#ffc8d8">
<td colspan=3 valign=bottom> <br>
<font color="#000000" face="helvetica, arial"><a name="AttributeDict">class <strong>AttributeDict</strong></a>(<a href="__builtin__.html#dict">__builtin__.dict</a>)</font></td></tr>
<tr><td bgcolor="#ffc8d8"><tt> </tt></td><td> </td>
<td width="100%"><dl><dt>Method resolution order:</dt>
<dd><a href="Asterisk.Util.html#AttributeDict">AttributeDict</a></dd>
<dd><a href="__builtin__.html#dict">__builtin__.dict</a></dd>
<dd><a href="__builtin__.html#object">__builtin__.object</a></dd>
</dl>
<hr>
Methods defined here:<br>
<dl><dt><a name="AttributeDict-__getattr__"><strong>__getattr__</strong></a>(self, key)</dt></dl>
<dl><dt><a name="AttributeDict-__setattr__"><strong>__setattr__</strong></a>(self, key, value)</dt></dl>
<dl><dt><a name="AttributeDict-copy"><strong>copy</strong></a>(self)</dt></dl>
<hr>
Data and other attributes defined here:<br>
<dl><dt><strong>__dict__</strong> = <dictproxy object><dd><tt>dictionary for instance variables (if defined)</tt></dl>
<dl><dt><strong>__weakref__</strong> = <attribute '__weakref__' of 'AttributeDict' objects><dd><tt>list of weak references to the object (if defined)</tt></dl>
<hr>
Methods inherited from <a href="__builtin__.html#dict">__builtin__.dict</a>:<br>
<dl><dt><a name="AttributeDict-__cmp__"><strong>__cmp__</strong></a>(...)</dt><dd><tt>x.<a href="#AttributeDict-__cmp__">__cmp__</a>(y) <==> cmp(x,y)</tt></dd></dl>
<dl><dt><a name="AttributeDict-__contains__"><strong>__contains__</strong></a>(...)</dt><dd><tt>x.<a href="#AttributeDict-__contains__">__contains__</a>(y) <==> y in x</tt></dd></dl>
<dl><dt><a name="AttributeDict-__delitem__"><strong>__delitem__</strong></a>(...)</dt><dd><tt>x.<a href="#AttributeDict-__delitem__">__delitem__</a>(y) <==> del x[y]</tt></dd></dl>
<dl><dt><a name="AttributeDict-__eq__"><strong>__eq__</strong></a>(...)</dt><dd><tt>x.<a href="#AttributeDict-__eq__">__eq__</a>(y) <==> x==y</tt></dd></dl>
<dl><dt><a name="AttributeDict-__ge__"><strong>__ge__</strong></a>(...)</dt><dd><tt>x.<a href="#AttributeDict-__ge__">__ge__</a>(y) <==> x>=y</tt></dd></dl>
<dl><dt><a name="AttributeDict-__getattribute__"><strong>__getattribute__</strong></a>(...)</dt><dd><tt>x.<a href="#AttributeDict-__getattribute__">__getattribute__</a>('name') <==> x.name</tt></dd></dl>
<dl><dt><a name="AttributeDict-__getitem__"><strong>__getitem__</strong></a>(...)</dt><dd><tt>x.<a href="#AttributeDict-__getitem__">__getitem__</a>(y) <==> x[y]</tt></dd></dl>
<dl><dt><a name="AttributeDict-__gt__"><strong>__gt__</strong></a>(...)</dt><dd><tt>x.<a href="#AttributeDict-__gt__">__gt__</a>(y) <==> x>y</tt></dd></dl>
<dl><dt><a name="AttributeDict-__hash__"><strong>__hash__</strong></a>(...)</dt><dd><tt>x.<a href="#AttributeDict-__hash__">__hash__</a>() <==> hash(x)</tt></dd></dl>
<dl><dt><a name="AttributeDict-__init__"><strong>__init__</strong></a>(...)</dt><dd><tt>x.<a href="#AttributeDict-__init__">__init__</a>(...) initializes x; see x.__class__.__doc__ for signature</tt></dd></dl>
<dl><dt><a name="AttributeDict-__iter__"><strong>__iter__</strong></a>(...)</dt><dd><tt>x.<a href="#AttributeDict-__iter__">__iter__</a>() <==> iter(x)</tt></dd></dl>
<dl><dt><a name="AttributeDict-__le__"><strong>__le__</strong></a>(...)</dt><dd><tt>x.<a href="#AttributeDict-__le__">__le__</a>(y) <==> x<=y</tt></dd></dl>
<dl><dt><a name="AttributeDict-__len__"><strong>__len__</strong></a>(...)</dt><dd><tt>x.<a href="#AttributeDict-__len__">__len__</a>() <==> len(x)</tt></dd></dl>
<dl><dt><a name="AttributeDict-__lt__"><strong>__lt__</strong></a>(...)</dt><dd><tt>x.<a href="#AttributeDict-__lt__">__lt__</a>(y) <==> x<y</tt></dd></dl>
<dl><dt><a name="AttributeDict-__ne__"><strong>__ne__</strong></a>(...)</dt><dd><tt>x.<a href="#AttributeDict-__ne__">__ne__</a>(y) <==> x!=y</tt></dd></dl>
<dl><dt><a name="AttributeDict-__repr__"><strong>__repr__</strong></a>(...)</dt><dd><tt>x.<a href="#AttributeDict-__repr__">__repr__</a>() <==> repr(x)</tt></dd></dl>
<dl><dt><a name="AttributeDict-__setitem__"><strong>__setitem__</strong></a>(...)</dt><dd><tt>x.<a href="#AttributeDict-__setitem__">__setitem__</a>(i, y) <==> x[i]=y</tt></dd></dl>
<dl><dt><a name="AttributeDict-clear"><strong>clear</strong></a>(...)</dt><dd><tt>D.<a href="#AttributeDict-clear">clear</a>() -> None. Remove all items from D.</tt></dd></dl>
<dl><dt><a name="AttributeDict-get"><strong>get</strong></a>(...)</dt><dd><tt>D.<a href="#AttributeDict-get">get</a>(k[,d]) -> D[k] if k in D, else d. d defaults to None.</tt></dd></dl>
<dl><dt><a name="AttributeDict-has_key"><strong>has_key</strong></a>(...)</dt><dd><tt>D.<a href="#AttributeDict-has_key">has_key</a>(k) -> True if D has a key k, else False</tt></dd></dl>
<dl><dt><a name="AttributeDict-items"><strong>items</strong></a>(...)</dt><dd><tt>D.<a href="#AttributeDict-items">items</a>() -> list of D's (key, value) pairs, as 2-tuples</tt></dd></dl>
<dl><dt><a name="AttributeDict-iteritems"><strong>iteritems</strong></a>(...)</dt><dd><tt>D.<a href="#AttributeDict-iteritems">iteritems</a>() -> an iterator over the (key, value) items of D</tt></dd></dl>
<dl><dt><a name="AttributeDict-iterkeys"><strong>iterkeys</strong></a>(...)</dt><dd><tt>D.<a href="#AttributeDict-iterkeys">iterkeys</a>() -> an iterator over the keys of D</tt></dd></dl>
<dl><dt><a name="AttributeDict-itervalues"><strong>itervalues</strong></a>(...)</dt><dd><tt>D.<a href="#AttributeDict-itervalues">itervalues</a>() -> an iterator over the values of D</tt></dd></dl>
<dl><dt><a name="AttributeDict-keys"><strong>keys</strong></a>(...)</dt><dd><tt>D.<a href="#AttributeDict-keys">keys</a>() -> list of D's keys</tt></dd></dl>
<dl><dt><a name="AttributeDict-pop"><strong>pop</strong></a>(...)</dt><dd><tt>D.<a href="#AttributeDict-pop">pop</a>(k[,d]) -> v, remove specified key and return the corresponding value<br>
If key is not found, d is returned if given, otherwise KeyError is raised</tt></dd></dl>
<dl><dt><a name="AttributeDict-popitem"><strong>popitem</strong></a>(...)</dt><dd><tt>D.<a href="#AttributeDict-popitem">popitem</a>() -> (k, v), remove and return some (key, value) pair as a<br>
2-tuple; but raise KeyError if D is empty</tt></dd></dl>
<dl><dt><a name="AttributeDict-setdefault"><strong>setdefault</strong></a>(...)</dt><dd><tt>D.<a href="#AttributeDict-setdefault">setdefault</a>(k[,d]) -> D.<a href="#AttributeDict-get">get</a>(k,d), also set D[k]=d if k not in D</tt></dd></dl>
<dl><dt><a name="AttributeDict-update"><strong>update</strong></a>(...)</dt><dd><tt>D.<a href="#AttributeDict-update">update</a>(E) -> None. Update D from E: for k in E.<a href="#AttributeDict-keys">keys</a>(): D[k] = E[k]</tt></dd></dl>
<dl><dt><a name="AttributeDict-values"><strong>values</strong></a>(...)</dt><dd><tt>D.<a href="#AttributeDict-values">values</a>() -> list of D's values</tt></dd></dl>
<hr>
Data and other attributes inherited from <a href="__builtin__.html#dict">__builtin__.dict</a>:<br>
<dl><dt><strong>__new__</strong> = <built-in method __new__ of type object><dd><tt>T.<a href="#AttributeDict-__new__">__new__</a>(S, ...) -> a new object with type S, a subtype of T</tt></dl>
<dl><dt><strong>fromkeys</strong> = <built-in method fromkeys of type object><dd><tt><a href="__builtin__.html#dict">dict</a>.<a href="#AttributeDict-fromkeys">fromkeys</a>(S[,v]) -> New <a href="__builtin__.html#dict">dict</a> with keys from S and values equal to v.<br>
v defaults to None.</tt></dl>
</td></tr></table> <p>
<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section">
<tr bgcolor="#ffc8d8">
<td colspan=3 valign=bottom> <br>
<font color="#000000" face="helvetica, arial"><a name="EventCollection">class <strong>EventCollection</strong></a>(<a href="Asterisk.Logging.html#InstanceLogger">Asterisk.Logging.InstanceLogger</a>)</font></td></tr>
<tr bgcolor="#ffc8d8"><td rowspan=2><tt> </tt></td>
<td colspan=2><tt>Utility class to allow grouping and automatic registration of event.<br> </tt></td></tr>
<tr><td> </td>
<td width="100%"><dl><dt>Method resolution order:</dt>
<dd><a href="Asterisk.Util.html#EventCollection">EventCollection</a></dd>
<dd><a href="Asterisk.Logging.html#InstanceLogger">Asterisk.Logging.InstanceLogger</a></dd>
<dd><a href="__builtin__.html#object">__builtin__.object</a></dd>
</dl>
<hr>
Methods defined here:<br>
<dl><dt><a name="EventCollection-__iadd__"><strong>__iadd__</strong></a>(self, collection)</dt><dd><tt>Add all the events in <collection> to our collection.</tt></dd></dl>
<dl><dt><a name="EventCollection-__init__"><strong>__init__</strong></a>(self, initial<font color="#909090">=None</font>)</dt><dd><tt>If <initial> is not None, register functions from the list <initial><br>
waiting for events with the same name as the function.</tt></dd></dl>
<dl><dt><a name="EventCollection-__isub__"><strong>__isub__</strong></a>(self, collection)</dt><dd><tt>Remove all the events in <collection> from our collection.</tt></dd></dl>
<dl><dt><a name="EventCollection-copy"><strong>copy</strong></a>(self)</dt></dl>
<dl><dt><a name="EventCollection-fire"><strong>fire</strong></a>(self, name, *args, **kwargs)</dt><dd><tt>Fire event <name> passing *<args> and **<kwargs> to subscribers.</tt></dd></dl>
<dl><dt><a name="EventCollection-subscribe"><strong>subscribe</strong></a>(self, name, handler)</dt><dd><tt>Subscribe callable <handler> to event named <name>.</tt></dd></dl>
<dl><dt><a name="EventCollection-unsubscribe"><strong>unsubscribe</strong></a>(self, name, handler)</dt><dd><tt>Unsubscribe callable <handler> to event named <name>.</tt></dd></dl>
<hr>
Methods inherited from <a href="Asterisk.Logging.html#InstanceLogger">Asterisk.Logging.InstanceLogger</a>:<br>
<dl><dt><a name="EventCollection-getLogger"><strong>getLogger</strong></a>(self)</dt><dd><tt>Return the Logger instance which receives debug messages for this class<br>
instance.</tt></dd></dl>
<dl><dt><a name="EventCollection-getLoggerName"><strong>getLoggerName</strong></a>(self)</dt><dd><tt>Return the name where log messages for this instance is sent.</tt></dd></dl>
<hr>
Data and other attributes inherited from <a href="Asterisk.Logging.html#InstanceLogger">Asterisk.Logging.InstanceLogger</a>:<br>
<dl><dt><strong>__dict__</strong> = <dictproxy object><dd><tt>dictionary for instance variables (if defined)</tt></dl>
<dl><dt><strong>__weakref__</strong> = <attribute '__weakref__' of 'InstanceLogger' objects><dd><tt>list of weak references to the object (if defined)</tt></dl>
</td></tr></table> <p>
<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section">
<tr bgcolor="#ffc8d8">
<td colspan=3 valign=bottom> <br>
<font color="#000000" face="helvetica, arial"><a name="SubscriptionError">class <strong>SubscriptionError</strong></a>(<a href="Asterisk.html#BaseException">Asterisk.BaseException</a>)</font></td></tr>
<tr bgcolor="#ffc8d8"><td rowspan=2><tt> </tt></td>
<td colspan=2><tt>This exception is raised when an attempt to register the same (event,<br>
handler) tuple twice is detected.<br> </tt></td></tr>
<tr><td> </td>
<td width="100%"><dl><dt>Method resolution order:</dt>
<dd><a href="Asterisk.Util.html#SubscriptionError">SubscriptionError</a></dd>
<dd><a href="Asterisk.html#BaseException">Asterisk.BaseException</a></dd>
<dd><a href="exceptions.html#Exception">exceptions.Exception</a></dd>
</dl>
<hr>
Methods inherited from <a href="Asterisk.html#BaseException">Asterisk.BaseException</a>:<br>
<dl><dt><a name="SubscriptionError-__init__"><strong>__init__</strong></a>(self, error)</dt></dl>
<dl><dt><a name="SubscriptionError-__str__"><strong>__str__</strong></a>(self)</dt></dl>
<hr>
Methods inherited from <a href="exceptions.html#Exception">exceptions.Exception</a>:<br>
<dl><dt><a name="SubscriptionError-__getitem__"><strong>__getitem__</strong></a>(...)</dt></dl>
</td></tr></table></td></tr></table><p>
<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section">
<tr bgcolor="#55aa55">
<td colspan=3 valign=bottom> <br>
<font color="#ffffff" face="helvetica, arial"><big><strong>Data</strong></big></font></td></tr>
<tr><td bgcolor="#55aa55"><tt> </tt></td><td> </td>
<td width="100%"><strong>Unspecified</strong> = <Asterisk.Util.Unspecified><br>
<strong>__Id__</strong> = '$Id: Asterisk.Util.html 103 2004-10-17 21:00:47Z dw $'<br>
<strong>__author__</strong> = 'David M. Wilson <dw-py-Asterisk-Util.py@botanicus.net>'</td></tr></table><p>
<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section">
<tr bgcolor="#7799ee">
<td colspan=3 valign=bottom> <br>
<font color="#ffffff" face="helvetica, arial"><big><strong>Author</strong></big></font></td></tr>
<tr><td bgcolor="#7799ee"><tt> </tt></td><td> </td>
<td width="100%">David M. Wilson <dw-py-Asterisk-Util.py@botanicus.net></td></tr></table>
</body></html>
|