Joe Gregorio | ad8013f | 2012-08-03 08:44:02 -0400 | [diff] [blame] | 1 | <?xml version="1.0" encoding="ascii"?> |
| 2 | <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" |
| 3 | "DTD/xhtml1-transitional.dtd"> |
| 4 | <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> |
| 5 | <head> |
| 6 | <title>oauth2client.util</title> |
| 7 | <link rel="stylesheet" href="epydoc.css" type="text/css" /> |
| 8 | <script type="text/javascript" src="epydoc.js"></script> |
| 9 | </head> |
| 10 | |
| 11 | <body bgcolor="white" text="black" link="blue" vlink="#204080" |
| 12 | alink="#204080"> |
| 13 | <!-- ==================== NAVIGATION BAR ==================== --> |
| 14 | <table class="navbar" border="0" width="100%" cellpadding="0" |
| 15 | bgcolor="#a0c0ff" cellspacing="0"> |
| 16 | <tr valign="middle"> |
| 17 | |
| 18 | <!-- Tree link --> |
| 19 | <th> <a |
| 20 | href="module-tree.html">Trees</a> </th> |
| 21 | |
| 22 | <!-- Index link --> |
| 23 | <th> <a |
| 24 | href="identifier-index.html">Indices</a> </th> |
| 25 | |
| 26 | <!-- Help link --> |
| 27 | <th> <a |
| 28 | href="help.html">Help</a> </th> |
| 29 | |
| 30 | <th class="navbar" width="100%"></th> |
| 31 | </tr> |
| 32 | </table> |
| 33 | <table width="100%" cellpadding="0" cellspacing="0"> |
| 34 | <tr valign="top"> |
| 35 | <td width="100%"> |
| 36 | <span class="breadcrumbs"> |
| 37 | <a href="oauth2client-module.html">Package oauth2client</a> :: |
| 38 | Module util |
| 39 | </span> |
| 40 | </td> |
| 41 | <td> |
| 42 | <table cellpadding="0" cellspacing="0"> |
| 43 | <!-- hide/show private --> |
| 44 | <tr><td align="right"><span class="options">[<a href="javascript:void(0);" class="privatelink" |
| 45 | onclick="toggle_private();">hide private</a>]</span></td></tr> |
| 46 | <tr><td align="right"><span class="options" |
| 47 | >[<a href="frames.html" target="_top">frames</a |
| 48 | >] | <a href="oauth2client.util-module.html" |
| 49 | target="_top">no frames</a>]</span></td></tr> |
| 50 | </table> |
| 51 | </td> |
| 52 | </tr> |
| 53 | </table> |
| 54 | <!-- ==================== MODULE DESCRIPTION ==================== --> |
Joe Gregorio | 1b425aa | 2012-08-24 12:04:34 -0400 | [diff] [blame] | 55 | <h1 class="epydoc">Module util</h1><p class="nomargin-top"><span class="codelink"><a href="oauth2client.util-pysrc.html">source code</a></span></p> |
Joe Gregorio | ad8013f | 2012-08-03 08:44:02 -0400 | [diff] [blame] | 56 | <pre class="literalblock"> |
| 57 | Common utility library. |
| 58 | |
| 59 | </pre> |
| 60 | |
| 61 | <hr /> |
| 62 | <div class="fields"> <dl><dt>Authors:</dt> |
| 63 | <dd> |
| 64 | rafek@google.com (Rafe Kaplan), |
| 65 | guido@google.com (Guido van Rossum) |
| 66 | </dd> |
| 67 | </dl> |
| 68 | </div><!-- ==================== FUNCTIONS ==================== --> |
| 69 | <a name="section-Functions"></a> |
| 70 | <table class="summary" border="1" cellpadding="3" |
| 71 | cellspacing="0" width="100%" bgcolor="white"> |
| 72 | <tr bgcolor="#70b0f0" class="table-header"> |
| 73 | <td colspan="2" class="table-header"> |
| 74 | <table border="0" cellpadding="0" cellspacing="0" width="100%"> |
| 75 | <tr valign="top"> |
| 76 | <td align="left"><span class="table-header">Functions</span></td> |
| 77 | <td align="right" valign="top" |
| 78 | ><span class="options">[<a href="#section-Functions" |
| 79 | class="privatelink" onclick="toggle_private();" |
| 80 | >hide private</a>]</span></td> |
| 81 | </tr> |
| 82 | </table> |
| 83 | </td> |
| 84 | </tr> |
| 85 | <tr> |
| 86 | <td width="15%" align="right" valign="top" class="summary"> |
| 87 | <span class="summary-type"> </span> |
| 88 | </td><td class="summary"> |
| 89 | <table width="100%" cellpadding="0" cellspacing="0" border="0"> |
| 90 | <tr> |
| 91 | <td><span class="summary-sig"><a href="oauth2client.util-module.html#positional" class="summary-sig-name">positional</a>(<span class="summary-sig-arg">max_positional_args</span>)</span><br /> |
| 92 | A decorator to declare that only the first N arguments my be positional.</td> |
| 93 | <td align="right" valign="top"> |
Joe Gregorio | 1b425aa | 2012-08-24 12:04:34 -0400 | [diff] [blame] | 94 | <span class="codelink"><a href="oauth2client.util-pysrc.html#positional">source code</a></span> |
Joe Gregorio | ad8013f | 2012-08-03 08:44:02 -0400 | [diff] [blame] | 95 | |
| 96 | </td> |
| 97 | </tr> |
| 98 | </table> |
| 99 | |
| 100 | </td> |
| 101 | </tr> |
| 102 | </table> |
| 103 | <!-- ==================== VARIABLES ==================== --> |
| 104 | <a name="section-Variables"></a> |
| 105 | <table class="summary" border="1" cellpadding="3" |
| 106 | cellspacing="0" width="100%" bgcolor="white"> |
| 107 | <tr bgcolor="#70b0f0" class="table-header"> |
| 108 | <td colspan="2" class="table-header"> |
| 109 | <table border="0" cellpadding="0" cellspacing="0" width="100%"> |
| 110 | <tr valign="top"> |
| 111 | <td align="left"><span class="table-header">Variables</span></td> |
| 112 | <td align="right" valign="top" |
| 113 | ><span class="options">[<a href="#section-Variables" |
| 114 | class="privatelink" onclick="toggle_private();" |
| 115 | >hide private</a>]</span></td> |
| 116 | </tr> |
| 117 | </table> |
| 118 | </td> |
| 119 | </tr> |
| 120 | <tr class="private"> |
| 121 | <td width="15%" align="right" valign="top" class="summary"> |
| 122 | <span class="summary-type"> </span> |
| 123 | </td><td class="summary"> |
Joe Gregorio | 1b425aa | 2012-08-24 12:04:34 -0400 | [diff] [blame] | 124 | <a name="logger"></a><span class="summary-name">logger</span> = <code title="logging.getLogger(__name__)">logging.getLogger(__name__)</code> |
| 125 | </td> |
| 126 | </tr> |
| 127 | <tr class="private"> |
| 128 | <td width="15%" align="right" valign="top" class="summary"> |
| 129 | <span class="summary-type"> </span> |
| 130 | </td><td class="summary"> |
Joe Gregorio | ad8013f | 2012-08-03 08:44:02 -0400 | [diff] [blame] | 131 | <a name="FLAGS"></a><span class="summary-name">FLAGS</span> = <code title="gflags.FLAGS">gflags.FLAGS</code> |
| 132 | </td> |
| 133 | </tr> |
Joe Gregorio | ad8013f | 2012-08-03 08:44:02 -0400 | [diff] [blame] | 134 | </table> |
| 135 | <!-- ==================== FUNCTION DETAILS ==================== --> |
| 136 | <a name="section-FunctionDetails"></a> |
| 137 | <table class="details" border="1" cellpadding="3" |
| 138 | cellspacing="0" width="100%" bgcolor="white"> |
| 139 | <tr bgcolor="#70b0f0" class="table-header"> |
| 140 | <td colspan="2" class="table-header"> |
| 141 | <table border="0" cellpadding="0" cellspacing="0" width="100%"> |
| 142 | <tr valign="top"> |
| 143 | <td align="left"><span class="table-header">Function Details</span></td> |
| 144 | <td align="right" valign="top" |
| 145 | ><span class="options">[<a href="#section-FunctionDetails" |
| 146 | class="privatelink" onclick="toggle_private();" |
| 147 | >hide private</a>]</span></td> |
| 148 | </tr> |
| 149 | </table> |
| 150 | </td> |
| 151 | </tr> |
| 152 | </table> |
| 153 | <a name="positional"></a> |
| 154 | <div> |
| 155 | <table class="details" border="1" cellpadding="3" |
| 156 | cellspacing="0" width="100%" bgcolor="white"> |
| 157 | <tr><td> |
| 158 | <table width="100%" cellpadding="0" cellspacing="0" border="0"> |
| 159 | <tr valign="top"><td> |
| 160 | <h3 class="epydoc"><span class="sig"><span class="sig-name">positional</span>(<span class="sig-arg">max_positional_args</span>)</span> |
| 161 | </h3> |
| 162 | </td><td align="right" valign="top" |
Joe Gregorio | 1b425aa | 2012-08-24 12:04:34 -0400 | [diff] [blame] | 163 | ><span class="codelink"><a href="oauth2client.util-pysrc.html#positional">source code</a></span> |
Joe Gregorio | ad8013f | 2012-08-03 08:44:02 -0400 | [diff] [blame] | 164 | </td> |
| 165 | </tr></table> |
| 166 | |
| 167 | <pre class="literalblock"> |
| 168 | A decorator to declare that only the first N arguments my be positional. |
| 169 | |
| 170 | This decorator makes it easy to support Python 3 style key-word only |
| 171 | parameters. For example, in Python 3 it is possible to write: |
| 172 | |
| 173 | def fn(pos1, *, kwonly1=None, kwonly1=None): |
| 174 | ... |
| 175 | |
| 176 | All named parameters after * must be a keyword: |
| 177 | |
| 178 | fn(10, 'kw1', 'kw2') # Raises exception. |
| 179 | fn(10, kwonly1='kw1') # Ok. |
| 180 | |
| 181 | Example: |
| 182 | To define a function like above, do: |
| 183 | |
| 184 | @positional(1) |
| 185 | def fn(pos1, kwonly1=None, kwonly2=None): |
| 186 | ... |
| 187 | |
| 188 | If no default value is provided to a keyword argument, it becomes a required |
| 189 | keyword argument: |
| 190 | |
| 191 | @positional(0) |
| 192 | def fn(required_kw): |
| 193 | ... |
| 194 | |
| 195 | This must be called with the keyword parameter: |
| 196 | |
| 197 | fn() # Raises exception. |
| 198 | fn(10) # Raises exception. |
| 199 | fn(required_kw=10) # Ok. |
| 200 | |
| 201 | When defining instance or class methods always remember to account for |
| 202 | 'self' and 'cls': |
| 203 | |
| 204 | class MyClass(object): |
| 205 | |
| 206 | @positional(2) |
| 207 | def my_method(self, pos1, kwonly1=None): |
| 208 | ... |
| 209 | |
| 210 | @classmethod |
| 211 | @positional(2) |
| 212 | def my_method(cls, pos1, kwonly1=None): |
| 213 | ... |
| 214 | |
| 215 | The positional decorator behavior is controlled by the |
| 216 | --positional_parameters_enforcement flag. The flag may be set to 'EXCEPTION', |
| 217 | 'WARNING' or 'IGNORE' to raise an exception, log a warning, or do nothing, |
| 218 | respectively, if a declaration is violated. |
| 219 | |
| 220 | Args: |
| 221 | max_positional_arguments: Maximum number of positional arguments. All |
| 222 | parameters after the this index must be keyword only. |
| 223 | |
| 224 | Returns: |
| 225 | A decorator that prevents using arguments after max_positional_args from |
| 226 | being used as positional parameters. |
| 227 | |
| 228 | Raises: |
| 229 | TypeError if a key-word only argument is provided as a positional parameter, |
| 230 | but only if the --positional_parameters_enforcement flag is set to |
| 231 | 'EXCEPTION'. |
| 232 | |
| 233 | </pre> |
| 234 | <dl class="fields"> |
| 235 | </dl> |
| 236 | </td></tr></table> |
| 237 | </div> |
| 238 | <br /> |
| 239 | <!-- ==================== NAVIGATION BAR ==================== --> |
| 240 | <table class="navbar" border="0" width="100%" cellpadding="0" |
| 241 | bgcolor="#a0c0ff" cellspacing="0"> |
| 242 | <tr valign="middle"> |
| 243 | |
| 244 | <!-- Tree link --> |
| 245 | <th> <a |
| 246 | href="module-tree.html">Trees</a> </th> |
| 247 | |
| 248 | <!-- Index link --> |
| 249 | <th> <a |
| 250 | href="identifier-index.html">Indices</a> </th> |
| 251 | |
| 252 | <!-- Help link --> |
| 253 | <th> <a |
| 254 | href="help.html">Help</a> </th> |
| 255 | |
| 256 | <th class="navbar" width="100%"></th> |
| 257 | </tr> |
| 258 | </table> |
| 259 | <table border="0" cellpadding="0" cellspacing="0" width="100%%"> |
| 260 | <tr> |
| 261 | <td align="left" class="footer"> |
Joe Gregorio | f4839b0 | 2012-09-06 13:47:24 -0400 | [diff] [blame^] | 262 | Generated by Epydoc 3.0.1 on Thu Sep 6 13:36:11 2012 |
Joe Gregorio | ad8013f | 2012-08-03 08:44:02 -0400 | [diff] [blame] | 263 | </td> |
| 264 | <td align="right" class="footer"> |
| 265 | <a target="mainFrame" href="http://epydoc.sourceforge.net" |
| 266 | >http://epydoc.sourceforge.net</a> |
| 267 | </td> |
| 268 | </tr> |
| 269 | </table> |
| 270 | |
| 271 | <script type="text/javascript"> |
| 272 | <!-- |
| 273 | // Private objects are initially displayed (because if |
| 274 | // javascript is turned off then we want them to be |
| 275 | // visible); but by default, we want to hide them. So hide |
| 276 | // them unless we have a cookie that says to show them. |
| 277 | checkCookie(); |
| 278 | // --> |
| 279 | </script> |
| 280 | </body> |
| 281 | </html> |