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

Side by Side Diff: tools/telemetry/count

Issue 1033053002: [telemetry] Refactoring script. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Comment fixup Created 5 years, 8 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
« no previous file with comments | « no previous file | tools/telemetry/refactor » ('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 2015 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 import imp
7 import inspect
8 import os
9
10 from telemetry.util import path
11
12
13 def IncludeDir(dir_name):
14 return (dir_name[0] != '.' and dir_name[0] != '_' and
15 not dir_name.startswith('internal') and not dir_name == 'third_party')
16
17
18 def IncludeFile(file_name):
19 root, ext = os.path.splitext(file_name)
20 return (file_name[0] != '.' and
21 not root.endswith('_unittest') and ext == '.py')
22
23
24 def ListFiles(directory):
25 matching_files = []
26 for root, dirs, files in os.walk(directory):
27 dirs[:] = [dir_name for dir_name in dirs if IncludeDir(dir_name)]
28 matching_files += [
29 os.path.relpath(os.path.join(root, file_name), directory)
30 for file_name in files if IncludeFile(file_name)]
31 return sorted(matching_files)
32
33
34 def main():
35 modules = ListFiles(path.GetTelemetryDir())
36 print len(modules)
37
38
39 if __name__ == '__main__':
40 main()
OLDNEW
« no previous file with comments | « no previous file | tools/telemetry/refactor » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698