OLD | NEW |
---|---|
(Empty) | |
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 | |
3 # found in the LICENSE file. | |
4 | |
5 import sys | |
6 | |
7 import plugin_protos | |
8 import types | |
9 | |
10 | |
11 def Debug(data): | |
12 sys.stderr.write(str(data)) | |
13 sys.stderr.write('\n') | |
14 sys.stderr.flush() | |
15 | |
16 | |
17 def TitleCase(s): | |
18 return ''.join((p[0].upper() + p[1:] for p in s.split('_'))) | |
nyquist
2016/06/14 00:48:11
Do you need the inner parenthesis here?
wychen
2016/08/07 09:16:27
Done.
| |
19 | |
20 | |
21 def Indented(s, indent=2): | |
22 return '\n'.join((' ' * indent) + p for p in s.rstrip('\n').split('\n')) | |
23 | |
24 | |
25 proto_path_to_file_map = {} | |
26 | |
27 | |
28 def RegisterProtoFile(proto_file): | |
29 proto_path_to_file_map[proto_file.Filename()] = proto_file | |
30 types.RegisterTypesForFile(proto_file) | |
31 | |
32 | |
33 def GetProtoFileForFilename(filename): | |
34 proto_file = proto_path_to_file_map[filename] | |
35 assert proto_file | |
36 return proto_file | |
37 | |
38 | |
39 def ReadRequestFromStdin(): | |
40 data = sys.stdin.read() | |
41 return plugin_protos.PluginRequestFromString(data) | |
OLD | NEW |