1 2 <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> 3 <html><head><title>Python: module telemetry.decorators</title> 4 <meta charset="utf-8"> 5 </head><body bgcolor="#f0f0f8"> 6 7 <table width="100%" cellspacing=0 cellpadding=2 border=0 summary="heading"> 8 <tr bgcolor="#7799ee"> 9 <td valign=bottom> <br> 10 <font color="#ffffff" face="helvetica, arial"> <br><big><big><strong><a href="telemetry.html"><font color="#ffffff">telemetry</font></a>.decorators</strong></big></big></font></td 11 ><td align=right valign=bottom 12 ><font color="#ffffff" face="helvetica, arial"><a href=".">index</a><br><a href="../telemetry/decorators.py">telemetry/decorators.py</a></font></td></tr></table> 13 <p><tt># Copyright 2014 The Chromium Authors. All rights reserved.<br> 14 # Use of this source code is governed by a BSD-style license that can be<br> 15 # found in the LICENSE file.<br> 16 # pylint: disable=W0212</tt></p> 17 <p> 18 <table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section"> 19 <tr bgcolor="#aa55cc"> 20 <td colspan=3 valign=bottom> <br> 21 <font color="#ffffff" face="helvetica, arial"><big><strong>Modules</strong></big></font></td></tr> 22 23 <tr><td bgcolor="#aa55cc"><tt> </tt></td><td> </td> 24 <td width="100%"><table width="100%" summary="list"><tr><td width="25%" valign=top><a href="datetime.html">datetime</a><br> 25 <a href="functools.html">functools</a><br> 26 </td><td width="25%" valign=top><a href="inspect.html">inspect</a><br> 27 <a href="os.html">os</a><br> 28 </td><td width="25%" valign=top><a href="types.html">types</a><br> 29 <a href="warnings.html">warnings</a><br> 30 </td><td width="25%" valign=top></td></tr></table></td></tr></table><p> 31 <table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section"> 32 <tr bgcolor="#ee77aa"> 33 <td colspan=3 valign=bottom> <br> 34 <font color="#ffffff" face="helvetica, arial"><big><strong>Classes</strong></big></font></td></tr> 35 36 <tr><td bgcolor="#ee77aa"><tt> </tt></td><td> </td> 37 <td width="100%"><dl> 38 <dt><font face="helvetica, arial"><a href="__builtin__.html#object">__builtin__.object</a> 39 </font></dt><dd> 40 <dl> 41 <dt><font face="helvetica, arial"><a href="telemetry.decorators.html#Deprecated">Deprecated</a> 42 </font></dt></dl> 43 </dd> 44 </dl> 45 <p> 46 <table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section"> 47 <tr bgcolor="#ffc8d8"> 48 <td colspan=3 valign=bottom> <br> 49 <font color="#000000" face="helvetica, arial"><a name="Deprecated">class <strong>Deprecated</strong></a>(<a href="__builtin__.html#object">__builtin__.object</a>)</font></td></tr> 50 51 <tr><td bgcolor="#ffc8d8"><tt> </tt></td><td> </td> 52 <td width="100%">Methods defined here:<br> 53 <dl><dt><a name="Deprecated-__call__"><strong>__call__</strong></a>(self, target)</dt></dl> 54 55 <dl><dt><a name="Deprecated-__init__"><strong>__init__</strong></a>(self, year, month, day, extra_guidance<font color="#909090">=''</font>)</dt></dl> 56 57 <hr> 58 Data descriptors defined here:<br> 59 <dl><dt><strong>__dict__</strong></dt> 60 <dd><tt>dictionary for instance variables (if defined)</tt></dd> 61 </dl> 62 <dl><dt><strong>__weakref__</strong></dt> 63 <dd><tt>list of weak references to the object (if defined)</tt></dd> 64 </dl> 65 </td></tr></table></td></tr></table><p> 66 <table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section"> 67 <tr bgcolor="#eeaa77"> 68 <td colspan=3 valign=bottom> <br> 69 <font color="#ffffff" face="helvetica, arial"><big><strong>Functions</strong></big></font></td></tr> 70 71 <tr><td bgcolor="#eeaa77"><tt> </tt></td><td> </td> 72 <td width="100%"><dl><dt><a name="-Cache"><strong>Cache</strong></a>(obj)</dt><dd><tt>Decorator for caching read-only properties.<br> 73 <br> 74 Example usage (always returns the same Foo instance):<br> 75 @Cache<br> 76 def CreateFoo():<br> 77 return Foo()<br> 78 <br> 79 If CreateFoo() accepts parameters, a separate cached value is maintained<br> 80 for each unique parameter combination.<br> 81 <br> 82 Cached methods maintain their cache for the lifetime of the /instance/, while<br> 83 cached functions maintain their cache for the lifetime of the /module/.</tt></dd></dl> 84 <dl><dt><a name="-Disabled"><strong>Disabled</strong></a>(*args)</dt><dd><tt>Decorator for disabling tests/benchmarks.<br> 85 <br> 86 <br> 87 If args are given, the test will be disabled if ANY of the args match the<br> 88 browser type, OS name or OS version:<br> 89 @<a href="#-Disabled">Disabled</a>('canary') # Disabled for canary browsers<br> 90 @<a href="#-Disabled">Disabled</a>('win') # Disabled on Windows.<br> 91 @<a href="#-Disabled">Disabled</a>('win', 'linux') # Disabled on both Windows and Linux.<br> 92 @<a href="#-Disabled">Disabled</a>('mavericks') # Disabled on Mac Mavericks (10.9) only.<br> 93 @<a href="#-Disabled">Disabled</a>('all') # Unconditionally disabled.</tt></dd></dl> 94 <dl><dt><a name="-Enabled"><strong>Enabled</strong></a>(*args)</dt><dd><tt>Decorator for enabling tests/benchmarks.<br> 95 <br> 96 The test will be enabled if ANY of the args match the browser type, OS name<br> 97 or OS version:<br> 98 @<a href="#-Enabled">Enabled</a>('canary') # Enabled only for canary browsers<br> 99 @<a href="#-Enabled">Enabled</a>('win') # Enabled only on Windows.<br> 100 @<a href="#-Enabled">Enabled</a>('win', 'linux') # Enabled only on Windows or Linux.<br> 101 @<a href="#-Enabled">Enabled</a>('mavericks') # Enabled only on Mac Mavericks (10.9).</tt></dd></dl> 102 <dl><dt><a name="-IsEnabled"><strong>IsEnabled</strong></a>(test, possible_browser)</dt><dd><tt>Returns True iff |test| is enabled given the |possible_browser|.<br> 103 <br> 104 Use to respect the @Enabled / @Disabled decorators.<br> 105 <br> 106 Args:<br> 107 test: A function or class that may contain _disabled_strings and/or<br> 108 _enabled_strings attributes.<br> 109 possible_browser: A PossibleBrowser to check whether |test| may run against.</tt></dd></dl> 110 <dl><dt><a name="-Isolated"><strong>Isolated</strong></a>(*args)</dt><dd><tt>Decorator for noting that tests must be run in isolation.<br> 111 <br> 112 The test will be run by itself (not concurrently with any other tests)<br> 113 if ANY of the args match the browser type, OS name, or OS version.</tt></dd></dl> 114 <dl><dt><a name="-ShouldBeIsolated"><strong>ShouldBeIsolated</strong></a>(test, possible_browser)</dt></dl> 115 <dl><dt><a name="-ShouldSkip"><strong>ShouldSkip</strong></a>(test, possible_browser)</dt><dd><tt>Returns whether the test should be skipped and the reason for it.</tt></dd></dl> 116 </td></tr></table> 117 </body></html>