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

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

Issue 2248653002: Revert of Fix pylint warnings in webkitpy/common/. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Manual Revert (Patch Set 1 causes patch failure in read_checksum_from_png_unittest.py) Created 4 years, 4 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 side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Tools/Scripts/webkitpy/common/system/filesystem.py
diff --git a/third_party/WebKit/Tools/Scripts/webkitpy/common/system/filesystem.py b/third_party/WebKit/Tools/Scripts/webkitpy/common/system/filesystem.py
index d0c21d04baadd56eb3bb8a732864311b2e9e7d3b..9e5279b7453097e7f3ef1c92bca34efc0294f7d8 100644
--- a/third_party/WebKit/Tools/Scripts/webkitpy/common/system/filesystem.py
+++ b/third_party/WebKit/Tools/Scripts/webkitpy/common/system/filesystem.py
@@ -78,7 +78,7 @@ class FileSystem(object):
def exists(self, path):
return os.path.exists(path)
- def files_under(self, path, dirs_to_skip=None, file_filter=None):
+ def files_under(self, path, dirs_to_skip=[], file_filter=None):
"""Return the list of all files under the given path in topdown order.
Args:
@@ -89,9 +89,7 @@ class FileSystem(object):
each file found. The file is included in the result if the
callback returns True.
"""
- dirs_to_skip = dirs_to_skip or []
-
- def filter_all(*_):
+ def filter_all(fs, dirpath, basename):
return True
file_filter = file_filter or filter_all
@@ -162,8 +160,9 @@ class FileSystem(object):
def __enter__(self):
return self._directory_path
- def __exit__(self, *_):
+ def __exit__(self, type, value, traceback):
# Only self-delete if necessary.
+
# FIXME: Should we delete non-empty directories?
if os.path.exists(self._directory_path):
os.rmdir(self._directory_path)
@@ -190,20 +189,20 @@ class FileSystem(object):
def open_binary_tempfile(self, suffix):
"""Create, open, and return a binary temp file. Returns a tuple of the file and the name."""
temp_fd, temp_name = tempfile.mkstemp(suffix)
- fh = os.fdopen(temp_fd, 'wb')
- return fh, temp_name
+ f = os.fdopen(temp_fd, 'wb')
+ return f, temp_name
def open_binary_file_for_reading(self, path):
return codecs.open(path, 'rb')
def read_binary_file(self, path):
"""Return the contents of the file at the given path as a byte string."""
- with file(path, 'rb') as fh:
- return fh.read()
+ with file(path, 'rb') as f:
+ return f.read()
def write_binary_file(self, path, contents):
- with file(path, 'wb') as fh:
- fh.write(contents)
+ with file(path, 'wb') as f:
+ f.write(contents)
def open_text_file_for_reading(self, path):
# Note: There appears to be an issue with the returned file objects

Powered by Google App Engine
This is Rietveld 408576698