Add long running gmail memory benchmark for background tab.
[chromium-blink-merge.git] / tools / telemetry / catapult_base / refactor / __init__.py
blob406dc6f4775d319e2566d96f364e4a53b407fafc
1 # Copyright 2015 The Chromium Authors. All rights reserved.
2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file.
5 """Style-preserving Python code transforms.
7 This module provides components for modifying and querying Python code. They can
8 be used to build custom refactorings and linters.
9 """
11 import functools
12 import multiprocessing
14 # pylint: disable=wildcard-import
15 from catapult_base.refactor.annotated_symbol import *
16 from catapult_base.refactor.module import Module
19 def _TransformFile(transform, file_path):
20 module = Module(file_path)
21 result = transform(module)
22 module.Write()
23 return result
26 def Transform(transform, file_paths):
27 transform = functools.partial(_TransformFile, transform)
28 return multiprocessing.Pool().map(transform, file_paths)