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

Side by Side Diff: third_party/WebKit/Tools/Scripts/webkitpy/common/find_files.py

Issue 2256793002: Make docstrings more consistent using format-webkitpy. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Make indentation of final quote based on parse tree (indentation prior to docstring node) rather th… Created 4 years, 3 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
1 # Copyright (C) 2011 Google Inc. All rights reserved. 1 # Copyright (C) 2011 Google Inc. All rights reserved.
2 # 2 #
3 # Redistribution and use in source and binary forms, with or without 3 # Redistribution and use in source and binary forms, with or without
4 # modification, are permitted provided that the following conditions are 4 # modification, are permitted provided that the following conditions are
5 # met: 5 # met:
6 # 6 #
7 # * Redistributions of source code must retain the above copyright 7 # * Redistributions of source code must retain the above copyright
8 # notice, this list of conditions and the following disclaimer. 8 # notice, this list of conditions and the following disclaimer.
9 # * Redistributions in binary form must reproduce the above 9 # * Redistributions in binary form must reproduce the above
10 # copyright notice, this list of conditions and the following disclaimer 10 # copyright notice, this list of conditions and the following disclaimer
(...skipping 23 matching lines...) Expand all
34 If a list is passed in, the returned list of files is constrained to those 34 If a list is passed in, the returned list of files is constrained to those
35 found under the paths passed in. i.e. calling find(["LayoutTests/fast"]) 35 found under the paths passed in. i.e. calling find(["LayoutTests/fast"])
36 will only return files under that directory. 36 will only return files under that directory.
37 37
38 If a set of skipped directories is passed in, the function will filter out 38 If a set of skipped directories is passed in, the function will filter out
39 the files lying in these directories i.e. find(["LayoutTests"], set(["fast"])) 39 the files lying in these directories i.e. find(["LayoutTests"], set(["fast"]))
40 will return everything except files in fast subfolder. 40 will return everything except files in fast subfolder.
41 41
42 If a callback is passed in, it will be called for the each file and the file 42 If a callback is passed in, it will be called for the each file and the file
43 will be included into the result if the callback returns True. 43 will be included into the result if the callback returns True.
44 The callback has to take three arguments: filesystem, dirname and filename.""" 44 The callback has to take three arguments: filesystem, dirname and filename.
45 """
45 46
46 import itertools 47 import itertools
47 48
48 49
49 def find(filesystem, base_dir, paths=None, skipped_directories=None, file_filter =None, directory_sort_key=None): 50 def find(filesystem, base_dir, paths=None, skipped_directories=None, file_filter =None, directory_sort_key=None):
50 """Finds the set of tests under a given list of sub-paths. 51 """Finds the set of tests under a given list of sub-paths.
51 52
52 Args: 53 Args:
53 paths: a list of path expressions relative to base_dir 54 paths: a list of path expressions relative to base_dir
54 to search. Glob patterns are ok, as are path expressions with 55 to search. Glob patterns are ok, as are path expressions with
(...skipping 22 matching lines...) Expand all
77 paths_to_walk = itertools.chain(*(filesystem.glob(path) for path in paths)) 78 paths_to_walk = itertools.chain(*(filesystem.glob(path) for path in paths))
78 79
79 def sort_by_directory_key(files_list): 80 def sort_by_directory_key(files_list):
80 if directory_sort_key: 81 if directory_sort_key:
81 files_list.sort(key=directory_sort_key) 82 files_list.sort(key=directory_sort_key)
82 return files_list 83 return files_list
83 84
84 all_files = itertools.chain(*(sort_by_directory_key(filesystem.files_under(p ath, 85 all_files = itertools.chain(*(sort_by_directory_key(filesystem.files_under(p ath,
85 s kipped_directories, file_filter)) for path in paths_to_walk)) 86 s kipped_directories, file_filter)) for path in paths_to_walk))
86 return all_files 87 return all_files
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698