| Index: tools/telemetry/catapult_base/refactor/__init__.py
|
| diff --git a/tools/telemetry/catapult_base/refactor/__init__.py b/tools/telemetry/catapult_base/refactor/__init__.py
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..406dc6f4775d319e2566d96f364e4a53b407fafc
|
| --- /dev/null
|
| +++ b/tools/telemetry/catapult_base/refactor/__init__.py
|
| @@ -0,0 +1,28 @@
|
| +# Copyright 2015 The Chromium Authors. All rights reserved.
|
| +# Use of this source code is governed by a BSD-style license that can be
|
| +# found in the LICENSE file.
|
| +
|
| +"""Style-preserving Python code transforms.
|
| +
|
| +This module provides components for modifying and querying Python code. They can
|
| +be used to build custom refactorings and linters.
|
| +"""
|
| +
|
| +import functools
|
| +import multiprocessing
|
| +
|
| +# pylint: disable=wildcard-import
|
| +from catapult_base.refactor.annotated_symbol import *
|
| +from catapult_base.refactor.module import Module
|
| +
|
| +
|
| +def _TransformFile(transform, file_path):
|
| + module = Module(file_path)
|
| + result = transform(module)
|
| + module.Write()
|
| + return result
|
| +
|
| +
|
| +def Transform(transform, file_paths):
|
| + transform = functools.partial(_TransformFile, transform)
|
| + return multiprocessing.Pool().map(transform, file_paths)
|
|
|