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

Side by Side Diff: grit/tool/count.py

Issue 1442863002: Remove contents of grit's SVN repository. (Closed) Base URL: http://grit-i18n.googlecode.com/svn/trunk/
Patch Set: Created 5 years, 1 month 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 | « grit/tool/buildinfo_unittest.py ('k') | grit/tool/diff_structures.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 #!/usr/bin/env python
2 # Copyright (c) 2012 The Chromium Authors. All rights reserved.
3 # Use of this source code is governed by a BSD-style license that can be
4 # found in the LICENSE file.
5
6 '''Count number of occurrences of a given message ID.'''
7
8 from grit import grd_reader
9 from grit.tool import interface
10
11
12 class CountMessage(interface.Tool):
13 '''Count the number of times a given message ID is used.'''
14
15 def __init__(self):
16 pass
17
18 def ShortDescription(self):
19 return 'Count the number of times a given message ID is used.'
20
21 def Run(self, opts, args):
22 self.SetOptions(opts)
23
24 id = args[0]
25 res_tree = grd_reader.Parse(opts.input, debug=opts.extra_verbose)
26 res_tree.OnlyTheseTranslations([])
27 res_tree.RunGatherers()
28
29 count = 0
30 for c in res_tree.UberClique().AllCliques():
31 if c.GetId() == id:
32 count += 1
33
34 print "There are %d occurrences of message %s." % (count, id)
35
OLDNEW
« no previous file with comments | « grit/tool/buildinfo_unittest.py ('k') | grit/tool/diff_structures.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698