Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(432)

Side by Side Diff: tools/telemetry/telemetry/core/extension_dict.py

Issue 12278015: [Telemetry] Reorganize everything. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Re-add shebangs. Created 7 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 # Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 # Copyright (c) 2012 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 from telemetry.core import extension_to_load
5 from telemetry import extension_to_load
6 5
7 class ExtensionDict(object): 6 class ExtensionDict(object):
8 """Dictionary of ExtensionPage instances, with extension_id as key""" 7 """Dictionary of ExtensionPage instances, with extension_id as key"""
9 8
10 def __init__(self, extension_dict_backend): 9 def __init__(self, extension_dict_backend):
11 self._extension_dict_backend = extension_dict_backend 10 self._extension_dict_backend = extension_dict_backend
12 11
13 def __getitem__(self, load_extension): 12 def __getitem__(self, load_extension):
14 """Given an ExtensionToLoad instance, returns the corresponding 13 """Given an ExtensionToLoad instance, returns the corresponding
15 ExtensionPage instance.""" 14 ExtensionPage instance."""
16 if not isinstance(load_extension, extension_to_load.ExtensionToLoad): 15 if not isinstance(load_extension, extension_to_load.ExtensionToLoad):
17 raise Exception("Input param must be of type ExtensionToLoad") 16 raise Exception("Input param must be of type ExtensionToLoad")
18 return self._extension_dict_backend.__getitem__( 17 return self._extension_dict_backend.__getitem__(
19 load_extension.extension_id()) 18 load_extension.extension_id())
20 19
21 def __contains__(self, load_extension): 20 def __contains__(self, load_extension):
22 """Checks if this ExtensionToLoad instance has been loaded""" 21 """Checks if this ExtensionToLoad instance has been loaded"""
23 if not isinstance(load_extension, extension_to_load.ExtensionToLoad): 22 if not isinstance(load_extension, extension_to_load.ExtensionToLoad):
24 raise Exception("Input param must be of type ExtensionToLoad") 23 raise Exception("Input param must be of type ExtensionToLoad")
25 return self._extension_dict_backend.__contains__( 24 return self._extension_dict_backend.__contains__(
26 load_extension.extension_id()) 25 load_extension.extension_id())
OLDNEW
« no previous file with comments | « tools/telemetry/telemetry/core/exceptions.py ('k') | tools/telemetry/telemetry/core/extension_page.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698