diff options
author | shadchin <shadchin@yandex-team.ru> | 2022-02-10 16:44:39 +0300 |
---|---|---|
committer | Daniil Cherednik <dcherednik@yandex-team.ru> | 2022-02-10 16:44:39 +0300 |
commit | e9656aae26e0358d5378e5b63dcac5c8dbe0e4d0 (patch) | |
tree | 64175d5cadab313b3e7039ebaa06c5bc3295e274 /contrib/tools/python3/src/Lib/lib2to3/refactor.py | |
parent | 2598ef1d0aee359b4b6d5fdd1758916d5907d04f (diff) | |
download | ydb-e9656aae26e0358d5378e5b63dcac5c8dbe0e4d0.tar.gz |
Restoring authorship annotation for <shadchin@yandex-team.ru>. Commit 2 of 2.
Diffstat (limited to 'contrib/tools/python3/src/Lib/lib2to3/refactor.py')
-rw-r--r-- | contrib/tools/python3/src/Lib/lib2to3/refactor.py | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/contrib/tools/python3/src/Lib/lib2to3/refactor.py b/contrib/tools/python3/src/Lib/lib2to3/refactor.py index 07273d2c42..3a5aafffc6 100644 --- a/contrib/tools/python3/src/Lib/lib2to3/refactor.py +++ b/contrib/tools/python3/src/Lib/lib2to3/refactor.py @@ -14,7 +14,7 @@ __author__ = "Guido van Rossum <guido@python.org>" # Python imports import io import os -import pkgutil +import pkgutil import sys import logging import operator @@ -32,11 +32,11 @@ def get_all_fix_names(fixer_pkg, remove_prefix=True): """Return a sorted list of all available fix names in the given package.""" pkg = __import__(fixer_pkg, [], [], ["*"]) fix_names = [] - for finder, name, ispkg in pkgutil.iter_modules(pkg.__path__): - if name.startswith("fix_"): + for finder, name, ispkg in pkgutil.iter_modules(pkg.__path__): + if name.startswith("fix_"): if remove_prefix: name = name[4:] - fix_names.append(name) + fix_names.append(name) return fix_names @@ -155,7 +155,7 @@ class FixerError(Exception): class RefactoringTool(object): _default_options = {"print_function" : False, - "exec_function": False, + "exec_function": False, "write_unchanged_files" : False} CLASS_PREFIX = "Fix" # The prefix for fixer classes @@ -174,13 +174,13 @@ class RefactoringTool(object): self.options = self._default_options.copy() if options is not None: self.options.update(options) - self.grammar = pygram.python_grammar.copy() - - if self.options['print_function']: - del self.grammar.keywords["print"] - elif self.options['exec_function']: - del self.grammar.keywords["exec"] - + self.grammar = pygram.python_grammar.copy() + + if self.options['print_function']: + del self.grammar.keywords["print"] + elif self.options['exec_function']: + del self.grammar.keywords["exec"] + # When this is True, the refactor*() methods will call write_file() for # files processed even if they were not changed during refactoring. If # and only if the refactor method's write parameter was True. |