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>&nbsp;<br>
10<font color="#ffffff" face="helvetica, arial">&nbsp;<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>#&nbsp;Copyright&nbsp;2014&nbsp;The&nbsp;Chromium&nbsp;Authors.&nbsp;All&nbsp;rights&nbsp;reserved.<br>
14#&nbsp;Use&nbsp;of&nbsp;this&nbsp;source&nbsp;code&nbsp;is&nbsp;governed&nbsp;by&nbsp;a&nbsp;BSD-style&nbsp;license&nbsp;that&nbsp;can&nbsp;be<br>
15#&nbsp;found&nbsp;in&nbsp;the&nbsp;LICENSE&nbsp;file.<br>
16#&nbsp;pylint:&nbsp;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>&nbsp;<br>
21<font color="#ffffff" face="helvetica, arial"><big><strong>Modules</strong></big></font></td></tr>
22
23<tr><td bgcolor="#aa55cc"><tt>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</tt></td><td>&nbsp;</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>&nbsp;<br>
34<font color="#ffffff" face="helvetica, arial"><big><strong>Classes</strong></big></font></td></tr>
35
36<tr><td bgcolor="#ee77aa"><tt>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</tt></td><td>&nbsp;</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>&nbsp;<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>&nbsp;&nbsp;&nbsp;</tt></td><td>&nbsp;</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>
58Data descriptors defined here:<br>
59<dl><dt><strong>__dict__</strong></dt>
60<dd><tt>dictionary&nbsp;for&nbsp;instance&nbsp;variables&nbsp;(if&nbsp;defined)</tt></dd>
61</dl>
62<dl><dt><strong>__weakref__</strong></dt>
63<dd><tt>list&nbsp;of&nbsp;weak&nbsp;references&nbsp;to&nbsp;the&nbsp;object&nbsp;(if&nbsp;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>&nbsp;<br>
69<font color="#ffffff" face="helvetica, arial"><big><strong>Functions</strong></big></font></td></tr>
70
71<tr><td bgcolor="#eeaa77"><tt>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</tt></td><td>&nbsp;</td>
72<td width="100%"><dl><dt><a name="-Cache"><strong>Cache</strong></a>(obj)</dt><dd><tt>Decorator&nbsp;for&nbsp;caching&nbsp;read-only&nbsp;properties.<br>
73&nbsp;<br>
74Example&nbsp;usage&nbsp;(always&nbsp;returns&nbsp;the&nbsp;same&nbsp;Foo&nbsp;instance):<br>
75&nbsp;&nbsp;@Cache<br>
76&nbsp;&nbsp;def&nbsp;CreateFoo():<br>
77&nbsp;&nbsp;&nbsp;&nbsp;return&nbsp;Foo()<br>
78&nbsp;<br>
79If&nbsp;CreateFoo()&nbsp;accepts&nbsp;parameters,&nbsp;a&nbsp;separate&nbsp;cached&nbsp;value&nbsp;is&nbsp;maintained<br>
80for&nbsp;each&nbsp;unique&nbsp;parameter&nbsp;combination.<br>
81&nbsp;<br>
82Cached&nbsp;methods&nbsp;maintain&nbsp;their&nbsp;cache&nbsp;for&nbsp;the&nbsp;lifetime&nbsp;of&nbsp;the&nbsp;/instance/,&nbsp;while<br>
83cached&nbsp;functions&nbsp;maintain&nbsp;their&nbsp;cache&nbsp;for&nbsp;the&nbsp;lifetime&nbsp;of&nbsp;the&nbsp;/module/.</tt></dd></dl>
84 <dl><dt><a name="-Disabled"><strong>Disabled</strong></a>(*args)</dt><dd><tt>Decorator&nbsp;for&nbsp;disabling&nbsp;tests/benchmarks.<br>
85&nbsp;<br>
86&nbsp;<br>
87If&nbsp;args&nbsp;are&nbsp;given,&nbsp;the&nbsp;test&nbsp;will&nbsp;be&nbsp;disabled&nbsp;if&nbsp;ANY&nbsp;of&nbsp;the&nbsp;args&nbsp;match&nbsp;the<br>
88browser&nbsp;type,&nbsp;OS&nbsp;name&nbsp;or&nbsp;OS&nbsp;version:<br>
89&nbsp;&nbsp;@<a href="#-Disabled">Disabled</a>('canary')&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;#&nbsp;Disabled&nbsp;for&nbsp;canary&nbsp;browsers<br>
90&nbsp;&nbsp;@<a href="#-Disabled">Disabled</a>('win')&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;#&nbsp;Disabled&nbsp;on&nbsp;Windows.<br>
91&nbsp;&nbsp;@<a href="#-Disabled">Disabled</a>('win',&nbsp;'linux')&nbsp;&nbsp;#&nbsp;Disabled&nbsp;on&nbsp;both&nbsp;Windows&nbsp;and&nbsp;Linux.<br>
92&nbsp;&nbsp;@<a href="#-Disabled">Disabled</a>('mavericks')&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;#&nbsp;Disabled&nbsp;on&nbsp;Mac&nbsp;Mavericks&nbsp;(10.9)&nbsp;only.<br>
93&nbsp;&nbsp;@<a href="#-Disabled">Disabled</a>('all')&nbsp;&nbsp;#&nbsp;Unconditionally&nbsp;disabled.</tt></dd></dl>
94 <dl><dt><a name="-Enabled"><strong>Enabled</strong></a>(*args)</dt><dd><tt>Decorator&nbsp;for&nbsp;enabling&nbsp;tests/benchmarks.<br>
95&nbsp;<br>
96The&nbsp;test&nbsp;will&nbsp;be&nbsp;enabled&nbsp;if&nbsp;ANY&nbsp;of&nbsp;the&nbsp;args&nbsp;match&nbsp;the&nbsp;browser&nbsp;type,&nbsp;OS&nbsp;name<br>
97or&nbsp;OS&nbsp;version:<br>
98&nbsp;&nbsp;@<a href="#-Enabled">Enabled</a>('canary')&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;#&nbsp;Enabled&nbsp;only&nbsp;for&nbsp;canary&nbsp;browsers<br>
99&nbsp;&nbsp;@<a href="#-Enabled">Enabled</a>('win')&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;#&nbsp;Enabled&nbsp;only&nbsp;on&nbsp;Windows.<br>
100&nbsp;&nbsp;@<a href="#-Enabled">Enabled</a>('win',&nbsp;'linux')&nbsp;&nbsp;#&nbsp;Enabled&nbsp;only&nbsp;on&nbsp;Windows&nbsp;or&nbsp;Linux.<br>
101&nbsp;&nbsp;@<a href="#-Enabled">Enabled</a>('mavericks')&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;#&nbsp;Enabled&nbsp;only&nbsp;on&nbsp;Mac&nbsp;Mavericks&nbsp;(10.9).</tt></dd></dl>
102 <dl><dt><a name="-IsEnabled"><strong>IsEnabled</strong></a>(test, possible_browser)</dt><dd><tt>Returns&nbsp;True&nbsp;iff&nbsp;|test|&nbsp;is&nbsp;enabled&nbsp;given&nbsp;the&nbsp;|possible_browser|.<br>
103&nbsp;<br>
104Use&nbsp;to&nbsp;respect&nbsp;the&nbsp;@Enabled&nbsp;/&nbsp;@Disabled&nbsp;decorators.<br>
105&nbsp;<br>
106Args:<br>
107&nbsp;&nbsp;test:&nbsp;A&nbsp;function&nbsp;or&nbsp;class&nbsp;that&nbsp;may&nbsp;contain&nbsp;_disabled_strings&nbsp;and/or<br>
108&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;_enabled_strings&nbsp;attributes.<br>
109&nbsp;&nbsp;possible_browser:&nbsp;A&nbsp;PossibleBrowser&nbsp;to&nbsp;check&nbsp;whether&nbsp;|test|&nbsp;may&nbsp;run&nbsp;against.</tt></dd></dl>
110 <dl><dt><a name="-Isolated"><strong>Isolated</strong></a>(*args)</dt><dd><tt>Decorator&nbsp;for&nbsp;noting&nbsp;that&nbsp;tests&nbsp;must&nbsp;be&nbsp;run&nbsp;in&nbsp;isolation.<br>
111&nbsp;<br>
112The&nbsp;test&nbsp;will&nbsp;be&nbsp;run&nbsp;by&nbsp;itself&nbsp;(not&nbsp;concurrently&nbsp;with&nbsp;any&nbsp;other&nbsp;tests)<br>
113if&nbsp;ANY&nbsp;of&nbsp;the&nbsp;args&nbsp;match&nbsp;the&nbsp;browser&nbsp;type,&nbsp;OS&nbsp;name,&nbsp;or&nbsp;OS&nbsp;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&nbsp;whether&nbsp;the&nbsp;test&nbsp;should&nbsp;be&nbsp;skipped&nbsp;and&nbsp;the&nbsp;reason&nbsp;for&nbsp;it.</tt></dd></dl>
116</td></tr></table>
117</body></html>