|
6 | 6 | import argparse |
7 | 7 | import inspect |
8 | 8 | from abc import ABC, abstractmethod |
9 | | -from typing import Dict, Generator, List, Type, TypeVar |
| 9 | +from typing import Dict, Generator, List, Tuple, Type, TypeVar |
10 | 10 |
|
11 | 11 | from libcst import Module |
12 | 12 | from libcst.codemod._codemod import Codemod |
@@ -75,13 +75,13 @@ def transform_module(self, tree: Module) -> Module: |
75 | 75 | # have a static method that other transforms can use which takes |
76 | 76 | # a context and other optional args and modifies its own context key |
77 | 77 | # accordingly. We import them here so that we don't have circular imports. |
78 | | - supported_transforms: Dict[str, Type[Codemod]] = { |
79 | | - AddImportsVisitor.CONTEXT_KEY: AddImportsVisitor, |
80 | | - RemoveImportsVisitor.CONTEXT_KEY: RemoveImportsVisitor, |
81 | | - } |
| 78 | + supported_transforms: List[Tuple[str, Type[Codemod]]] = [ |
| 79 | + (AddImportsVisitor.CONTEXT_KEY, AddImportsVisitor), |
| 80 | + (RemoveImportsVisitor.CONTEXT_KEY, RemoveImportsVisitor), |
| 81 | + ] |
82 | 82 |
|
83 | 83 | # For any visitors that we support auto-running, run them here if needed. |
84 | | - for key, transform in supported_transforms.items(): |
| 84 | + for key, transform in supported_transforms: |
85 | 85 | if key in self.context.scratch: |
86 | 86 | # We have work to do, so lets run this. |
87 | 87 | tree = self._instantiate_and_run(transform, tree) |
|
0 commit comments