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

Side by Side Diff: third_party/WebKit/Tools/Scripts/webkitpy/layout_tests/views/metered_stream.py

Issue 2014063002: Run format-webkit on webkitpy code (without string conversion). (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebased Created 4 years, 6 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) 2010, 2012 Google Inc. All rights reserved. 1 # Copyright (C) 2010, 2012 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 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
54 def __init__(self, stream=None, verbose=False, logger=None, time_fn=None, pi d=None, number_of_columns=None): 54 def __init__(self, stream=None, verbose=False, logger=None, time_fn=None, pi d=None, number_of_columns=None):
55 self._stream = stream or sys.stderr 55 self._stream = stream or sys.stderr
56 self._verbose = verbose 56 self._verbose = verbose
57 self._time_fn = time_fn or time.time 57 self._time_fn = time_fn or time.time
58 self._pid = pid or os.getpid() 58 self._pid = pid or os.getpid()
59 self._isatty = self._stream.isatty() 59 self._isatty = self._stream.isatty()
60 self._erasing = self._isatty and not verbose 60 self._erasing = self._isatty and not verbose
61 self._last_partial_line = '' 61 self._last_partial_line = ''
62 self._last_write_time = 0.0 62 self._last_write_time = 0.0
63 self._throttle_delay_in_secs = 0.066 if self._erasing else 10.0 63 self._throttle_delay_in_secs = 0.066 if self._erasing else 10.0
64 self._number_of_columns = sys.maxint 64 self._number_of_columns = sys.maxsize
65 if self._isatty and number_of_columns: 65 if self._isatty and number_of_columns:
66 self._number_of_columns = number_of_columns 66 self._number_of_columns = number_of_columns
67 67
68 self._logger = logger 68 self._logger = logger
69 self._log_handler = None 69 self._log_handler = None
70 if self._logger: 70 if self._logger:
71 log_level = logging.DEBUG if verbose else logging.INFO 71 log_level = logging.DEBUG if verbose else logging.INFO
72 self._log_handler = _LogHandler(self) 72 self._log_handler = _LogHandler(self)
73 self._log_handler.setLevel(log_level) 73 self._log_handler.setLevel(log_level)
74 self._logger.addHandler(self._log_handler) 74 self._logger.addHandler(self._log_handler)
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
131 131
132 class _LogHandler(logging.Handler): 132 class _LogHandler(logging.Handler):
133 133
134 def __init__(self, meter): 134 def __init__(self, meter):
135 logging.Handler.__init__(self) 135 logging.Handler.__init__(self)
136 self._meter = meter 136 self._meter = meter
137 self.name = LOG_HANDLER_NAME 137 self.name = LOG_HANDLER_NAME
138 138
139 def emit(self, record): 139 def emit(self, record):
140 self._meter.writeln(record.getMessage(), record.created, record.process) 140 self._meter.writeln(record.getMessage(), record.created, record.process)
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698