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

Function restart_line

Lib/idlelib/pyshell.py:394–405  ·  view source on GitHub ↗

Return width long restart line formatted with filename. Fill line with balanced '='s, with any extras and at least one at the beginning. Do not end with a trailing space.

(width, filename)

Source from the content-addressed store, hash-verified

392 raise EOFError
393
394def restart_line(width, filename): # See bpo-38141.
395 """Return width long restart line formatted with filename.
396
397 Fill line with balanced '='s, with any extras and at least one at
398 the beginning. Do not end with a trailing space.
399 """
400 tag = f"= RESTART: {filename or 'Shell'} ="
401 if width >= len(tag):
402 div, mod = divmod((width -len(tag)), 2)
403 return f"{(div+mod)*'='}{tag}{div*'='}"
404 else:
405 return tag[:-2] # Remove ' ='.
406
407
408class ModifiedInterpreter(InteractiveInterpreter):

Callers 1

restart_subprocessMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…