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

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

Issue 1806393002: Run yapf on files in webkit/layout_tests/. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 9 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 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
92 self._last_partial_line = txt[txt.rfind('\n') + 1:] 92 self._last_partial_line = txt[txt.rfind('\n') + 1:]
93 93
94 def write(self, txt, now=None, pid=None): 94 def write(self, txt, now=None, pid=None):
95 now = now or self._time_fn() 95 now = now or self._time_fn()
96 pid = pid or self._pid 96 pid = pid or self._pid
97 self._last_write_time = now 97 self._last_write_time = now
98 if self._last_partial_line: 98 if self._last_partial_line:
99 self._erase_last_partial_line() 99 self._erase_last_partial_line()
100 if self._verbose: 100 if self._verbose:
101 now_tuple = time.localtime(now) 101 now_tuple = time.localtime(now)
102 msg = '%02d:%02d:%02d.%03d %d %s' % (now_tuple.tm_hour, now_tuple.tm _min, now_tuple.tm_sec, int((now * 1000) % 1000), pid, self._ensure_newline(txt) ) 102 msg = '%02d:%02d:%02d.%03d %d %s' % (now_tuple.tm_hour, now_tuple.tm _min, now_tuple.tm_sec, int(
103 (now * 1000) % 1000), pid, self._ensure_newline(txt))
103 elif self._isatty: 104 elif self._isatty:
104 msg = txt 105 msg = txt
105 else: 106 else:
106 msg = self._ensure_newline(txt) 107 msg = self._ensure_newline(txt)
107 108
108 # This is the easiest way to make sure a byte stream is printable as asc ii 109 # This is the easiest way to make sure a byte stream is printable as asc ii
109 # with all non-ascii characters replaced. 110 # with all non-ascii characters replaced.
110 uni_msg = msg if isinstance(msg, unicode) else msg.decode('ascii', error s='replace') 111 uni_msg = msg if isinstance(msg, unicode) else msg.decode('ascii', error s='replace')
111 self._stream.write(uni_msg.encode('ascii', errors='replace')) 112 self._stream.write(uni_msg.encode('ascii', errors='replace'))
112 113
(...skipping 16 matching lines...) Expand all
129 130
130 131
131 class _LogHandler(logging.Handler): 132 class _LogHandler(logging.Handler):
132 def __init__(self, meter): 133 def __init__(self, meter):
133 logging.Handler.__init__(self) 134 logging.Handler.__init__(self)
134 self._meter = meter 135 self._meter = meter
135 self.name = LOG_HANDLER_NAME 136 self.name = LOG_HANDLER_NAME
136 137
137 def emit(self, record): 138 def emit(self, record):
138 self._meter.writeln(record.getMessage(), record.created, record.process) 139 self._meter.writeln(record.getMessage(), record.created, record.process)
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698