mirror of
https://github.com/python/cpython.git
synced 2025-10-06 23:21:06 +00:00
modernize some modules' code by using with statement around open()
This commit is contained in:
parent
fd6e6cfa29
commit
2f50aaf2ff
14 changed files with 50 additions and 89 deletions
|
@ -3843,18 +3843,18 @@ def write_docstringdict(filename="turtle_docstringdict"):
|
|||
key = "Turtle."+methodname
|
||||
docsdict[key] = eval(key).__doc__
|
||||
|
||||
f = open("%s.py" % filename,"w")
|
||||
keys = sorted([x for x in docsdict.keys()
|
||||
if x.split('.')[1] not in _alias_list])
|
||||
f.write('docsdict = {\n\n')
|
||||
for key in keys[:-1]:
|
||||
with open("%s.py" % filename,"w") as f:
|
||||
keys = sorted([x for x in docsdict.keys()
|
||||
if x.split('.')[1] not in _alias_list])
|
||||
f.write('docsdict = {\n\n')
|
||||
for key in keys[:-1]:
|
||||
f.write('%s :\n' % repr(key))
|
||||
f.write(' """%s\n""",\n\n' % docsdict[key])
|
||||
key = keys[-1]
|
||||
f.write('%s :\n' % repr(key))
|
||||
f.write(' """%s\n""",\n\n' % docsdict[key])
|
||||
key = keys[-1]
|
||||
f.write('%s :\n' % repr(key))
|
||||
f.write(' """%s\n"""\n\n' % docsdict[key])
|
||||
f.write("}\n")
|
||||
f.close()
|
||||
f.write(' """%s\n"""\n\n' % docsdict[key])
|
||||
f.write("}\n")
|
||||
f.close()
|
||||
|
||||
def read_docstrings(lang):
|
||||
"""Read in docstrings from lang-specific docstring dictionary.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue