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

Unified Diff: tools/telemetry/catapult_base/refactor/__init__.py

Issue 1620023002: Revert of Remove catapult_base from telemetry. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@perf_cb_move
Patch Set: Created 4 years, 11 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 side-by-side diff with in-line comments
Download patch
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)

Powered by Google App Engine
This is Rietveld 408576698