Hide keyboard shortcuts

Hot-keys on this page

r m x p   toggle line displays

j k   next/prev highlighted chunk

0   (zero) top of page

1   (one) first highlighted chunk

1import json lppytest

2import os lppytest

3import sys lppytest

4import time lppytest

5 

6from pygments import highlight lppytest

7from pygments.lexers import JsonLexer lppytest

8 

9from lcdoc.const import LogStats, PageStats, Stats, now_ms, t0 lppytest

10 

11now = time.time lppytest

12 

13B = lambda s: '\x1b[1m%s\x1b[0m' % s lplp|about/coverage.mdlp|about/credits.mdlp|features/lp/bash/index.mdlp|features/lp/bash/sessions.mdlp|features/lp/bash/sessions.mdlp|features/lp/eval.mdlp|features/lp/examples.mdlp|features/lp/examples.mdlp|features/lp/examples.mdlp|features/lp/parameters.mdlp|features/lp/parameters.mdlp|features/lp/parameters.mdlp|features/lp/parameters.mdlp|features/lp/parameters.mdlp|features/lp/parameters.mdlp|features/lp/parameters.mdlp|features/lp/parameters.mdlp|features/lp/parameters.mdlp|features/lp/plugs/_tech.mdlp|features/lp/plugs/chart/index.mdlp|features/lp/plugs/chartist/index.mdlp|features/lp/plugs/column/index.mdlp|features/lp/plugs/drawio/index.mdlp|features/lp/plugs/flowchart/index.mdlp|features/lp/plugs/kroki/index.mdlp|features/lp/plugs/kroki/index.mdlp|features/lp/plugs/kroki/index.mdlp|features/lp/plugs/lightbox/index.mdlp|features/lp/plugs/make_badges/index.mdlp|features/lp/plugs/make_file/index.mdlp|features/lp/plugs/markmap/index.mdlp|features/lp/plugs/mermaid/index.mdlp|features/lp/plugs/show_file/index.mdlp|features/lp/plugs/show_src/index.mdlp|features/lp/python/_tech.mdlp|features/lp/sessions.mdlp|features/lp/sessions.mdlp|features/lp/sessions.mdlp|features/lp/syntax.mdlp|features/lp/syntax.mdlp|features/lp/syntax.mdlp|features/lp/tips.mdlp|features/lp/xterm.mdlp|index.mdlp|index.mdpytest

14V = lambda s: '\x1b[2m%s\x1b[0m' % s 14 ↛ exitline 14 didn't run the lambda on line 14lppytest

15L = lambda s: '\x1b[2;38;5;245m%s\x1b[0m' % s lplp|about/coverage.mdlp|about/credits.mdlp|features/lp/bash/index.mdlp|features/lp/bash/sessions.mdlp|features/lp/bash/sessions.mdlp|features/lp/eval.mdlp|features/lp/examples.mdlp|features/lp/examples.mdlp|features/lp/examples.mdlp|features/lp/parameters.mdlp|features/lp/parameters.mdlp|features/lp/parameters.mdlp|features/lp/parameters.mdlp|features/lp/parameters.mdlp|features/lp/parameters.mdlp|features/lp/parameters.mdlp|features/lp/parameters.mdlp|features/lp/parameters.mdlp|features/lp/plugs/_tech.mdlp|features/lp/plugs/chart/index.mdlp|features/lp/plugs/chartist/index.mdlp|features/lp/plugs/column/index.mdlp|features/lp/plugs/drawio/index.mdlp|features/lp/plugs/flowchart/index.mdlp|features/lp/plugs/kroki/index.mdlp|features/lp/plugs/kroki/index.mdlp|features/lp/plugs/kroki/index.mdlp|features/lp/plugs/lightbox/index.mdlp|features/lp/plugs/make_badges/index.mdlp|features/lp/plugs/make_file/index.mdlp|features/lp/plugs/markmap/index.mdlp|features/lp/plugs/mermaid/index.mdlp|features/lp/plugs/show_file/index.mdlp|features/lp/plugs/show_src/index.mdlp|features/lp/python/_tech.mdlp|features/lp/sessions.mdlp|features/lp/sessions.mdlp|features/lp/sessions.mdlp|features/lp/syntax.mdlp|features/lp/syntax.mdlp|features/lp/syntax.mdlp|features/lp/tips.mdlp|features/lp/xterm.mdlp|index.mdlp|index.mdpytest

16M = K = B lppytest

17 

18 

19try: lppytest

20 from pygments.formatters import Terminal256Formatter lppytest

21except: 

22 from pygments.formatters.terminal import TerminalFormatter 

23 

24 Terminal256Formatter = TerminalFormatter 

25 

26 

27# ready to make partials for changing the defaults: 

28def coljhighlight( 

29 s, 

30 style=None, 

31 indent=4, 

32 sort_keys=True, 

33 add_line_seps=True, 

34 # logger might be set to colors off, e.g. at no tty dest: 

35 colorize=True, 

36 # automatic indent only for long stuff? 

37 no_indent_len=0, 

38 jsl=[0], 

39): 

40 if not jsl[0]: lplp|about/coverage.mdlp|about/credits.mdlp|features/lp/bash/index.mdlp|features/lp/bash/sessions.mdlp|features/lp/eval.mdlp|features/lp/examples.mdlp|features/lp/parameters.mdlp|features/lp/plugs/_tech.mdlp|features/lp/plugs/chart/index.mdlp|features/lp/plugs/chartist/index.mdlp|features/lp/plugs/column/index.mdlp|features/lp/plugs/drawio/index.mdlp|features/lp/plugs/flowchart/index.mdlp|features/lp/plugs/kroki/index.mdlp|features/lp/plugs/lightbox/index.mdlp|features/lp/plugs/make_badges/index.mdlp|features/lp/plugs/make_file/index.mdlp|features/lp/plugs/markmap/index.mdlp|features/lp/plugs/mermaid/index.mdlp|features/lp/plugs/show_file/index.mdlp|features/lp/plugs/show_src/index.mdlp|features/lp/python/_tech.mdlp|features/lp/sessions.mdlp|features/lp/syntax.mdlp|features/lp/tips.mdlp|features/lp/xterm.mdlp|index.md

41 jsl[0] = JsonLexer() lp

42 if not isinstance(s, str): 42 ↛ 65line 42 didn't jump to line 65, because the condition on line 42 was never falselplp|about/coverage.mdlp|about/credits.mdlp|features/lp/bash/index.mdlp|features/lp/bash/sessions.mdlp|features/lp/eval.mdlp|features/lp/examples.mdlp|features/lp/parameters.mdlp|features/lp/plugs/_tech.mdlp|features/lp/plugs/chart/index.mdlp|features/lp/plugs/chartist/index.mdlp|features/lp/plugs/column/index.mdlp|features/lp/plugs/drawio/index.mdlp|features/lp/plugs/flowchart/index.mdlp|features/lp/plugs/kroki/index.mdlp|features/lp/plugs/lightbox/index.mdlp|features/lp/plugs/make_badges/index.mdlp|features/lp/plugs/make_file/index.mdlp|features/lp/plugs/markmap/index.mdlp|features/lp/plugs/mermaid/index.mdlp|features/lp/plugs/show_file/index.mdlp|features/lp/plugs/show_src/index.mdlp|features/lp/python/_tech.mdlp|features/lp/sessions.mdlp|features/lp/syntax.mdlp|features/lp/tips.mdlp|features/lp/xterm.mdlp|index.md

43 if indent and no_indent_len: 43 ↛ 44line 43 didn't jump to line 44, because the condition on line 43 was never truelplp|about/coverage.mdlp|about/credits.mdlp|features/lp/bash/index.mdlp|features/lp/bash/sessions.mdlp|features/lp/eval.mdlp|features/lp/examples.mdlp|features/lp/parameters.mdlp|features/lp/plugs/_tech.mdlp|features/lp/plugs/chart/index.mdlp|features/lp/plugs/chartist/index.mdlp|features/lp/plugs/column/index.mdlp|features/lp/plugs/drawio/index.mdlp|features/lp/plugs/flowchart/index.mdlp|features/lp/plugs/kroki/index.mdlp|features/lp/plugs/lightbox/index.mdlp|features/lp/plugs/make_badges/index.mdlp|features/lp/plugs/make_file/index.mdlp|features/lp/plugs/markmap/index.mdlp|features/lp/plugs/mermaid/index.mdlp|features/lp/plugs/show_file/index.mdlp|features/lp/plugs/show_src/index.mdlp|features/lp/python/_tech.mdlp|features/lp/sessions.mdlp|features/lp/syntax.mdlp|features/lp/tips.mdlp|features/lp/xterm.mdlp|index.md

44 if len(str(s)) < no_indent_len: 

45 indent = None 

46 try: lplp|about/coverage.mdlp|about/credits.mdlp|features/lp/bash/index.mdlp|features/lp/bash/sessions.mdlp|features/lp/eval.mdlp|features/lp/examples.mdlp|features/lp/parameters.mdlp|features/lp/plugs/_tech.mdlp|features/lp/plugs/chart/index.mdlp|features/lp/plugs/chartist/index.mdlp|features/lp/plugs/column/index.mdlp|features/lp/plugs/drawio/index.mdlp|features/lp/plugs/flowchart/index.mdlp|features/lp/plugs/kroki/index.mdlp|features/lp/plugs/lightbox/index.mdlp|features/lp/plugs/make_badges/index.mdlp|features/lp/plugs/make_file/index.mdlp|features/lp/plugs/markmap/index.mdlp|features/lp/plugs/mermaid/index.mdlp|features/lp/plugs/show_file/index.mdlp|features/lp/plugs/show_src/index.mdlp|features/lp/python/_tech.mdlp|features/lp/sessions.mdlp|features/lp/syntax.mdlp|features/lp/tips.mdlp|features/lp/xterm.mdlp|index.md

47 s = json.dumps(s, indent=indent, sort_keys=sort_keys, default=str) lplp|about/coverage.mdlp|about/credits.mdlp|features/lp/bash/index.mdlp|features/lp/bash/sessions.mdlp|features/lp/eval.mdlp|features/lp/examples.mdlp|features/lp/parameters.mdlp|features/lp/plugs/_tech.mdlp|features/lp/plugs/chart/index.mdlp|features/lp/plugs/chartist/index.mdlp|features/lp/plugs/column/index.mdlp|features/lp/plugs/drawio/index.mdlp|features/lp/plugs/flowchart/index.mdlp|features/lp/plugs/kroki/index.mdlp|features/lp/plugs/lightbox/index.mdlp|features/lp/plugs/make_badges/index.mdlp|features/lp/plugs/make_file/index.mdlp|features/lp/plugs/markmap/index.mdlp|features/lp/plugs/mermaid/index.mdlp|features/lp/plugs/show_file/index.mdlp|features/lp/plugs/show_src/index.mdlp|features/lp/python/_tech.mdlp|features/lp/sessions.mdlp|features/lp/syntax.mdlp|features/lp/tips.mdlp|features/lp/xterm.mdlp|index.md

48 except Exception: 

49 try: 

50 # the sort may fail: TypeError: '<' not supported between instances of 'int' and 'str' 

51 s = json.dumps(s, indent=indent, default=str) 

52 except Exception: 

53 from lcdoc.tools import flatten 

54 

55 return coljhighlight( 

56 flatten(s, sep='.', tpljoin='_'), 

57 style=style, 

58 indent=indent, 

59 sort_keys=sort_keys, 

60 add_line_seps=add_line_seps, 

61 colorize=colorize, 

62 no_indent_len=no_indent_len, 

63 ) 

64 

65 if colorize: 65 ↛ 71line 65 didn't jump to line 71, because the condition on line 65 was never falselplp|about/coverage.mdlp|about/credits.mdlp|features/lp/bash/index.mdlp|features/lp/bash/sessions.mdlp|features/lp/eval.mdlp|features/lp/examples.mdlp|features/lp/parameters.mdlp|features/lp/plugs/_tech.mdlp|features/lp/plugs/chart/index.mdlp|features/lp/plugs/chartist/index.mdlp|features/lp/plugs/column/index.mdlp|features/lp/plugs/drawio/index.mdlp|features/lp/plugs/flowchart/index.mdlp|features/lp/plugs/kroki/index.mdlp|features/lp/plugs/lightbox/index.mdlp|features/lp/plugs/make_badges/index.mdlp|features/lp/plugs/make_file/index.mdlp|features/lp/plugs/markmap/index.mdlp|features/lp/plugs/mermaid/index.mdlp|features/lp/plugs/show_file/index.mdlp|features/lp/plugs/show_src/index.mdlp|features/lp/python/_tech.mdlp|features/lp/sessions.mdlp|features/lp/syntax.mdlp|features/lp/tips.mdlp|features/lp/xterm.mdlp|index.md

66 # we may be called by structlog, then with style (from 

67 # FLG.log_dev_coljson_style) 

68 # or direct 

69 res = highlight(s, jsl[0], Terminal256Formatter()) lplp|about/coverage.mdlp|about/credits.mdlp|features/lp/bash/index.mdlp|features/lp/bash/sessions.mdlp|features/lp/eval.mdlp|features/lp/examples.mdlp|features/lp/parameters.mdlp|features/lp/plugs/_tech.mdlp|features/lp/plugs/chart/index.mdlp|features/lp/plugs/chartist/index.mdlp|features/lp/plugs/column/index.mdlp|features/lp/plugs/drawio/index.mdlp|features/lp/plugs/flowchart/index.mdlp|features/lp/plugs/kroki/index.mdlp|features/lp/plugs/lightbox/index.mdlp|features/lp/plugs/make_badges/index.mdlp|features/lp/plugs/make_file/index.mdlp|features/lp/plugs/markmap/index.mdlp|features/lp/plugs/mermaid/index.mdlp|features/lp/plugs/show_file/index.mdlp|features/lp/plugs/show_src/index.mdlp|features/lp/python/_tech.mdlp|features/lp/sessions.mdlp|features/lp/syntax.mdlp|features/lp/tips.mdlp|features/lp/xterm.mdlp|index.md

70 else: 

71 res = s 

72 

73 if add_line_seps: 73 ↛ 76line 73 didn't jump to line 76, because the condition on line 73 was never falselplp|about/coverage.mdlp|about/credits.mdlp|features/lp/bash/index.mdlp|features/lp/bash/sessions.mdlp|features/lp/eval.mdlp|features/lp/examples.mdlp|features/lp/parameters.mdlp|features/lp/plugs/_tech.mdlp|features/lp/plugs/chart/index.mdlp|features/lp/plugs/chartist/index.mdlp|features/lp/plugs/column/index.mdlp|features/lp/plugs/drawio/index.mdlp|features/lp/plugs/flowchart/index.mdlp|features/lp/plugs/kroki/index.mdlp|features/lp/plugs/lightbox/index.mdlp|features/lp/plugs/make_badges/index.mdlp|features/lp/plugs/make_file/index.mdlp|features/lp/plugs/markmap/index.mdlp|features/lp/plugs/mermaid/index.mdlp|features/lp/plugs/show_file/index.mdlp|features/lp/plugs/show_src/index.mdlp|features/lp/python/_tech.mdlp|features/lp/sessions.mdlp|features/lp/syntax.mdlp|features/lp/tips.mdlp|features/lp/xterm.mdlp|index.md

74 res = res.replace('\\n', '\n') lplp|about/coverage.mdlp|about/credits.mdlp|features/lp/bash/index.mdlp|features/lp/bash/sessions.mdlp|features/lp/eval.mdlp|features/lp/examples.mdlp|features/lp/parameters.mdlp|features/lp/plugs/_tech.mdlp|features/lp/plugs/chart/index.mdlp|features/lp/plugs/chartist/index.mdlp|features/lp/plugs/column/index.mdlp|features/lp/plugs/drawio/index.mdlp|features/lp/plugs/flowchart/index.mdlp|features/lp/plugs/kroki/index.mdlp|features/lp/plugs/lightbox/index.mdlp|features/lp/plugs/make_badges/index.mdlp|features/lp/plugs/make_file/index.mdlp|features/lp/plugs/markmap/index.mdlp|features/lp/plugs/mermaid/index.mdlp|features/lp/plugs/show_file/index.mdlp|features/lp/plugs/show_src/index.mdlp|features/lp/python/_tech.mdlp|features/lp/sessions.mdlp|features/lp/syntax.mdlp|features/lp/tips.mdlp|features/lp/xterm.mdlp|index.md

75 

76 return res lplp|about/coverage.mdlp|about/credits.mdlp|features/lp/bash/index.mdlp|features/lp/bash/sessions.mdlp|features/lp/eval.mdlp|features/lp/examples.mdlp|features/lp/parameters.mdlp|features/lp/plugs/_tech.mdlp|features/lp/plugs/chart/index.mdlp|features/lp/plugs/chartist/index.mdlp|features/lp/plugs/column/index.mdlp|features/lp/plugs/drawio/index.mdlp|features/lp/plugs/flowchart/index.mdlp|features/lp/plugs/kroki/index.mdlp|features/lp/plugs/lightbox/index.mdlp|features/lp/plugs/make_badges/index.mdlp|features/lp/plugs/make_file/index.mdlp|features/lp/plugs/markmap/index.mdlp|features/lp/plugs/mermaid/index.mdlp|features/lp/plugs/show_file/index.mdlp|features/lp/plugs/show_src/index.mdlp|features/lp/python/_tech.mdlp|features/lp/sessions.mdlp|features/lp/syntax.mdlp|features/lp/tips.mdlp|features/lp/xterm.mdlp|index.md

77 

78 

79def tokw(kw): lppytest

80 n = app.name lplp|about/coverage.mdlp|about/credits.mdlp|features/lp/bash/index.mdlp|features/lp/bash/sessions.mdlp|features/lp/bash/sessions.mdlp|features/lp/eval.mdlp|features/lp/examples.mdlp|features/lp/examples.mdlp|features/lp/examples.mdlp|features/lp/parameters.mdlp|features/lp/parameters.mdlp|features/lp/parameters.mdlp|features/lp/parameters.mdlp|features/lp/parameters.mdlp|features/lp/parameters.mdlp|features/lp/parameters.mdlp|features/lp/parameters.mdlp|features/lp/parameters.mdlp|features/lp/plugs/_tech.mdlp|features/lp/plugs/chart/index.mdlp|features/lp/plugs/chartist/index.mdlp|features/lp/plugs/column/index.mdlp|features/lp/plugs/drawio/index.mdlp|features/lp/plugs/flowchart/index.mdlp|features/lp/plugs/kroki/index.mdlp|features/lp/plugs/kroki/index.mdlp|features/lp/plugs/kroki/index.mdlp|features/lp/plugs/lightbox/index.mdlp|features/lp/plugs/make_badges/index.mdlp|features/lp/plugs/make_file/index.mdlp|features/lp/plugs/markmap/index.mdlp|features/lp/plugs/mermaid/index.mdlp|features/lp/plugs/show_file/index.mdlp|features/lp/plugs/show_src/index.mdlp|features/lp/python/_tech.mdlp|features/lp/sessions.mdlp|features/lp/sessions.mdlp|features/lp/sessions.mdlp|features/lp/syntax.mdlp|features/lp/syntax.mdlp|features/lp/syntax.mdlp|features/lp/tips.mdlp|features/lp/xterm.mdlp|index.mdlp|index.mdpytest

81 n = (L(' [%s] ' % n)) if n else '' lplp|about/coverage.mdlp|about/credits.mdlp|features/lp/bash/index.mdlp|features/lp/bash/sessions.mdlp|features/lp/bash/sessions.mdlp|features/lp/eval.mdlp|features/lp/examples.mdlp|features/lp/examples.mdlp|features/lp/examples.mdlp|features/lp/parameters.mdlp|features/lp/parameters.mdlp|features/lp/parameters.mdlp|features/lp/parameters.mdlp|features/lp/parameters.mdlp|features/lp/parameters.mdlp|features/lp/parameters.mdlp|features/lp/parameters.mdlp|features/lp/parameters.mdlp|features/lp/plugs/_tech.mdlp|features/lp/plugs/chart/index.mdlp|features/lp/plugs/chartist/index.mdlp|features/lp/plugs/column/index.mdlp|features/lp/plugs/drawio/index.mdlp|features/lp/plugs/flowchart/index.mdlp|features/lp/plugs/kroki/index.mdlp|features/lp/plugs/kroki/index.mdlp|features/lp/plugs/kroki/index.mdlp|features/lp/plugs/lightbox/index.mdlp|features/lp/plugs/make_badges/index.mdlp|features/lp/plugs/make_file/index.mdlp|features/lp/plugs/markmap/index.mdlp|features/lp/plugs/mermaid/index.mdlp|features/lp/plugs/show_file/index.mdlp|features/lp/plugs/show_src/index.mdlp|features/lp/python/_tech.mdlp|features/lp/sessions.mdlp|features/lp/sessions.mdlp|features/lp/sessions.mdlp|features/lp/syntax.mdlp|features/lp/syntax.mdlp|features/lp/syntax.mdlp|features/lp/tips.mdlp|features/lp/xterm.mdlp|index.mdlp|index.mdpytest

82 j = kw.pop('json', 0) lplp|about/coverage.mdlp|about/credits.mdlp|features/lp/bash/index.mdlp|features/lp/bash/sessions.mdlp|features/lp/bash/sessions.mdlp|features/lp/eval.mdlp|features/lp/examples.mdlp|features/lp/examples.mdlp|features/lp/examples.mdlp|features/lp/parameters.mdlp|features/lp/parameters.mdlp|features/lp/parameters.mdlp|features/lp/parameters.mdlp|features/lp/parameters.mdlp|features/lp/parameters.mdlp|features/lp/parameters.mdlp|features/lp/parameters.mdlp|features/lp/parameters.mdlp|features/lp/plugs/_tech.mdlp|features/lp/plugs/chart/index.mdlp|features/lp/plugs/chartist/index.mdlp|features/lp/plugs/column/index.mdlp|features/lp/plugs/drawio/index.mdlp|features/lp/plugs/flowchart/index.mdlp|features/lp/plugs/kroki/index.mdlp|features/lp/plugs/kroki/index.mdlp|features/lp/plugs/kroki/index.mdlp|features/lp/plugs/lightbox/index.mdlp|features/lp/plugs/make_badges/index.mdlp|features/lp/plugs/make_file/index.mdlp|features/lp/plugs/markmap/index.mdlp|features/lp/plugs/mermaid/index.mdlp|features/lp/plugs/show_file/index.mdlp|features/lp/plugs/show_src/index.mdlp|features/lp/python/_tech.mdlp|features/lp/sessions.mdlp|features/lp/sessions.mdlp|features/lp/sessions.mdlp|features/lp/syntax.mdlp|features/lp/syntax.mdlp|features/lp/syntax.mdlp|features/lp/tips.mdlp|features/lp/xterm.mdlp|index.mdlp|index.mdpytest

83 m = ' '.join(['%s:%s' % (L(str(k)), B(str(v))) for k, v in kw.items()]) lplp|about/coverage.mdlp|about/credits.mdlp|features/lp/bash/index.mdlp|features/lp/bash/sessions.mdlp|features/lp/bash/sessions.mdlp|features/lp/eval.mdlp|features/lp/examples.mdlp|features/lp/examples.mdlp|features/lp/examples.mdlp|features/lp/parameters.mdlp|features/lp/parameters.mdlp|features/lp/parameters.mdlp|features/lp/parameters.mdlp|features/lp/parameters.mdlp|features/lp/parameters.mdlp|features/lp/parameters.mdlp|features/lp/parameters.mdlp|features/lp/parameters.mdlp|features/lp/plugs/_tech.mdlp|features/lp/plugs/chart/index.mdlp|features/lp/plugs/chartist/index.mdlp|features/lp/plugs/column/index.mdlp|features/lp/plugs/drawio/index.mdlp|features/lp/plugs/flowchart/index.mdlp|features/lp/plugs/kroki/index.mdlp|features/lp/plugs/kroki/index.mdlp|features/lp/plugs/kroki/index.mdlp|features/lp/plugs/lightbox/index.mdlp|features/lp/plugs/make_badges/index.mdlp|features/lp/plugs/make_file/index.mdlp|features/lp/plugs/markmap/index.mdlp|features/lp/plugs/mermaid/index.mdlp|features/lp/plugs/show_file/index.mdlp|features/lp/plugs/show_src/index.mdlp|features/lp/python/_tech.mdlp|features/lp/sessions.mdlp|features/lp/sessions.mdlp|features/lp/sessions.mdlp|features/lp/syntax.mdlp|features/lp/syntax.mdlp|features/lp/syntax.mdlp|features/lp/tips.mdlp|features/lp/xterm.mdlp|index.mdlp|index.mdpytest

84 m += (n + '\n' + coljhighlight(j)) if j else n lplp|about/coverage.mdlp|about/credits.mdlp|features/lp/bash/index.mdlp|features/lp/bash/sessions.mdlp|features/lp/bash/sessions.mdlp|features/lp/eval.mdlp|features/lp/examples.mdlp|features/lp/examples.mdlp|features/lp/examples.mdlp|features/lp/parameters.mdlp|features/lp/parameters.mdlp|features/lp/parameters.mdlp|features/lp/parameters.mdlp|features/lp/parameters.mdlp|features/lp/parameters.mdlp|features/lp/parameters.mdlp|features/lp/parameters.mdlp|features/lp/parameters.mdlp|features/lp/plugs/_tech.mdlp|features/lp/plugs/chart/index.mdlp|features/lp/plugs/chartist/index.mdlp|features/lp/plugs/column/index.mdlp|features/lp/plugs/drawio/index.mdlp|features/lp/plugs/flowchart/index.mdlp|features/lp/plugs/kroki/index.mdlp|features/lp/plugs/kroki/index.mdlp|features/lp/plugs/kroki/index.mdlp|features/lp/plugs/lightbox/index.mdlp|features/lp/plugs/make_badges/index.mdlp|features/lp/plugs/make_file/index.mdlp|features/lp/plugs/markmap/index.mdlp|features/lp/plugs/mermaid/index.mdlp|features/lp/plugs/show_file/index.mdlp|features/lp/plugs/show_src/index.mdlp|features/lp/python/_tech.mdlp|features/lp/sessions.mdlp|features/lp/sessions.mdlp|features/lp/sessions.mdlp|features/lp/syntax.mdlp|features/lp/syntax.mdlp|features/lp/syntax.mdlp|features/lp/tips.mdlp|features/lp/xterm.mdlp|index.mdlp|index.mdpytest

85 return m lplp|about/coverage.mdlp|about/credits.mdlp|features/lp/bash/index.mdlp|features/lp/bash/sessions.mdlp|features/lp/bash/sessions.mdlp|features/lp/eval.mdlp|features/lp/examples.mdlp|features/lp/examples.mdlp|features/lp/examples.mdlp|features/lp/parameters.mdlp|features/lp/parameters.mdlp|features/lp/parameters.mdlp|features/lp/parameters.mdlp|features/lp/parameters.mdlp|features/lp/parameters.mdlp|features/lp/parameters.mdlp|features/lp/parameters.mdlp|features/lp/parameters.mdlp|features/lp/plugs/_tech.mdlp|features/lp/plugs/chart/index.mdlp|features/lp/plugs/chartist/index.mdlp|features/lp/plugs/column/index.mdlp|features/lp/plugs/drawio/index.mdlp|features/lp/plugs/flowchart/index.mdlp|features/lp/plugs/kroki/index.mdlp|features/lp/plugs/kroki/index.mdlp|features/lp/plugs/kroki/index.mdlp|features/lp/plugs/lightbox/index.mdlp|features/lp/plugs/make_badges/index.mdlp|features/lp/plugs/make_file/index.mdlp|features/lp/plugs/markmap/index.mdlp|features/lp/plugs/mermaid/index.mdlp|features/lp/plugs/show_file/index.mdlp|features/lp/plugs/show_src/index.mdlp|features/lp/python/_tech.mdlp|features/lp/sessions.mdlp|features/lp/sessions.mdlp|features/lp/sessions.mdlp|features/lp/syntax.mdlp|features/lp/syntax.mdlp|features/lp/syntax.mdlp|features/lp/tips.mdlp|features/lp/xterm.mdlp|index.mdlp|index.mdpytest

86 

87 

88ign_errors = os.environ.get('ignore_err', '').split('::') lppytest

89 

90 

91def log(level_name, meth, msg, kw, _err_levels={'error', 'fatal', 'die'}): lppytest

92 if ign_errors and level_name in _err_levels: 92 ↛ 93line 92 didn't jump to line 93, because the condition on line 92 was never truelplp|about/coverage.mdlp|about/credits.mdlp|features/lp/bash/index.mdlp|features/lp/bash/sessions.mdlp|features/lp/bash/sessions.mdlp|features/lp/eval.mdlp|features/lp/examples.mdlp|features/lp/examples.mdlp|features/lp/examples.mdlp|features/lp/parameters.mdlp|features/lp/parameters.mdlp|features/lp/parameters.mdlp|features/lp/parameters.mdlp|features/lp/parameters.mdlp|features/lp/parameters.mdlp|features/lp/parameters.mdlp|features/lp/parameters.mdlp|features/lp/parameters.mdlp|features/lp/plugs/_tech.mdlp|features/lp/plugs/chart/index.mdlp|features/lp/plugs/chartist/index.mdlp|features/lp/plugs/column/index.mdlp|features/lp/plugs/drawio/index.mdlp|features/lp/plugs/flowchart/index.mdlp|features/lp/plugs/kroki/index.mdlp|features/lp/plugs/kroki/index.mdlp|features/lp/plugs/kroki/index.mdlp|features/lp/plugs/lightbox/index.mdlp|features/lp/plugs/make_badges/index.mdlp|features/lp/plugs/make_file/index.mdlp|features/lp/plugs/markmap/index.mdlp|features/lp/plugs/mermaid/index.mdlp|features/lp/plugs/show_file/index.mdlp|features/lp/plugs/show_src/index.mdlp|features/lp/python/_tech.mdlp|features/lp/sessions.mdlp|features/lp/sessions.mdlp|features/lp/sessions.mdlp|features/lp/syntax.mdlp|features/lp/syntax.mdlp|features/lp/syntax.mdlp|features/lp/tips.mdlp|features/lp/xterm.mdlp|index.mdlp|index.mdpytest

93 if any([p for p in ign_errors if p in msg]): 

94 return app.warning('Ignored Err, level %s' % level_name, orig_msg=msg, kw=kw) 

95 store = log_majors[level_name] lplp|about/coverage.mdlp|about/credits.mdlp|features/lp/bash/index.mdlp|features/lp/bash/sessions.mdlp|features/lp/bash/sessions.mdlp|features/lp/eval.mdlp|features/lp/examples.mdlp|features/lp/examples.mdlp|features/lp/examples.mdlp|features/lp/parameters.mdlp|features/lp/parameters.mdlp|features/lp/parameters.mdlp|features/lp/parameters.mdlp|features/lp/parameters.mdlp|features/lp/parameters.mdlp|features/lp/parameters.mdlp|features/lp/parameters.mdlp|features/lp/parameters.mdlp|features/lp/plugs/_tech.mdlp|features/lp/plugs/chart/index.mdlp|features/lp/plugs/chartist/index.mdlp|features/lp/plugs/column/index.mdlp|features/lp/plugs/drawio/index.mdlp|features/lp/plugs/flowchart/index.mdlp|features/lp/plugs/kroki/index.mdlp|features/lp/plugs/kroki/index.mdlp|features/lp/plugs/kroki/index.mdlp|features/lp/plugs/lightbox/index.mdlp|features/lp/plugs/make_badges/index.mdlp|features/lp/plugs/make_file/index.mdlp|features/lp/plugs/markmap/index.mdlp|features/lp/plugs/mermaid/index.mdlp|features/lp/plugs/show_file/index.mdlp|features/lp/plugs/show_src/index.mdlp|features/lp/python/_tech.mdlp|features/lp/sessions.mdlp|features/lp/sessions.mdlp|features/lp/sessions.mdlp|features/lp/syntax.mdlp|features/lp/syntax.mdlp|features/lp/syntax.mdlp|features/lp/tips.mdlp|features/lp/xterm.mdlp|index.mdlp|index.mdpytest

96 dt = now_ms() - t0[0] lplp|about/coverage.mdlp|about/credits.mdlp|features/lp/bash/index.mdlp|features/lp/bash/sessions.mdlp|features/lp/bash/sessions.mdlp|features/lp/eval.mdlp|features/lp/examples.mdlp|features/lp/examples.mdlp|features/lp/examples.mdlp|features/lp/parameters.mdlp|features/lp/parameters.mdlp|features/lp/parameters.mdlp|features/lp/parameters.mdlp|features/lp/parameters.mdlp|features/lp/parameters.mdlp|features/lp/parameters.mdlp|features/lp/parameters.mdlp|features/lp/parameters.mdlp|features/lp/plugs/_tech.mdlp|features/lp/plugs/chart/index.mdlp|features/lp/plugs/chartist/index.mdlp|features/lp/plugs/column/index.mdlp|features/lp/plugs/drawio/index.mdlp|features/lp/plugs/flowchart/index.mdlp|features/lp/plugs/kroki/index.mdlp|features/lp/plugs/kroki/index.mdlp|features/lp/plugs/kroki/index.mdlp|features/lp/plugs/lightbox/index.mdlp|features/lp/plugs/make_badges/index.mdlp|features/lp/plugs/make_file/index.mdlp|features/lp/plugs/markmap/index.mdlp|features/lp/plugs/mermaid/index.mdlp|features/lp/plugs/show_file/index.mdlp|features/lp/plugs/show_src/index.mdlp|features/lp/python/_tech.mdlp|features/lp/sessions.mdlp|features/lp/sessions.mdlp|features/lp/sessions.mdlp|features/lp/syntax.mdlp|features/lp/syntax.mdlp|features/lp/syntax.mdlp|features/lp/tips.mdlp|features/lp/xterm.mdlp|index.mdlp|index.mdpytest

97 if store is not None: 97 ↛ 99line 97 didn't jump to line 99, because the condition on line 97 was never falselplp|about/coverage.mdlp|about/credits.mdlp|features/lp/bash/index.mdlp|features/lp/bash/sessions.mdlp|features/lp/bash/sessions.mdlp|features/lp/eval.mdlp|features/lp/examples.mdlp|features/lp/examples.mdlp|features/lp/examples.mdlp|features/lp/parameters.mdlp|features/lp/parameters.mdlp|features/lp/parameters.mdlp|features/lp/parameters.mdlp|features/lp/parameters.mdlp|features/lp/parameters.mdlp|features/lp/parameters.mdlp|features/lp/parameters.mdlp|features/lp/parameters.mdlp|features/lp/plugs/_tech.mdlp|features/lp/plugs/chart/index.mdlp|features/lp/plugs/chartist/index.mdlp|features/lp/plugs/column/index.mdlp|features/lp/plugs/drawio/index.mdlp|features/lp/plugs/flowchart/index.mdlp|features/lp/plugs/kroki/index.mdlp|features/lp/plugs/kroki/index.mdlp|features/lp/plugs/kroki/index.mdlp|features/lp/plugs/lightbox/index.mdlp|features/lp/plugs/make_badges/index.mdlp|features/lp/plugs/make_file/index.mdlp|features/lp/plugs/markmap/index.mdlp|features/lp/plugs/mermaid/index.mdlp|features/lp/plugs/show_file/index.mdlp|features/lp/plugs/show_src/index.mdlp|features/lp/python/_tech.mdlp|features/lp/sessions.mdlp|features/lp/sessions.mdlp|features/lp/sessions.mdlp|features/lp/syntax.mdlp|features/lp/syntax.mdlp|features/lp/syntax.mdlp|features/lp/tips.mdlp|features/lp/xterm.mdlp|index.mdlp|index.mdpytest

98 store.append([dt, app.name, msg, kw]) lplp|about/coverage.mdlp|about/credits.mdlp|features/lp/bash/index.mdlp|features/lp/bash/sessions.mdlp|features/lp/bash/sessions.mdlp|features/lp/eval.mdlp|features/lp/examples.mdlp|features/lp/examples.mdlp|features/lp/examples.mdlp|features/lp/parameters.mdlp|features/lp/parameters.mdlp|features/lp/parameters.mdlp|features/lp/parameters.mdlp|features/lp/parameters.mdlp|features/lp/parameters.mdlp|features/lp/parameters.mdlp|features/lp/parameters.mdlp|features/lp/parameters.mdlp|features/lp/plugs/_tech.mdlp|features/lp/plugs/chart/index.mdlp|features/lp/plugs/chartist/index.mdlp|features/lp/plugs/column/index.mdlp|features/lp/plugs/drawio/index.mdlp|features/lp/plugs/flowchart/index.mdlp|features/lp/plugs/kroki/index.mdlp|features/lp/plugs/kroki/index.mdlp|features/lp/plugs/kroki/index.mdlp|features/lp/plugs/lightbox/index.mdlp|features/lp/plugs/make_badges/index.mdlp|features/lp/plugs/make_file/index.mdlp|features/lp/plugs/markmap/index.mdlp|features/lp/plugs/mermaid/index.mdlp|features/lp/plugs/show_file/index.mdlp|features/lp/plugs/show_src/index.mdlp|features/lp/python/_tech.mdlp|features/lp/sessions.mdlp|features/lp/sessions.mdlp|features/lp/sessions.mdlp|features/lp/syntax.mdlp|features/lp/syntax.mdlp|features/lp/syntax.mdlp|features/lp/tips.mdlp|features/lp/xterm.mdlp|index.mdlp|index.mdpytest

99 app.log_stats[level_name] += 1 lplp|about/coverage.mdlp|about/credits.mdlp|features/lp/bash/index.mdlp|features/lp/bash/sessions.mdlp|features/lp/bash/sessions.mdlp|features/lp/eval.mdlp|features/lp/examples.mdlp|features/lp/examples.mdlp|features/lp/examples.mdlp|features/lp/parameters.mdlp|features/lp/parameters.mdlp|features/lp/parameters.mdlp|features/lp/parameters.mdlp|features/lp/parameters.mdlp|features/lp/parameters.mdlp|features/lp/parameters.mdlp|features/lp/parameters.mdlp|features/lp/parameters.mdlp|features/lp/plugs/_tech.mdlp|features/lp/plugs/chart/index.mdlp|features/lp/plugs/chartist/index.mdlp|features/lp/plugs/column/index.mdlp|features/lp/plugs/drawio/index.mdlp|features/lp/plugs/flowchart/index.mdlp|features/lp/plugs/kroki/index.mdlp|features/lp/plugs/kroki/index.mdlp|features/lp/plugs/kroki/index.mdlp|features/lp/plugs/lightbox/index.mdlp|features/lp/plugs/make_badges/index.mdlp|features/lp/plugs/make_file/index.mdlp|features/lp/plugs/markmap/index.mdlp|features/lp/plugs/mermaid/index.mdlp|features/lp/plugs/show_file/index.mdlp|features/lp/plugs/show_src/index.mdlp|features/lp/python/_tech.mdlp|features/lp/sessions.mdlp|features/lp/sessions.mdlp|features/lp/sessions.mdlp|features/lp/syntax.mdlp|features/lp/syntax.mdlp|features/lp/syntax.mdlp|features/lp/tips.mdlp|features/lp/xterm.mdlp|index.mdlp|index.mdpytest

100 meth(B(msg + ' ') + tokw(kw)) lplp|about/coverage.mdlp|about/credits.mdlp|features/lp/bash/index.mdlp|features/lp/bash/sessions.mdlp|features/lp/bash/sessions.mdlp|features/lp/eval.mdlp|features/lp/examples.mdlp|features/lp/examples.mdlp|features/lp/examples.mdlp|features/lp/parameters.mdlp|features/lp/parameters.mdlp|features/lp/parameters.mdlp|features/lp/parameters.mdlp|features/lp/parameters.mdlp|features/lp/parameters.mdlp|features/lp/parameters.mdlp|features/lp/parameters.mdlp|features/lp/parameters.mdlp|features/lp/plugs/_tech.mdlp|features/lp/plugs/chart/index.mdlp|features/lp/plugs/chartist/index.mdlp|features/lp/plugs/column/index.mdlp|features/lp/plugs/drawio/index.mdlp|features/lp/plugs/flowchart/index.mdlp|features/lp/plugs/kroki/index.mdlp|features/lp/plugs/kroki/index.mdlp|features/lp/plugs/kroki/index.mdlp|features/lp/plugs/lightbox/index.mdlp|features/lp/plugs/make_badges/index.mdlp|features/lp/plugs/make_file/index.mdlp|features/lp/plugs/markmap/index.mdlp|features/lp/plugs/mermaid/index.mdlp|features/lp/plugs/show_file/index.mdlp|features/lp/plugs/show_src/index.mdlp|features/lp/python/_tech.mdlp|features/lp/sessions.mdlp|features/lp/sessions.mdlp|features/lp/sessions.mdlp|features/lp/syntax.mdlp|features/lp/syntax.mdlp|features/lp/syntax.mdlp|features/lp/tips.mdlp|features/lp/xterm.mdlp|index.mdlp|index.mdpytest

101 

102 

103log_methods = ['debug', 'info', 'warning', 'error', 'fatal'] lppytest

104log_majors = {k: [] if k[:3] not in ['deb', 'inf'] else [] for k in log_methods} lppytest

105level_by_name = {n: (i + 1) * 10 for n, i in zip(log_methods, range(len(log_methods)))} lppytest

106 

107 

108class app: lppytest

109 """ 

110 Provider of app.info, app.die, ... 

111 

112 """ 

113 

114 name = None lppytest

115 level = 20 lppytest

116 log_stats = LogStats lppytest

117 

118 def die(msg, **kw): lppytest

119 app.fatal(msg, **kw) 

120 sys.exit(1) 

121 

122 def setup_logging(logging_system, name=None, c=[0]): lppytest

123 app.name = name if name is not None else app.name lppytest

124 try: lppytest

125 # only one logging system => only once: 

126 if c[0]: lppytest

127 return lp

128 ls = p = logging_system lppytest

129 for lm in log_methods: lppytest

130 h = getattr(ls, lm) lppytest

131 setattr(app, lm, lambda msg, lm=lm, h=h, **kw: log(lm, h, msg, kw)) lplp|about/coverage.mdlp|about/credits.mdlp|features/lp/bash/index.mdlp|features/lp/bash/sessions.mdlp|features/lp/bash/sessions.mdlp|features/lp/eval.mdlp|features/lp/examples.mdlp|features/lp/examples.mdlp|features/lp/examples.mdlp|features/lp/parameters.mdlp|features/lp/parameters.mdlp|features/lp/parameters.mdlp|features/lp/parameters.mdlp|features/lp/parameters.mdlp|features/lp/parameters.mdlp|features/lp/parameters.mdlp|features/lp/parameters.mdlp|features/lp/parameters.mdlp|features/lp/plugs/_tech.mdlp|features/lp/plugs/chart/index.mdlp|features/lp/plugs/chartist/index.mdlp|features/lp/plugs/column/index.mdlp|features/lp/plugs/drawio/index.mdlp|features/lp/plugs/flowchart/index.mdlp|features/lp/plugs/kroki/index.mdlp|features/lp/plugs/kroki/index.mdlp|features/lp/plugs/kroki/index.mdlp|features/lp/plugs/lightbox/index.mdlp|features/lp/plugs/make_badges/index.mdlp|features/lp/plugs/make_file/index.mdlp|features/lp/plugs/markmap/index.mdlp|features/lp/plugs/mermaid/index.mdlp|features/lp/plugs/show_file/index.mdlp|features/lp/plugs/show_src/index.mdlp|features/lp/python/_tech.mdlp|features/lp/sessions.mdlp|features/lp/sessions.mdlp|features/lp/sessions.mdlp|features/lp/syntax.mdlp|features/lp/syntax.mdlp|features/lp/syntax.mdlp|features/lp/tips.mdlp|features/lp/xterm.mdlp|index.mdlp|index.mdpytest

132 try: lppytest

133 while not p.handlers: lppytest

134 p = p.parent lppytest

135 except Exception as ex: 

136 app.level = 20 

137 return 

138 app.level = p.handlers[0].level lppytest

139 finally: 

140 c[0] = True lppytest

141 

142 

143for lm in log_methods: lppytest

144 setattr(app, lm, lambda msg, lm=lm, **kw: log(lm, print, ('[%s] ' % lm) + msg, kw)) 144 ↛ exitline 144 didn't run the lambda on line 144lppytest

145 app.log_stats[lm] = 0 lppytest