MCPcopy Index your code
hub / github.com/python/cpython / copy_strip

Function copy_strip

Lib/idlelib/help.py:251–285  ·  view source on GitHub ↗

Copy the text part of idle.html to idlelib/help.html while stripping trailing whitespace. Files with trailing whitespace cannot be pushed to the git cpython repository. For 3.x (on Windows), help.html is generated, after editing idle.rst on the master branch, with sphinx-build -b

()

Source from the content-addressed store, hash-verified

249
250
251def copy_strip(): # pragma: no cover
252 """Copy the text part of idle.html to idlelib/help.html while stripping trailing whitespace.
253
254 Files with trailing whitespace cannot be pushed to the git cpython
255 repository. For 3.x (on Windows), help.html is generated, after
256 editing idle.rst on the master branch, with
257 sphinx-build -bhtml . build/html
258 python_d.exe -c "from idlelib.help import copy_strip; copy_strip()"
259 Check build/html/library/idle.html, the help.html diff, and the text
260 displayed by Help => IDLE Help. Add a blurb and create a PR.
261
262 It can be worthwhile to occasionally generate help.html without
263 touching idle.rst. Changes to the master version and to the doc
264 build system may result in changes that should not change
265 the displayed text, but might break HelpParser.
266
267 As long as master and maintenance versions of idle.rst remain the
268 same, help.html can be backported. The internal Python version
269 number is not displayed. If maintenance idle.rst diverges from
270 the master version, then instead of backporting help.html from
271 master, repeat the procedure above to generate a maintenance
272 version.
273 """
274 src = join(abspath(dirname(dirname(dirname(__file__)))),
275 'Doc', 'build', 'html', 'library', 'idle.html')
276 dst = join(abspath(dirname(__file__)), 'help.html')
277
278 with open(src, 'r', encoding="utf-8") as inn, open(dst, 'w', encoding="utf-8") as out:
279 copy = False
280 for line in inn:
281 if '<section id="idle">' in line: copy = True
282 if '<div class="clearer">' in line: break
283 if copy: out.write(line.strip() + '\n')
284
285 print(f'{src} copied to {dst}')
286
287
288def show_idlehelp(parent):

Callers

nothing calls this directly

Calls 6

joinFunction · 0.90
abspathFunction · 0.90
dirnameFunction · 0.90
openFunction · 0.50
writeMethod · 0.45
stripMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…