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

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

Issue 2130093003: Fix pylint warnings in webkitpy/common/. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebased 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 unified diff | Download patch
OLDNEW
1 # Copyright (C) 2011 Google Inc. All rights reserved. 1 # Copyright (C) 2011 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 19 matching lines...) Expand all
30 and test-webkitpy. This module follows the design for multiprocessing.Pool 30 and test-webkitpy. This module follows the design for multiprocessing.Pool
31 and concurrency.futures.ProcessPoolExecutor, with the following differences: 31 and concurrency.futures.ProcessPoolExecutor, with the following differences:
32 32
33 * Tasks are executed in stateful subprocesses via objects that implement the 33 * Tasks are executed in stateful subprocesses via objects that implement the
34 Worker interface - this allows the workers to share state across tasks. 34 Worker interface - this allows the workers to share state across tasks.
35 * The pool provides an asynchronous event-handling interface so the caller 35 * The pool provides an asynchronous event-handling interface so the caller
36 may receive events as tasks are processed. 36 may receive events as tasks are processed.
37 37
38 If you don't need these features, use multiprocessing.Pool or concurrency.future s 38 If you don't need these features, use multiprocessing.Pool or concurrency.future s
39 instead. 39 instead.
40
41 """ 40 """
42 41
43 import cPickle 42 import cPickle
44 import logging 43 import logging
45 import multiprocessing 44 import multiprocessing
46 import Queue 45 import Queue
47 import sys 46 import sys
48 import traceback 47 import traceback
49 48
50 49
(...skipping 253 matching lines...) Expand 10 before | Expand all | Expand 10 after
304 stack_utils.log_traceback(_log.error, exception_traceback) 303 stack_utils.log_traceback(_log.error, exception_traceback)
305 # Since tracebacks aren't picklable, send the extracted stack instead. 304 # Since tracebacks aren't picklable, send the extracted stack instead.
306 stack = traceback.extract_tb(exception_traceback) 305 stack = traceback.extract_tb(exception_traceback)
307 self._post(name='worker_exception', args=(exception_type, exception_valu e, stack), from_user=False) 306 self._post(name='worker_exception', args=(exception_type, exception_valu e, stack), from_user=False)
308 307
309 def _set_up_logging(self): 308 def _set_up_logging(self):
310 self._logger = logging.getLogger() 309 self._logger = logging.getLogger()
311 310
312 # The unix multiprocessing implementation clones any log handlers into t he child process, 311 # The unix multiprocessing implementation clones any log handlers into t he child process,
313 # so we remove them to avoid duplicate logging. 312 # so we remove them to avoid duplicate logging.
314 for h in self._logger.handlers: 313 for handler in self._logger.handlers:
315 self._logger.removeHandler(h) 314 self._logger.removeHandler(handler)
316 315
317 self._log_handler = _WorkerLogHandler(self) 316 self._log_handler = _WorkerLogHandler(self)
318 self._logger.addHandler(self._log_handler) 317 self._logger.addHandler(self._log_handler)
319 self._logger.setLevel(self.log_level) 318 self._logger.setLevel(self.log_level)
320 319
321 320
322 class _WorkerLogHandler(logging.Handler): 321 class _WorkerLogHandler(logging.Handler):
323 322
324 def __init__(self, worker): 323 def __init__(self, worker):
325 logging.Handler.__init__(self) 324 logging.Handler.__init__(self)
326 self._worker = worker 325 self._worker = worker
327 self.setLevel(worker.log_level) 326 self.setLevel(worker.log_level)
328 327
329 def emit(self, record): 328 def emit(self, record):
330 self._worker.log_messages.append(record) 329 self._worker.log_messages.append(record)
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698