| OLD | NEW |
| 1 # Copyright 2014 The Chromium Authors. All rights reserved. | 1 # Copyright 2014 The Chromium Authors. All rights reserved. |
| 2 # Use of this source code is governed by a BSD-style license that can be | 2 # Use of this source code is governed by a BSD-style license that can be |
| 3 # found in the LICENSE file. | 3 # found in the LICENSE file. |
| 4 | 4 |
| 5 import inspect | 5 import inspect |
| 6 import os | 6 import os |
| 7 | 7 |
| 8 from telemetry.story import story as story_module | 8 from telemetry.story import story as story_module |
| 9 from telemetry.wpr import archive_info | 9 from telemetry.wpr import archive_info |
| 10 | 10 |
| 11 | 11 |
| 12 class StorySet(object): | 12 class StorySet(object): |
| 13 """A collection of stories. | 13 """A collection of stories. |
| 14 | 14 |
| 15 A typical usage of StorySet would be to subclass it and then call | 15 A typical usage of StorySet would be to subclass it and then call |
| 16 AddStory for each Story. | 16 AddStory for each Story. |
| 17 """ | 17 """ |
| 18 | 18 |
| 19 def __init__(self, archive_data_file='', cloud_storage_bucket=None, | 19 def __init__(self, archive_data_file='', cloud_storage_bucket=None, |
| 20 base_dir=None, serving_dirs=None, verify_names=False): | 20 base_dir=None, serving_dirs=None, verify_names=True): |
| 21 """Creates a new StorySet. | 21 """Creates a new StorySet. |
| 22 | 22 |
| 23 Args: | 23 Args: |
| 24 archive_data_file: The path to Web Page Replay's archive data, relative | 24 archive_data_file: The path to Web Page Replay's archive data, relative |
| 25 to self.base_dir. | 25 to self.base_dir. |
| 26 cloud_storage_bucket: The cloud storage bucket used to download | 26 cloud_storage_bucket: The cloud storage bucket used to download |
| 27 Web Page Replay's archive data. Valid values are: None, | 27 Web Page Replay's archive data. Valid values are: None, |
| 28 story.PUBLIC_BUCKET, story.PARTNER_BUCKET, or story.INTERNAL_BUCKET | 28 story.PUBLIC_BUCKET, story.PARTNER_BUCKET, or story.INTERNAL_BUCKET |
| 29 (defined in telemetry.util.cloud_storage). | 29 (defined in telemetry.util.cloud_storage). |
| 30 serving_dirs: A set of paths, relative to self.base_dir, to directories | 30 serving_dirs: A set of paths, relative to self.base_dir, to directories |
| (...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 169 return self.stories.__iter__() | 169 return self.stories.__iter__() |
| 170 | 170 |
| 171 def __len__(self): | 171 def __len__(self): |
| 172 return len(self.stories) | 172 return len(self.stories) |
| 173 | 173 |
| 174 def __getitem__(self, key): | 174 def __getitem__(self, key): |
| 175 return self.stories[key] | 175 return self.stories[key] |
| 176 | 176 |
| 177 def __setitem__(self, key, value): | 177 def __setitem__(self, key, value): |
| 178 self._stories[key] = value | 178 self._stories[key] = value |
| OLD | NEW |