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

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

Issue 2679393004: Fix all "dangerous-default-value" pylint warnings. (Closed)
Patch Set: Created 3 years, 10 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 | third_party/WebKit/Tools/Scripts/webkitpy/layout_tests/controllers/layout_test_runner.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 (C) 2010 Google Inc. All rights reserved. 1 # Copyright (C) 2010 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 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
72 72
73 def copyfile(self, source, destination): 73 def copyfile(self, source, destination):
74 shutil.copyfile(source, destination) 74 shutil.copyfile(source, destination)
75 75
76 def dirname(self, path): 76 def dirname(self, path):
77 return os.path.dirname(path) 77 return os.path.dirname(path)
78 78
79 def exists(self, path): 79 def exists(self, path):
80 return os.path.exists(path) 80 return os.path.exists(path)
81 81
82 def files_under(self, path, dirs_to_skip=[], file_filter=None): 82 def files_under(self, path, dirs_to_skip=None, file_filter=None):
83 """Return the list of all files under the given path in topdown order. 83 """Return the list of all files under the given path in topdown order.
84 84
85 Args: 85 Args:
86 dirs_to_skip: a list of directories to skip over during the 86 dirs_to_skip: a list of directories to skip over during the
87 traversal (e.g., .svn, resources, etc.) 87 traversal (e.g., .svn, resources, etc.)
88 file_filter: if not None, the filter will be invoked 88 file_filter: if not None, the filter will be invoked
89 with the filesystem object and the dirname and basename of 89 with the filesystem object and the dirname and basename of
90 each file found. The file is included in the result if the 90 each file found. The file is included in the result if the
91 callback returns True. 91 callback returns True.
92 """ 92 """
93 dirs_to_skip = dirs_to_skip or []
94
93 def filter_all(fs, dirpath, basename): 95 def filter_all(fs, dirpath, basename):
94 return True 96 return True
95 97
96 file_filter = file_filter or filter_all 98 file_filter = file_filter or filter_all
97 files = [] 99 files = []
98 if self.isfile(path): 100 if self.isfile(path):
99 if file_filter(self, self.dirname(path), self.basename(path)): 101 if file_filter(self, self.dirname(path), self.basename(path)):
100 files.append(path) 102 files.append(path)
101 return files 103 return files
102 104
(...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after
274 def split(self, path): 276 def split(self, path):
275 """Return (dirname, basename + '.' + ext)""" 277 """Return (dirname, basename + '.' + ext)"""
276 return os.path.split(path) 278 return os.path.split(path)
277 279
278 def splitext(self, path): 280 def splitext(self, path):
279 """Return (dirname + os.sep + basename, '.' + ext)""" 281 """Return (dirname + os.sep + basename, '.' + ext)"""
280 return os.path.splitext(path) 282 return os.path.splitext(path)
281 283
282 def make_executable(self, file_path): 284 def make_executable(self, file_path):
283 os.chmod(file_path, stat.S_IRUSR | stat.S_IWUSR | stat.S_IXUSR | stat.S_ IRGRP | stat.S_IXGRP) 285 os.chmod(file_path, stat.S_IRUSR | stat.S_IWUSR | stat.S_IXUSR | stat.S_ IRGRP | stat.S_IXGRP)
OLDNEW
« no previous file with comments | « no previous file | third_party/WebKit/Tools/Scripts/webkitpy/layout_tests/controllers/layout_test_runner.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698