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

Side by Side Diff: fix_encoding.py

Issue 777533005: Update cpplint.py to r141. (Closed) Base URL: https://chromium.googlesource.com/chromium/tools/depot_tools@master
Patch Set: Fixed pylint issue in fix_encoding (slice index is not an int) Created 6 years 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 | « cpplint.py ('k') | gclient_scm.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) 2011 The Chromium Authors. All rights reserved. 1 # Copyright (c) 2011 The Chromium Authors. All rights reserved.
2 # Use of this source code is governed by a BSD-style license that can be 2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file. 3 # found in the LICENSE file.
4 4
5 """Collection of functions and classes to fix various encoding problems on 5 """Collection of functions and classes to fix various encoding problems on
6 multiple platforms with python. 6 multiple platforms with python.
7 """ 7 """
8 8
9 import codecs 9 import codecs
10 import locale 10 import locale
(...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after
222 self._console_handle, text, 222 self._console_handle, text,
223 min(remaining, 10000), 223 min(remaining, 10000),
224 self._byref(n), None) 224 self._byref(n), None)
225 if retval == 0 or n.value == 0: 225 if retval == 0 or n.value == 0:
226 raise IOError( 226 raise IOError(
227 'WriteConsoleW returned %r, n.value = %r, last error = %r' % ( 227 'WriteConsoleW returned %r, n.value = %r, last error = %r' % (
228 retval, n.value, self._GetLastError())) 228 retval, n.value, self._GetLastError()))
229 remaining -= n.value 229 remaining -= n.value
230 if not remaining: 230 if not remaining:
231 break 231 break
232 text = text[n.value:] 232 text = text[int(n.value):]
233 except Exception, e: 233 except Exception, e:
234 complain('%s.write: %r' % (self.name, e)) 234 complain('%s.write: %r' % (self.name, e))
235 raise 235 raise
236 236
237 237
238 class WinUnicodeOutput(WinUnicodeOutputBase): 238 class WinUnicodeOutput(WinUnicodeOutputBase):
239 """Output adaptor to a file output on Windows. 239 """Output adaptor to a file output on Windows.
240 240
241 If the standard FileWrite function is used, it will be encoded in the current 241 If the standard FileWrite function is used, it will be encoded in the current
242 code page. WriteConsoleW() permits writting any character. 242 code page. WriteConsoleW() permits writting any character.
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after
362 if sys.platform == 'win32': 362 if sys.platform == 'win32':
363 ret &= fix_win_codec() 363 ret &= fix_win_codec()
364 364
365 ret &= fix_default_encoding() 365 ret &= fix_default_encoding()
366 366
367 if sys.platform == 'win32': 367 if sys.platform == 'win32':
368 encoding = sys.getdefaultencoding() 368 encoding = sys.getdefaultencoding()
369 ret &= fix_win_sys_argv(encoding) 369 ret &= fix_win_sys_argv(encoding)
370 ret &= fix_win_console(encoding) 370 ret &= fix_win_console(encoding)
371 return ret 371 return ret
OLDNEW
« no previous file with comments | « cpplint.py ('k') | gclient_scm.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698