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.
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
)
26 def Transform(transform
, file_paths
):
27 transform
= functools
.partial(_TransformFile
, transform
)
28 return multiprocessing
.Pool().map(transform
, file_paths
)