(self, fixer_names, options=None, explicit=None)
Initializer.

        Args:
            fixer_names: a list of fixers to import
            options: an dict with configuration.
            explicit: a list of fixers to run even if they are explicit.
Initializer.
Initializer .
def __init__(self, fixer_names, options=None, explicit=None):
        """Initializer.

        Args:
            fixer_names: a list of fixers to import
            options: an dict with configuration.
            explicit: a list of fixers to run even if they are explicit.
        """
        self.fixers = fixer_names
        self.explicit = explicit or []
        self.options = self._default_options.copy()
        if options is not None:
            self.options.update(options)
        if self.options["print_function"]:
            self.grammar = pygram.python_grammar_no_print_statement
        else:
            self.grammar = pygram.python_grammar
        self.errors = []
        self.logger = logging.getLogger("RefactoringTool")
        self.fixer_log = []
        self.wrote = False
        self.driver = driver.Driver(self.grammar,
                                    convert=pytree.convert,
                                    logger=self.logger)
        self.pre_order, self.post_order = self.get_fixers()


        self.files = []  # List of files that were or should be modified

        self.BM = bm.BottomMatcher()
        self.bmi_pre_order = [] # Bottom Matcher incompatible fixers
        self.bmi_post_order = []

        for fixer in chain(self.post_order, self.pre_order):
            if fixer.BM_compatible:
                self.BM.add_fixer(fixer)
                # remove fixers that will be handled by the bottom-up
                # matcher
            elif fixer in self.pre_order:
                self.bmi_pre_order.append(fixer)
            elif fixer in self.post_order:
                self.bmi_post_order.append(fixer)

        self.bmi_pre_order_heads = _get_headnode_dict(self.bmi_pre_order)
        self.bmi_post_order_heads = _get_headnode_dict(self.bmi_post_order)
def __init__ ( self , fixer_names , options = None , explicit = None ) : self . fixers = fixer_names self . explicit = explicit or [ ] self . options = self . _default_options . copy ( ) if options is not None : self . options . update ( options ) if self . options [ "print_function" ] : self . grammar = pygram . python_grammar_no_print_statement else : self . grammar = pygram . python_grammar self . errors = [ ] self . logger = logging . getLogger ( "RefactoringTool" ) self . fixer_log = [ ] self . wrote = False self . driver = driver . Driver ( self . grammar , convert = pytree . convert , logger = self . logger ) self . pre_order , self . post_order = self . get_fixers ( ) self . files = [ ] # List of files that were or should be modified self . BM = bm . BottomMatcher ( ) self . bmi_pre_order = [ ] # Bottom Matcher incompatible fixers self . bmi_post_order = [ ] for fixer in chain ( self . post_order , self . pre_order ) : if fixer . BM_compatible : self . BM . add_fixer ( fixer ) # remove fixers that will be handled by the bottom-up # matcher elif fixer in self . pre_order : self . bmi_pre_order . append ( fixer ) elif fixer in self . post_order : self . bmi_post_order . append ( fixer ) self . bmi_pre_order_heads = _get_headnode_dict ( self . bmi_pre_order ) self . bmi_post_order_heads = _get_headnode_dict ( self . bmi_post_order )