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

Side by Side Diff: mojo/public/tools/bindings/pylib/mojom/parse/ast.py

Issue 366873007: Mojo: Reformat parser_unittest.py. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 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 | « no previous file | mojo/public/tools/bindings/pylib/mojom/parse/parser.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 # Copyright 2014 The Chromium Authors. All rights reserved. 1 # Copyright 2014 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
5 """Node objects for the AST for a Mojo IDL file.""" 5 """Node objects for the AST for a Mojo IDL file."""
6 6
7 # Note: For convenience of testing, you probably want to define __eq__() methods 7 # Note: For convenience of testing, you probably want to define __eq__() methods
8 # for all node types; it's okay to be slightly lax (e.g., not compare filename 8 # for all node types; it's okay to be slightly lax (e.g., not compare filename
9 # and lineno). 9 # and lineno).
10 10
11 11
12 class BaseNode(object): 12 class BaseNode(object):
13 def __init__(self, filename=None, lineno=None): 13 def __init__(self, filename=None, lineno=None):
14 self.filename = filename 14 self.filename = filename
15 self.lineno = lineno 15 self.lineno = lineno
16 16
17 17
18 class Ordinal(BaseNode): 18 class Ordinal(BaseNode):
19 """Represents an ordinal value labeling, e.g., a struct field.""" 19 """Represents an ordinal value labeling, e.g., a struct field."""
20
jamesr 2014/07/02 17:36:29 is this what the pep8 formatter would do?
viettrungluu 2014/07/02 17:59:04 I think so. It'd probably also put a blank line be
20 def __init__(self, value, **kwargs): 21 def __init__(self, value, **kwargs):
21 BaseNode.__init__(self, **kwargs) 22 BaseNode.__init__(self, **kwargs)
22 self.value = value 23 self.value = value
23 24
24 def __eq__(self, other): 25 def __eq__(self, other):
25 return self.value == other.value 26 return self.value == other.value
26 27
28
27 class Parameter(BaseNode): 29 class Parameter(BaseNode):
28 """Represents a method request or response parameter.""" 30 """Represents a method request or response parameter."""
31
29 def __init__(self, typename, name, ordinal, **kwargs): 32 def __init__(self, typename, name, ordinal, **kwargs):
30 assert isinstance(ordinal, Ordinal) 33 assert isinstance(ordinal, Ordinal)
31 BaseNode.__init__(self, **kwargs) 34 BaseNode.__init__(self, **kwargs)
32 self.typename = typename 35 self.typename = typename
33 self.name = name 36 self.name = name
34 self.ordinal = ordinal 37 self.ordinal = ordinal
35 38
36 def __eq__(self, other): 39 def __eq__(self, other):
37 return self.typename == other.typename and \ 40 return self.typename == other.typename and \
38 self.name == other.name and \ 41 self.name == other.name and \
39 self.ordinal == other.ordinal 42 self.ordinal == other.ordinal
OLDNEW
« no previous file with comments | « no previous file | mojo/public/tools/bindings/pylib/mojom/parse/parser.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698