1
2<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
3<html><head><title>Python: module telemetry.story.story_set</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>.<a href="telemetry.story.html"><font color="#ffffff">story</font></a>.story_set</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/story/story_set.py">telemetry/story/story_set.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.</tt></p>
16<p>
17<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section">
18<tr bgcolor="#aa55cc">
19<td colspan=3 valign=bottom>&nbsp;<br>
20<font color="#ffffff" face="helvetica, arial"><big><strong>Modules</strong></big></font></td></tr>
21
22<tr><td bgcolor="#aa55cc"><tt>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</tt></td><td>&nbsp;</td>
23<td width="100%"><table width="100%" summary="list"><tr><td width="25%" valign=top><a href="telemetry.wpr.archive_info.html">telemetry.wpr.archive_info</a><br>
24</td><td width="25%" valign=top><a href="inspect.html">inspect</a><br>
25</td><td width="25%" valign=top><a href="os.html">os</a><br>
26</td><td width="25%" valign=top><a href="telemetry.story.story.html">telemetry.story.story</a><br>
27</td></tr></table></td></tr></table><p>
28<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section">
29<tr bgcolor="#ee77aa">
30<td colspan=3 valign=bottom>&nbsp;<br>
31<font color="#ffffff" face="helvetica, arial"><big><strong>Classes</strong></big></font></td></tr>
32
33<tr><td bgcolor="#ee77aa"><tt>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</tt></td><td>&nbsp;</td>
34<td width="100%"><dl>
35<dt><font face="helvetica, arial"><a href="__builtin__.html#object">__builtin__.object</a>
36</font></dt><dd>
37<dl>
38<dt><font face="helvetica, arial"><a href="telemetry.story.story_set.html#StorySet">StorySet</a>
39</font></dt></dl>
40</dd>
41</dl>
42 <p>
43<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section">
44<tr bgcolor="#ffc8d8">
45<td colspan=3 valign=bottom>&nbsp;<br>
46<font color="#000000" face="helvetica, arial"><a name="StorySet">class <strong>StorySet</strong></a>(<a href="__builtin__.html#object">__builtin__.object</a>)</font></td></tr>
47
48<tr bgcolor="#ffc8d8"><td rowspan=2><tt>&nbsp;&nbsp;&nbsp;</tt></td>
49<td colspan=2><tt>A&nbsp;collection&nbsp;of&nbsp;stories.<br>
50&nbsp;<br>
51A&nbsp;typical&nbsp;usage&nbsp;of&nbsp;<a href="#StorySet">StorySet</a>&nbsp;would&nbsp;be&nbsp;to&nbsp;subclass&nbsp;it&nbsp;and&nbsp;then&nbsp;call<br>
52AddStory&nbsp;for&nbsp;each&nbsp;Story.<br>&nbsp;</tt></td></tr>
53<tr><td>&nbsp;</td>
54<td width="100%">Methods defined here:<br>
55<dl><dt><a name="StorySet-AddStory"><strong>AddStory</strong></a>(self, story)</dt></dl>
56
57<dl><dt><a name="StorySet-RemoveStory"><strong>RemoveStory</strong></a>(self, story)</dt><dd><tt>Removes&nbsp;a&nbsp;Story.<br>
58&nbsp;<br>
59Allows&nbsp;the&nbsp;stories&nbsp;to&nbsp;be&nbsp;filtered.</tt></dd></dl>
60
61<dl><dt><a name="StorySet-WprFilePathForStory"><strong>WprFilePathForStory</strong></a>(self, story)</dt><dd><tt>Convenient&nbsp;function&nbsp;to&nbsp;retrieve&nbsp;WPR&nbsp;archive&nbsp;file&nbsp;path.<br>
62&nbsp;<br>
63Args:<br>
64&nbsp;&nbsp;story:&nbsp;The&nbsp;Story&nbsp;to&nbsp;look&nbsp;up.<br>
65&nbsp;<br>
66Returns:<br>
67&nbsp;&nbsp;The&nbsp;WPR&nbsp;archive&nbsp;file&nbsp;path&nbsp;for&nbsp;the&nbsp;given&nbsp;Story,&nbsp;if&nbsp;found.<br>
68&nbsp;&nbsp;Otherwise,&nbsp;None.</tt></dd></dl>
69
70<dl><dt><a name="StorySet-__getitem__"><strong>__getitem__</strong></a>(self, key)</dt></dl>
71
72<dl><dt><a name="StorySet-__init__"><strong>__init__</strong></a>(self, archive_data_file<font color="#909090">=''</font>, cloud_storage_bucket<font color="#909090">=None</font>, base_dir<font color="#909090">=None</font>, serving_dirs<font color="#909090">=None</font>)</dt><dd><tt>Creates&nbsp;a&nbsp;new&nbsp;<a href="#StorySet">StorySet</a>.<br>
73&nbsp;<br>
74Args:<br>
75&nbsp;&nbsp;archive_data_file:&nbsp;The&nbsp;path&nbsp;to&nbsp;Web&nbsp;Page&nbsp;Replay's&nbsp;archive&nbsp;data,&nbsp;relative<br>
76&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;to&nbsp;self.<strong>base_dir</strong>.<br>
77&nbsp;&nbsp;cloud_storage_bucket:&nbsp;The&nbsp;cloud&nbsp;storage&nbsp;bucket&nbsp;used&nbsp;to&nbsp;download<br>
78&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Web&nbsp;Page&nbsp;Replay's&nbsp;archive&nbsp;data.&nbsp;Valid&nbsp;values&nbsp;are:&nbsp;None,<br>
79&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;story.PUBLIC_BUCKET,&nbsp;story.PARTNER_BUCKET,&nbsp;or&nbsp;story.INTERNAL_BUCKET<br>
80&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;(defined&nbsp;in&nbsp;telemetry.util.cloud_storage).<br>
81&nbsp;&nbsp;serving_dirs:&nbsp;A&nbsp;set&nbsp;of&nbsp;paths,&nbsp;relative&nbsp;to&nbsp;self.<strong>base_dir</strong>,&nbsp;to&nbsp;directories<br>
82&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;containing&nbsp;hash&nbsp;files&nbsp;for&nbsp;non-wpr&nbsp;archive&nbsp;data&nbsp;stored&nbsp;in&nbsp;cloud<br>
83&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;storage.</tt></dd></dl>
84
85<dl><dt><a name="StorySet-__iter__"><strong>__iter__</strong></a>(self)</dt></dl>
86
87<dl><dt><a name="StorySet-__len__"><strong>__len__</strong></a>(self)</dt></dl>
88
89<dl><dt><a name="StorySet-__setitem__"><strong>__setitem__</strong></a>(self, key, value)</dt></dl>
90
91<hr>
92Class methods defined here:<br>
93<dl><dt><a name="StorySet-Description"><strong>Description</strong></a>(cls)<font color="#909090"><font face="helvetica, arial"> from <a href="__builtin__.html#type">__builtin__.type</a></font></font></dt><dd><tt>Return&nbsp;a&nbsp;string&nbsp;explaining&nbsp;in&nbsp;human-understandable&nbsp;terms&nbsp;what&nbsp;this<br>
94story&nbsp;represents.<br>
95Note&nbsp;that&nbsp;this&nbsp;should&nbsp;be&nbsp;a&nbsp;classmethod&nbsp;so&nbsp;the&nbsp;benchmark_runner&nbsp;script&nbsp;can<br>
96display&nbsp;stories'&nbsp;names&nbsp;along&nbsp;with&nbsp;their&nbsp;descriptions&nbsp;in&nbsp;the&nbsp;list&nbsp;command.</tt></dd></dl>
97
98<dl><dt><a name="StorySet-Name"><strong>Name</strong></a>(cls)<font color="#909090"><font face="helvetica, arial"> from <a href="__builtin__.html#type">__builtin__.type</a></font></font></dt><dd><tt>Returns&nbsp;the&nbsp;string&nbsp;name&nbsp;of&nbsp;this&nbsp;<a href="#StorySet">StorySet</a>.<br>
99Note&nbsp;that&nbsp;this&nbsp;should&nbsp;be&nbsp;a&nbsp;classmethod&nbsp;so&nbsp;the&nbsp;benchmark_runner&nbsp;script&nbsp;can<br>
100match&nbsp;the&nbsp;story&nbsp;class&nbsp;with&nbsp;its&nbsp;name&nbsp;specified&nbsp;in&nbsp;the&nbsp;run&nbsp;command:<br>
101'Run&nbsp;&lt;User&nbsp;story&nbsp;test&nbsp;name&gt;&nbsp;&lt;User&nbsp;story&nbsp;class&nbsp;name&gt;'</tt></dd></dl>
102
103<hr>
104Data descriptors defined here:<br>
105<dl><dt><strong>__dict__</strong></dt>
106<dd><tt>dictionary&nbsp;for&nbsp;instance&nbsp;variables&nbsp;(if&nbsp;defined)</tt></dd>
107</dl>
108<dl><dt><strong>__weakref__</strong></dt>
109<dd><tt>list&nbsp;of&nbsp;weak&nbsp;references&nbsp;to&nbsp;the&nbsp;object&nbsp;(if&nbsp;defined)</tt></dd>
110</dl>
111<dl><dt><strong>allow_mixed_story_states</strong></dt>
112<dd><tt>True&nbsp;iff&nbsp;Stories&nbsp;are&nbsp;allowed&nbsp;to&nbsp;have&nbsp;different&nbsp;StoryState&nbsp;classes.<br>
113&nbsp;<br>
114There&nbsp;are&nbsp;no&nbsp;checks&nbsp;in&nbsp;place&nbsp;for&nbsp;determining&nbsp;if&nbsp;SharedStates&nbsp;are<br>
115being&nbsp;assigned&nbsp;correctly&nbsp;to&nbsp;all&nbsp;Stories&nbsp;in&nbsp;a&nbsp;given&nbsp;StorySet.&nbsp;The<br>
116majority&nbsp;of&nbsp;test&nbsp;cases&nbsp;should&nbsp;not&nbsp;need&nbsp;the&nbsp;ability&nbsp;to&nbsp;have&nbsp;multiple<br>
117SharedStates,&nbsp;which&nbsp;usually&nbsp;implies&nbsp;you&nbsp;should&nbsp;be&nbsp;writing&nbsp;multiple<br>
118benchmarks&nbsp;instead.&nbsp;We&nbsp;provide&nbsp;errors&nbsp;to&nbsp;avoid&nbsp;accidentally&nbsp;assigning<br>
119or&nbsp;defaulting&nbsp;to&nbsp;the&nbsp;wrong&nbsp;SharedState.<br>
120Override&nbsp;at&nbsp;your&nbsp;own&nbsp;risk.&nbsp;Here&nbsp;be&nbsp;dragons.</tt></dd>
121</dl>
122<dl><dt><strong>archive_data_file</strong></dt>
123</dl>
124<dl><dt><strong>base_dir</strong></dt>
125<dd><tt>The&nbsp;base&nbsp;directory&nbsp;to&nbsp;resolve&nbsp;archive_data_file.<br>
126&nbsp;<br>
127This&nbsp;defaults&nbsp;to&nbsp;the&nbsp;directory&nbsp;containing&nbsp;the&nbsp;StorySet&nbsp;instance's&nbsp;class.</tt></dd>
128</dl>
129<dl><dt><strong>bucket</strong></dt>
130</dl>
131<dl><dt><strong>file_path</strong></dt>
132</dl>
133<dl><dt><strong>serving_dirs</strong></dt>
134</dl>
135<dl><dt><strong>wpr_archive_info</strong></dt>
136<dd><tt>Lazily&nbsp;constructs&nbsp;wpr_archive_info&nbsp;if&nbsp;it's&nbsp;not&nbsp;set&nbsp;and&nbsp;returns&nbsp;it.</tt></dd>
137</dl>
138</td></tr></table></td></tr></table>
139</body></html>