MCPcopy Index your code
hub / github.com/ipython/ipython / marquee

Function marquee

IPython/utils/text.py:317–339  ·  view source on GitHub ↗

Return the input string centered in a 'marquee'. Examples -------- :: In [16]: marquee('A test',40) Out[16]: '**************** A test ****************' In [17]: marquee('A test',40,'-') Out[17]: '---------------- A test ----------------' In [18

(txt: str = "", width: int = 78, mark: str = "*")

Source from the content-addressed store, hash-verified

315
316
317def marquee(txt: str = "", width: int = 78, mark: str = "*") -> str:
318 """Return the input string centered in a 'marquee'.
319
320 Examples
321 --------
322 ::
323
324 In [16]: marquee('A test',40)
325 Out[16]: '**************** A test ****************'
326
327 In [17]: marquee('A test',40,'-')
328 Out[17]: '---------------- A test ----------------'
329
330 In [18]: marquee('A test',40,' ')
331 Out[18]: ' A test '
332
333 """
334 if not txt:
335 return (mark*width)[:width]
336 nmark = (width-len(txt)-2)//len(mark)//2
337 if nmark < 0: nmark =0
338 marks = mark*nmark
339 return '%s %s %s' % (marks,txt,marks)
340
341
342def format_screen(strng: str) -> str:

Callers 3

show_allMethod · 0.90
__call__Method · 0.90
marqueeMethod · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…