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

Side by Side Diff: tools/dom/scripts/monitored.py

Issue 16494002: Expand overloaded methods and optional parameters in the html library. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 5 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
« no previous file with comments | « tools/dom/scripts/logging.conf ('k') | tools/dom/scripts/systemhtml.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 #!/usr/bin/python 1 #!/usr/bin/python
2 # Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file 2 # Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
3 # for details. All rights reserved. Use of this source code is governed by a 3 # for details. All rights reserved. Use of this source code is governed by a
4 # BSD-style license that can be found in the LICENSE file. 4 # BSD-style license that can be found in the LICENSE file.
5 5
6 """This module provides maps and sets that report unused elements.""" 6 """This module provides maps and sets that report unused elements."""
7 7
8 _monitored_values = [] 8 _monitored_values = []
9 9
10 10
(...skipping 28 matching lines...) Expand all
39 self._used_keys.add(key) 39 self._used_keys.add(key)
40 return key in self._map 40 return key in self._map
41 41
42 def __iter__(self): 42 def __iter__(self):
43 return self._map.__iter__() 43 return self._map.__iter__()
44 44
45 def get(self, key, default=None): 45 def get(self, key, default=None):
46 self._used_keys.add(key) 46 self._used_keys.add(key)
47 return self._map.get(key, default) 47 return self._map.get(key, default)
48 48
49 def keys(self):
50 return self._map.keys()
51
49 def CheckUsage(self): 52 def CheckUsage(self):
50 for v in sorted(self._map.keys()): 53 for v in sorted(self._map.keys()):
51 if v not in self._used_keys: 54 if v not in self._used_keys:
52 print "dict '%s' has unused key '%s'" % (self.name, v) 55 print "dict '%s' has unused key '%s'" % (self.name, v)
53 56
54 57
55 class Set(MonitoredCollection): 58 class Set(MonitoredCollection):
56 """Wrapper for a set that reports unused keys.""" 59 """Wrapper for a set that reports unused keys."""
57 60
58 def __init__(self, name, a_set, dart2jsOnly=False): 61 def __init__(self, name, a_set, dart2jsOnly=False):
59 super(Set, self).__init__(name, dart2jsOnly) 62 super(Set, self).__init__(name, dart2jsOnly)
60 self._set = a_set 63 self._set = a_set
61 64
62 def __contains__(self, key): 65 def __contains__(self, key):
63 self._used_keys.add(key) 66 self._used_keys.add(key)
64 return key in self._set 67 return key in self._set
65 68
66 def __iter__(self): 69 def __iter__(self):
67 return self._set.__iter__() 70 return self._set.__iter__()
68 71
69 def add(self, key): 72 def add(self, key):
70 self._set += [key] 73 self._set += [key]
71 74
72 def CheckUsage(self): 75 def CheckUsage(self):
73 for v in sorted(self._set): 76 for v in sorted(self._set):
74 if v not in self._used_keys: 77 if v not in self._used_keys:
75 print "set '%s' has unused key '%s'" % (self.name, v) 78 print "set '%s' has unused key '%s'" % (self.name, v)
OLDNEW
« no previous file with comments | « tools/dom/scripts/logging.conf ('k') | tools/dom/scripts/systemhtml.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698