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

Unified 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 side-by-side diff with in-line comments
Download patch
Index: tools/telemetry/catapult_base/refactor/annotated_symbol/base_symbol.py
diff --git a/tools/telemetry/catapult_base/refactor/annotated_symbol/base_symbol.py b/tools/telemetry/catapult_base/refactor/annotated_symbol/base_symbol.py
new file mode 100644
index 0000000000000000000000000000000000000000..80fbc0b0fb06e18b102af1a590fb755ea8937103
--- /dev/null
+++ b/tools/telemetry/catapult_base/refactor/annotated_symbol/base_symbol.py
@@ -0,0 +1,36 @@
+# Copyright 2015 The Chromium Authors. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+from catapult_base.refactor import snippet
+
+
+class AnnotatedSymbol(snippet.Symbol):
+ def __init__(self, symbol_type, children):
+ super(AnnotatedSymbol, self).__init__(symbol_type, children)
+ self._modified = False
+
+ @property
+ def modified(self):
+ if self._modified:
+ return True
+ return super(AnnotatedSymbol, self).modified
+
+ def __setattr__(self, name, value):
+ if (hasattr(self.__class__, name) and
+ isinstance(getattr(self.__class__, name), property)):
+ self._modified = True
+ return super(AnnotatedSymbol, self).__setattr__(name, value)
+
+ def Cut(self, child):
+ for i in xrange(len(self._children)):
+ if self._children[i] == child:
+ self._modified = True
+ del self._children[i]
+ break
+ else:
+ raise ValueError('%s is not in %s.' % (child, self))
+
+ def Paste(self, child):
+ self._modified = True
+ self._children.append(child)

Powered by Google App Engine
This is Rietveld 408576698