MCPcopy Index your code
hub / github.com/kivy/python-for-android / printtail

Function printtail

pythonforandroid/logger.py:210–224  ·  view source on GitHub ↗
(out, name, forecolor, tail_n=0,
                          re_filter_in=None, re_filter_out=None)

Source from the content-addressed store, hash-verified

208 stdout.flush()
209 if tail_n is not None or filter_in or filter_out:
210 def printtail(out, name, forecolor, tail_n=0,
211 re_filter_in=None, re_filter_out=None):
212 lines = out.splitlines()
213 if re_filter_in is not None:
214 lines = [line for line in lines if re_filter_in.search(line)]
215 if re_filter_out is not None:
216 lines = [line for line in lines if not re_filter_out.search(line)]
217 if tail_n == 0 or len(lines) <= tail_n:
218 info('{}:\n{}\t{}{}'.format(
219 name, forecolor, '\t\n'.join(lines), Out_Fore.RESET))
220 else:
221 info('{} (last {} lines of {}):\n{}\t{}{}'.format(
222 name, tail_n, len(lines),
223 forecolor, '\t\n'.join([s for s in lines[-tail_n:]]),
224 Out_Fore.RESET))
225 printtail(err.stdout.decode('utf-8'), 'STDOUT', Out_Fore.YELLOW, tail_n,
226 re.compile(filter_in) if filter_in else None,
227 re.compile(filter_out) if filter_out else None)

Callers 1

shprintFunction · 0.85

Calls 1

formatMethod · 0.80

Tested by

no test coverage detected