Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cpython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cpython
Commits
93e8aa62
Commit
93e8aa62
authored
Jul 24, 2019
by
Benjamin Peterson
Committed by
GitHub
Jul 24, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
closes bpo-37675: Use pkgutil.iter_modules to find fixers in a package rather than listdir. (14942)
parent
123536fd
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
5 additions
and
4 deletions
+5
-4
Lib/lib2to3/refactor.py
Lib/lib2to3/refactor.py
+4
-4
Misc/NEWS.d/next/Tools-Demos/2019-07-24-16-20-54.bpo-37675.951Cvf.rst
...next/Tools-Demos/2019-07-24-16-20-54.bpo-37675.951Cvf.rst
+1
-0
No files found.
Lib/lib2to3/refactor.py
View file @
93e8aa62
...
...
@@ -14,6 +14,7 @@ __author__ = "Guido van Rossum <guido@python.org>"
# Python imports
import
io
import
os
import
pkgutil
import
sys
import
logging
import
operator
...
...
@@ -30,13 +31,12 @@ from . import btm_matcher as bm
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
,
[],
[],
[
"*"
])
fixer_dir
=
os
.
path
.
dirname
(
pkg
.
__file__
)
fix_names
=
[]
for
name
in
sorted
(
os
.
listdir
(
fixer_dir
)
):
if
name
.
startswith
(
"fix_"
)
and
name
.
endswith
(
".py"
)
:
for
finder
,
name
,
ispkg
in
pkgutil
.
iter_modules
(
pkg
.
__path__
):
if
name
.
startswith
(
"fix_"
):
if
remove_prefix
:
name
=
name
[
4
:]
fix_names
.
append
(
name
[:
-
3
]
)
fix_names
.
append
(
name
)
return
fix_names
...
...
Misc/NEWS.d/next/Tools-Demos/2019-07-24-16-20-54.bpo-37675.951Cvf.rst
0 → 100644
View file @
93e8aa62
2to3 now works when run from a zipped standard library.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment