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

Method __tputs

Lib/_pyrepl/unix_console.py:804–829  ·  view source on GitHub ↗

A Python implementation of the curses tputs function; the curses one can't really be wrapped in a sane manner. I have the strong suspicion that this is complexity that will never do anyone any good.

(self, fmt, prog=delayprog)

Source from the content-addressed store, hash-verified

802 self.screen = ns
803
804 def __tputs(self, fmt, prog=delayprog):
805 """A Python implementation of the curses tputs function; the
806 curses one can't really be wrapped in a sane manner.
807
808 I have the strong suspicion that this is complexity that
809 will never do anyone any good."""
810 # using .get() means that things will blow up
811 # only if the bps is actually needed (which I'm
812 # betting is pretty unlikely)
813 bps = ratedict.get(self.__svtermstate.ospeed)
814 while True:
815 m = prog.search(fmt)
816 if not m:
817 os.write(self.output_fd, fmt)
818 break
819 x, y = m.span()
820 os.write(self.output_fd, fmt[:x])
821 fmt = fmt[y:]
822 delay = int(m.group(1))
823 if b"*" in m.group(2):
824 delay *= self.height
825 if self._pad and bps is not None:
826 nchars = (bps * delay) / 1000
827 os.write(self.output_fd, self._pad * nchars)
828 else:
829 time.sleep(float(delay) / 1000.0)
830
831 def __input_fd_set(
832 self,

Callers 1

flushoutputMethod · 0.95

Calls 5

getMethod · 0.45
searchMethod · 0.45
writeMethod · 0.45
groupMethod · 0.45
sleepMethod · 0.45

Tested by

no test coverage detected