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

Side by Side Diff: tools/telemetry/catapult_base/refactor/annotated_symbol/base_symbol.py

Issue 1620023002: Revert of Remove catapult_base from telemetry. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@perf_cb_move
Patch Set: Created 4 years, 11 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
OLDNEW
(Empty)
1 # Copyright 2015 The Chromium Authors. All rights reserved.
2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file.
4
5 from catapult_base.refactor import snippet
6
7
8 class AnnotatedSymbol(snippet.Symbol):
9 def __init__(self, symbol_type, children):
10 super(AnnotatedSymbol, self).__init__(symbol_type, children)
11 self._modified = False
12
13 @property
14 def modified(self):
15 if self._modified:
16 return True
17 return super(AnnotatedSymbol, self).modified
18
19 def __setattr__(self, name, value):
20 if (hasattr(self.__class__, name) and
21 isinstance(getattr(self.__class__, name), property)):
22 self._modified = True
23 return super(AnnotatedSymbol, self).__setattr__(name, value)
24
25 def Cut(self, child):
26 for i in xrange(len(self._children)):
27 if self._children[i] == child:
28 self._modified = True
29 del self._children[i]
30 break
31 else:
32 raise ValueError('%s is not in %s.' % (child, self))
33
34 def Paste(self, child):
35 self._modified = True
36 self._children.append(child)
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698