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/catapult_base/refactor/annotated_symbol/class_definition.py

Issue 1599413006: 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 import symbol
6
7 from catapult_base.refactor.annotated_symbol import base_symbol
8
9
10 __all__ = [
11 'Class',
12 ]
13
14
15 class Class(base_symbol.AnnotatedSymbol):
16 @classmethod
17 def Annotate(cls, symbol_type, children):
18 if symbol_type != symbol.stmt:
19 return None
20
21 compound_statement = children[0]
22 if compound_statement.type != symbol.compound_stmt:
23 return None
24
25 statement = compound_statement.children[0]
26 if statement.type == symbol.classdef:
27 return cls(statement.type, statement.children)
28 elif (statement.type == symbol.decorated and
29 statement.children[-1].type == symbol.classdef):
30 return cls(statement.type, statement.children)
31 else:
32 return None
33
34 @property
35 def suite(self):
36 raise NotImplementedError()
37
38 def FindChild(self, snippet_type, **kwargs):
39 return self.suite.FindChild(snippet_type, **kwargs)
40
41 def FindChildren(self, snippet_type):
42 return self.suite.FindChildren(snippet_type)
43
44 def Cut(self, child):
45 self.suite.Cut(child)
46
47 def Paste(self, child):
48 self.suite.Paste(child)
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698