mirror of
https://github.com/python/cpython.git
synced 2025-11-03 03:22:27 +00:00
No reason to use a generator here
This commit is contained in:
parent
097708aef6
commit
33b0fc2304
1 changed files with 8 additions and 9 deletions
|
|
@ -15,16 +15,15 @@ from test.test_support import (unlink, TESTFN, unload, run_unittest, rmtree,
|
||||||
from test import symlink_support
|
from test import symlink_support
|
||||||
from test import script_helper
|
from test import script_helper
|
||||||
|
|
||||||
def _iter_files(name):
|
def _files(name):
|
||||||
for f in (name + os.extsep + "py",
|
return (name + os.extsep + "py",
|
||||||
name + os.extsep + "pyc",
|
name + os.extsep + "pyc",
|
||||||
name + os.extsep + "pyo",
|
name + os.extsep + "pyo",
|
||||||
name + os.extsep + "pyw",
|
name + os.extsep + "pyw",
|
||||||
name + "$py.class"):
|
name + "$py.class")
|
||||||
yield f
|
|
||||||
|
|
||||||
def chmod_files(name):
|
def chmod_files(name):
|
||||||
for f in _iter_files(name):
|
for f in _files(name):
|
||||||
try:
|
try:
|
||||||
os.chmod(f, 0600)
|
os.chmod(f, 0600)
|
||||||
except OSError as exc:
|
except OSError as exc:
|
||||||
|
|
@ -32,7 +31,7 @@ def chmod_files(name):
|
||||||
raise
|
raise
|
||||||
|
|
||||||
def remove_files(name):
|
def remove_files(name):
|
||||||
for f in _iter_files(name):
|
for f in _files(name):
|
||||||
unlink(f)
|
unlink(f)
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue