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

1""" 

2### `python` 

3 

4This runs the block within a python session. 

5 

6All context available in the `ctx` dicts. 

7 

8Result will be what is printed on stdout. 

9 

10Decide via the language argument (```<language> lp mode=python) what formatting should be applied. 

11""" 

12 

13from importlib import import_module lp|index.md

14from io import StringIO lp|index.md

15from pprint import pformat lp|index.md

16 

17from lcdoc import lp lp|index.md

18from lcdoc.tools import app, dirname, exists, os, project, read_file, write_file lp|index.md

19 

20err = lp.err lp|index.md

21multi_line_to_list = False lp|index.md

22fmt_default = 'unset' lp|index.md

23 

24sessions = S = {} lp|index.md

25 

26config = lambda: Session.kw['LP'].config lp|about/coverage.mdlp|about/credits.mdlp|index.mdlp|index.md

27page = lambda: Session.kw['LP'].page 27 ↛ exitline 27 didn't run the lambda on line 27lp|index.md

28lpkw = lambda: Session.kw lp|features/lp/python/call_flow_logging/index.mdlp|index.mdlp|index.md

29stats = lambda: page().stats 29 ↛ exitline 29 didn't run the lambda on line 29lp|index.md

30 

31 

32def new_session_ctx(): lp|index.md

33 return {'out': [], 'locals': {}, 'assets': {}} lp|about/coverage.mdlp|about/credits.mdlp|features/lp/plugs/chart/index.mdlp|features/lp/plugs/flowchart/index.mdlp|features/lp/plugs/flowchart/index.mdlp|features/lp/plugs/lightbox/index.mdlp|features/lp/python/_tech.mdlp|features/lp/python/_tech.mdlp|features/lp/python/call_flow_logging/index.mdlp|features/lp/syntax.mdlp|index.mdlp|index.md

34 

35 

36class Session(lp.SessionNS): lp|index.md

37 name = None lp|index.md

38 cur = None lp|index.md

39 kw = None lp|index.md

40 

41 @classmethod lp|index.md

42 def delete(cls, ns, kw): 

43 sessions.pop(ns, 0) lp|features/lp/python/_tech.md

44 

45 @classmethod lp|index.md

46 def pre(cls, session_name, kw): 

47 Session.name, Session.kw = session_name, kw lp|about/coverage.mdlp|about/credits.mdlp|features/lp/plugs/chart/index.mdlp|features/lp/plugs/flowchart/index.mdlp|features/lp/plugs/flowchart/index.mdlp|features/lp/plugs/lightbox/index.mdlp|features/lp/python/_tech.mdlp|features/lp/python/_tech.mdlp|features/lp/python/call_flow_logging/index.mdlp|features/lp/syntax.mdlp|index.mdlp|index.md

48 Session.cur = sessions.setdefault(session_name, new_session_ctx()) lp|about/coverage.mdlp|about/credits.mdlp|features/lp/plugs/chart/index.mdlp|features/lp/plugs/flowchart/index.mdlp|features/lp/plugs/flowchart/index.mdlp|features/lp/plugs/lightbox/index.mdlp|features/lp/python/_tech.mdlp|features/lp/python/_tech.mdlp|features/lp/python/call_flow_logging/index.mdlp|features/lp/syntax.mdlp|index.mdlp|index.md

49 # we support pre param to run system stuff before python 

50 lp.SessionNS.pre(session_name, kw) lp|about/coverage.mdlp|about/credits.mdlp|features/lp/plugs/chart/index.mdlp|features/lp/plugs/flowchart/index.mdlp|features/lp/plugs/flowchart/index.mdlp|features/lp/plugs/lightbox/index.mdlp|features/lp/python/_tech.mdlp|features/lp/python/_tech.mdlp|features/lp/python/call_flow_logging/index.mdlp|features/lp/syntax.mdlp|index.mdlp|index.md

51 

52 @classmethod lp|index.md

53 def post(cls, session_name, kw): 

54 Session.cur['out'].clear() lp|about/coverage.mdlp|about/credits.mdlp|features/lp/plugs/chart/index.mdlp|features/lp/plugs/flowchart/index.mdlp|features/lp/plugs/flowchart/index.mdlp|features/lp/plugs/lightbox/index.mdlp|features/lp/python/_tech.mdlp|features/lp/python/_tech.mdlp|features/lp/syntax.mdlp|index.mdlp|index.md

55 if cls.name is None: lp|about/coverage.mdlp|about/credits.mdlp|features/lp/plugs/chart/index.mdlp|features/lp/plugs/flowchart/index.mdlp|features/lp/plugs/flowchart/index.mdlp|features/lp/plugs/lightbox/index.mdlp|features/lp/python/_tech.mdlp|features/lp/python/_tech.mdlp|features/lp/syntax.mdlp|index.mdlp|index.md

56 Session.cur['locals'].clear() lp|about/coverage.mdlp|about/credits.mdlp|features/lp/plugs/chart/index.mdlp|features/lp/plugs/lightbox/index.mdlp|features/lp/syntax.mdlp|index.mdlp|index.md

57 sessions.pop(None) # forget it, no name was given lp|about/coverage.mdlp|about/credits.mdlp|features/lp/plugs/chart/index.mdlp|features/lp/plugs/lightbox/index.mdlp|features/lp/syntax.mdlp|index.mdlp|index.md

58 # we support post param to run system stuff before python 

59 lp.SessionNS.post(session_name, kw) lp|about/coverage.mdlp|about/credits.mdlp|features/lp/plugs/chart/index.mdlp|features/lp/plugs/flowchart/index.mdlp|features/lp/plugs/flowchart/index.mdlp|features/lp/plugs/lightbox/index.mdlp|features/lp/python/_tech.mdlp|features/lp/python/_tech.mdlp|features/lp/syntax.mdlp|index.mdlp|index.md

60 

61 

62def out(s, t=None, innerkw=None): lp|index.md

63 Session.cur['out'].append([t, s, innerkw]) lp|about/coverage.mdlp|about/credits.mdlp|features/lp/plugs/flowchart/index.mdlp|features/lp/plugs/lightbox/index.mdlp|features/lp/python/_tech.mdlp|features/lp/python/_tech.mdlp|features/lp/syntax.mdlp|index.mdlp|index.md

64 

65 

66def printed(s, **innerkw): lp|index.md

67 out(s, 'printed', innerkw=innerkw) lp|features/lp/plugs/flowchart/index.mdlp|features/lp/python/_tech.mdlp|features/lp/python/_tech.md

68 

69 

70def show(s, **innerkw): lp|index.md

71 f = matching_pyplug(s, innerkw) lp|about/coverage.mdlp|about/credits.mdlp|features/lp/plugs/lightbox/index.mdlp|features/lp/python/_tech.mdlp|features/lp/python/call_flow_logging/index.mdlp|features/lp/syntax.mdlp|index.mdlp|index.md

72 if f: lp|about/coverage.mdlp|about/credits.mdlp|features/lp/plugs/lightbox/index.mdlp|features/lp/python/_tech.mdlp|features/lp/python/call_flow_logging/index.mdlp|features/lp/syntax.mdlp|index.mdlp|index.md

73 s = f(s, **innerkw) lp|about/coverage.mdlp|about/credits.mdlp|features/lp/plugs/lightbox/index.mdlp|features/lp/python/call_flow_logging/index.mdlp|index.md

74 # need this for call_flow_logging :-/ 

75 if isinstance(s, dict): lp|about/coverage.mdlp|about/credits.mdlp|features/lp/plugs/lightbox/index.mdlp|index.md

76 if 'nocache' in s: 76 ↛ 78line 76 didn't jump to line 78, because the condition on line 76 was never falselp|index.md

77 lpkw()['nocache'] = s['nocache'] lp|index.md

78 s = s['res'] lp|index.md

79 out(s, 'md', innerkw=innerkw) lp|about/coverage.mdlp|about/credits.mdlp|features/lp/plugs/lightbox/index.mdlp|features/lp/python/_tech.mdlp|features/lp/syntax.mdlp|index.mdlp|index.md

80 

81 

82# keys: matching strings on s and s class, with s the argument of `show()`: 

83 

84fmts = {} lp|index.md

85 

86 

87def matching_pyplug(s, innerkw): lp|index.md

88 """find rendering pyplug based on type of output""" 

89 if innerkw.get('md'): lp|about/coverage.mdlp|about/credits.mdlp|features/lp/plugs/lightbox/index.mdlp|features/lp/python/_tech.mdlp|features/lp/python/call_flow_logging/index.mdlp|features/lp/syntax.mdlp|index.mdlp|index.md

90 return # markdown was forced (show('> foo', md=True) lp|index.md

91 if isinstance(s, str) and s in fmts: lp|about/coverage.mdlp|about/credits.mdlp|features/lp/plugs/lightbox/index.mdlp|features/lp/python/_tech.mdlp|features/lp/python/call_flow_logging/index.mdlp|features/lp/syntax.mdlp|index.md

92 return fmts[s] lp|about/coverage.mdlp|about/credits.mdlp|features/lp/python/call_flow_logging/index.mdlp|index.md

93 for k in fmts: lp|features/lp/plugs/lightbox/index.mdlp|features/lp/python/_tech.mdlp|features/lp/syntax.md

94 if callable(k): lp|features/lp/plugs/lightbox/index.mdlp|features/lp/python/_tech.mdlp|features/lp/syntax.md

95 r = k(s, innerkw) lp|features/lp/plugs/lightbox/index.mdlp|features/lp/python/_tech.mdlp|features/lp/syntax.md

96 if r: lp|features/lp/plugs/lightbox/index.mdlp|features/lp/python/_tech.mdlp|features/lp/syntax.md

97 return fmts[k] lp|features/lp/plugs/lightbox/index.md

98 elif k in str([s, s.__class__]): 98 ↛ 99line 98 didn't jump to line 99, because the condition on line 98 was never truelp|features/lp/plugs/lightbox/index.mdlp|features/lp/python/_tech.mdlp|features/lp/syntax.md

99 return fmts[k] 

100 if not isinstance(s, str): 100 ↛ 101line 100 didn't jump to line 101, because the condition on line 100 was never truelp|features/lp/python/_tech.mdlp|features/lp/syntax.md

101 app.die('No formatter matched', s=s, **innerkw) 

102 

103 

104def fmt(t, s, kw): lp|index.md

105 if t == 'md': lp|about/coverage.mdlp|about/credits.mdlp|features/lp/plugs/flowchart/index.mdlp|features/lp/plugs/lightbox/index.mdlp|features/lp/python/_tech.mdlp|features/lp/python/_tech.mdlp|features/lp/syntax.mdlp|index.mdlp|index.md

106 o = (False, s) lp|about/coverage.mdlp|about/credits.mdlp|features/lp/plugs/lightbox/index.mdlp|features/lp/python/_tech.mdlp|features/lp/syntax.mdlp|index.mdlp|index.md

107 elif isinstance(s, str): lp|features/lp/plugs/flowchart/index.mdlp|features/lp/python/_tech.mdlp|features/lp/python/_tech.md

108 o = (True, s) lp|features/lp/plugs/flowchart/index.mdlp|features/lp/python/_tech.md

109 else: 

110 o = (True, pformat(s)) lp|features/lp/python/_tech.md

111 return o lp|about/coverage.mdlp|about/credits.mdlp|features/lp/plugs/flowchart/index.mdlp|features/lp/plugs/lightbox/index.mdlp|features/lp/python/_tech.mdlp|features/lp/python/_tech.mdlp|features/lp/syntax.mdlp|index.mdlp|index.md

112 

113 

114D_lp_py = lambda: project.root() + '/build/autodocs/lp_python/' lp|features/lp/python/call_flow_logging/index.mdlp|index.md

115 

116import sys lp|index.md

117 

118 

119def cmd_to_module_file(cmd, kw): lp|index.md

120 dr = D_lp_py() lp|features/lp/python/call_flow_logging/index.md

121 fn = dr + dirname(kw['LP'].page.file.src_path) + '/%(id)s.py' % kw lp|features/lp/python/call_flow_logging/index.md

122 h = 'from lcdoc.mkdocs.lp.plugs import python' lp|features/lp/python/call_flow_logging/index.md

123 h += '\nprint = python.printed' lp|features/lp/python/call_flow_logging/index.md

124 h += '\nshow = python.show' lp|features/lp/python/call_flow_logging/index.md

125 h += '\ndef run_lp_flow():' lp|features/lp/python/call_flow_logging/index.md

126 cmd = ('\n' + cmd).replace('\n', '\n ') lp|features/lp/python/call_flow_logging/index.md

127 write_file(fn, h + '\n' + cmd, mkdir=1) lp|features/lp/python/call_flow_logging/index.md

128 sys.path.insert(0, dirname(fn)) if not dirname(fn) in sys.path else 0 lp|features/lp/python/call_flow_logging/index.md

129 return fn lp|features/lp/python/call_flow_logging/index.md

130 

131 

132import importlib lp|index.md

133 

134 

135def run(cmd, kw): lp|index.md

136 """ 

137 interpret the command as python 

138 """ 

139 # short form convenience: `lp:python show=project_dependencies` 

140 # set if not yet done: 

141 project.root(kw['LP'].config) lp|about/coverage.mdlp|about/credits.mdlp|features/lp/plugs/chart/index.mdlp|features/lp/plugs/flowchart/index.mdlp|features/lp/plugs/flowchart/index.mdlp|features/lp/plugs/lightbox/index.mdlp|features/lp/python/_tech.mdlp|features/lp/python/_tech.mdlp|features/lp/python/call_flow_logging/index.mdlp|features/lp/syntax.mdlp|index.mdlp|index.md

142 shw = kw.pop('show', '') lp|about/coverage.mdlp|about/credits.mdlp|features/lp/plugs/chart/index.mdlp|features/lp/plugs/flowchart/index.mdlp|features/lp/plugs/flowchart/index.mdlp|features/lp/plugs/lightbox/index.mdlp|features/lp/python/_tech.mdlp|features/lp/python/_tech.mdlp|features/lp/python/call_flow_logging/index.mdlp|features/lp/syntax.mdlp|index.mdlp|index.md

143 if shw and isinstance(cmd, str): lp|about/coverage.mdlp|about/credits.mdlp|features/lp/plugs/chart/index.mdlp|features/lp/plugs/flowchart/index.mdlp|features/lp/plugs/flowchart/index.mdlp|features/lp/plugs/lightbox/index.mdlp|features/lp/python/_tech.mdlp|features/lp/python/_tech.mdlp|features/lp/python/call_flow_logging/index.mdlp|features/lp/syntax.mdlp|index.mdlp|index.md

144 cmd = 'show("%s")' % shw + cmd lp|about/credits.mdlp|index.md

145 if kw.get('cfl'): lp|about/coverage.mdlp|about/credits.mdlp|features/lp/plugs/chart/index.mdlp|features/lp/plugs/flowchart/index.mdlp|features/lp/plugs/flowchart/index.mdlp|features/lp/plugs/lightbox/index.mdlp|features/lp/python/_tech.mdlp|features/lp/python/_tech.mdlp|features/lp/python/call_flow_logging/index.mdlp|features/lp/syntax.mdlp|index.mdlp|index.md

146 modfn = cmd_to_module_file(cmd, kw) lp|features/lp/python/call_flow_logging/index.md

147 m = importlib.import_module(kw['id']) lp|features/lp/python/call_flow_logging/index.md

148 m.run_lp_flow() lp|features/lp/python/call_flow_logging/index.md

149 else: 

150 loc = Session.cur['locals'] lp|about/coverage.mdlp|about/credits.mdlp|features/lp/plugs/chart/index.mdlp|features/lp/plugs/flowchart/index.mdlp|features/lp/plugs/flowchart/index.mdlp|features/lp/plugs/lightbox/index.mdlp|features/lp/python/_tech.mdlp|features/lp/python/_tech.mdlp|features/lp/syntax.mdlp|index.mdlp|index.md

151 g = {'print': printed, 'show': show, 'ctx': kw} lp|about/coverage.mdlp|about/credits.mdlp|features/lp/plugs/chart/index.mdlp|features/lp/plugs/flowchart/index.mdlp|features/lp/plugs/flowchart/index.mdlp|features/lp/plugs/lightbox/index.mdlp|features/lp/python/_tech.mdlp|features/lp/python/_tech.mdlp|features/lp/syntax.mdlp|index.mdlp|index.md

152 loc.update(g) lp|about/coverage.mdlp|about/credits.mdlp|features/lp/plugs/chart/index.mdlp|features/lp/plugs/flowchart/index.mdlp|features/lp/plugs/flowchart/index.mdlp|features/lp/plugs/lightbox/index.mdlp|features/lp/python/_tech.mdlp|features/lp/python/_tech.mdlp|features/lp/syntax.mdlp|index.mdlp|index.md

153 exec(cmd, loc) lp|about/coverage.mdlp|about/credits.mdlp|features/lp/plugs/chart/index.mdlp|features/lp/plugs/flowchart/index.mdlp|features/lp/plugs/flowchart/index.mdlp|features/lp/plugs/lightbox/index.mdlp|features/lp/python/_tech.mdlp|features/lp/python/_tech.mdlp|features/lp/syntax.mdlp|index.mdlp|index.md

154 o = Session.cur['out'] lp|about/coverage.mdlp|about/credits.mdlp|features/lp/plugs/chart/index.mdlp|features/lp/plugs/flowchart/index.mdlp|features/lp/plugs/flowchart/index.mdlp|features/lp/plugs/lightbox/index.mdlp|features/lp/python/_tech.mdlp|features/lp/python/_tech.mdlp|features/lp/syntax.mdlp|index.mdlp|index.md

155 res = [fmt(*i) for i in o] lp|about/coverage.mdlp|about/credits.mdlp|features/lp/plugs/chart/index.mdlp|features/lp/plugs/flowchart/index.mdlp|features/lp/plugs/flowchart/index.mdlp|features/lp/plugs/lightbox/index.mdlp|features/lp/python/_tech.mdlp|features/lp/python/_tech.mdlp|features/lp/syntax.mdlp|index.mdlp|index.md

156 fncd = False lp|about/coverage.mdlp|about/credits.mdlp|features/lp/plugs/chart/index.mdlp|features/lp/plugs/flowchart/index.mdlp|features/lp/plugs/flowchart/index.mdlp|features/lp/plugs/lightbox/index.mdlp|features/lp/python/_tech.mdlp|features/lp/python/_tech.mdlp|features/lp/syntax.mdlp|index.mdlp|index.md

157 r = [''] lp|about/coverage.mdlp|about/credits.mdlp|features/lp/plugs/chart/index.mdlp|features/lp/plugs/flowchart/index.mdlp|features/lp/plugs/flowchart/index.mdlp|features/lp/plugs/lightbox/index.mdlp|features/lp/python/_tech.mdlp|features/lp/python/_tech.mdlp|features/lp/syntax.mdlp|index.mdlp|index.md

158 add = lambda k: r.append(k) if k is not None else 0 lp|about/coverage.mdlp|about/credits.mdlp|features/lp/plugs/chart/index.mdlp|features/lp/plugs/flowchart/index.mdlp|features/lp/plugs/flowchart/index.mdlp|features/lp/plugs/lightbox/index.mdlp|features/lp/python/_tech.mdlp|features/lp/python/_tech.mdlp|features/lp/syntax.mdlp|index.mdlp|index.md

159 # if the fmt is given (mk_console usually), then we show the command (python code) 

160 # and the output within the usual lp fenced code block. 

161 # if it was unset then we open and close fenced code only for print outs 

162 fstart, fstop = (None, None) lp|about/coverage.mdlp|about/credits.mdlp|features/lp/plugs/chart/index.mdlp|features/lp/plugs/flowchart/index.mdlp|features/lp/plugs/flowchart/index.mdlp|features/lp/plugs/lightbox/index.mdlp|features/lp/python/_tech.mdlp|features/lp/python/_tech.mdlp|features/lp/syntax.mdlp|index.mdlp|index.md

163 if kw['fmt'] == 'unset': lp|about/coverage.mdlp|about/credits.mdlp|features/lp/plugs/chart/index.mdlp|features/lp/plugs/flowchart/index.mdlp|features/lp/plugs/flowchart/index.mdlp|features/lp/plugs/lightbox/index.mdlp|features/lp/python/_tech.mdlp|features/lp/python/_tech.mdlp|features/lp/syntax.mdlp|index.mdlp|index.md

164 fstart = '```python' lp|about/coverage.mdlp|about/credits.mdlp|features/lp/plugs/chart/index.mdlp|features/lp/plugs/flowchart/index.mdlp|features/lp/plugs/flowchart/index.mdlp|features/lp/plugs/lightbox/index.mdlp|features/lp/python/_tech.mdlp|features/lp/syntax.mdlp|index.mdlp|index.md

165 fstop = '```' lp|about/coverage.mdlp|about/credits.mdlp|features/lp/plugs/chart/index.mdlp|features/lp/plugs/flowchart/index.mdlp|features/lp/plugs/flowchart/index.mdlp|features/lp/plugs/lightbox/index.mdlp|features/lp/python/_tech.mdlp|features/lp/syntax.mdlp|index.mdlp|index.md

166 while res: lp|about/coverage.mdlp|about/credits.mdlp|features/lp/plugs/chart/index.mdlp|features/lp/plugs/flowchart/index.mdlp|features/lp/plugs/flowchart/index.mdlp|features/lp/plugs/lightbox/index.mdlp|features/lp/python/_tech.mdlp|features/lp/python/_tech.mdlp|features/lp/syntax.mdlp|index.mdlp|index.md

167 is_fenced, o = res.pop(0) lp|about/coverage.mdlp|about/credits.mdlp|features/lp/plugs/flowchart/index.mdlp|features/lp/plugs/lightbox/index.mdlp|features/lp/python/_tech.mdlp|features/lp/python/_tech.mdlp|features/lp/syntax.mdlp|index.mdlp|index.md

168 if is_fenced and not fncd: lp|about/coverage.mdlp|about/credits.mdlp|features/lp/plugs/flowchart/index.mdlp|features/lp/plugs/lightbox/index.mdlp|features/lp/python/_tech.mdlp|features/lp/python/_tech.mdlp|features/lp/syntax.mdlp|index.mdlp|index.md

169 add(fstart) lp|features/lp/plugs/flowchart/index.mdlp|features/lp/python/_tech.mdlp|features/lp/python/_tech.md

170 fncd = True lp|features/lp/plugs/flowchart/index.mdlp|features/lp/python/_tech.mdlp|features/lp/python/_tech.md

171 elif not is_fenced and fncd: lp|about/coverage.mdlp|about/credits.mdlp|features/lp/plugs/lightbox/index.mdlp|features/lp/python/_tech.mdlp|features/lp/syntax.mdlp|index.mdlp|index.md

172 add(fstop) lp|features/lp/python/_tech.md

173 fncd = False lp|features/lp/python/_tech.md

174 add(o) lp|about/coverage.mdlp|about/credits.mdlp|features/lp/plugs/flowchart/index.mdlp|features/lp/plugs/lightbox/index.mdlp|features/lp/python/_tech.mdlp|features/lp/python/_tech.mdlp|features/lp/syntax.mdlp|index.mdlp|index.md

175 if fncd: lp|about/coverage.mdlp|about/credits.mdlp|features/lp/plugs/chart/index.mdlp|features/lp/plugs/flowchart/index.mdlp|features/lp/plugs/flowchart/index.mdlp|features/lp/plugs/lightbox/index.mdlp|features/lp/python/_tech.mdlp|features/lp/python/_tech.mdlp|features/lp/syntax.mdlp|index.mdlp|index.md

176 add(fstop) lp|features/lp/plugs/flowchart/index.mdlp|features/lp/python/_tech.md

177 res = '\n\n'.join(r) lp|about/coverage.mdlp|about/credits.mdlp|features/lp/plugs/chart/index.mdlp|features/lp/plugs/flowchart/index.mdlp|features/lp/plugs/flowchart/index.mdlp|features/lp/plugs/lightbox/index.mdlp|features/lp/python/_tech.mdlp|features/lp/python/_tech.mdlp|features/lp/syntax.mdlp|index.mdlp|index.md

178 r = {'res': res} lp|about/coverage.mdlp|about/credits.mdlp|features/lp/plugs/chart/index.mdlp|features/lp/plugs/flowchart/index.mdlp|features/lp/plugs/flowchart/index.mdlp|features/lp/plugs/lightbox/index.mdlp|features/lp/python/_tech.mdlp|features/lp/python/_tech.mdlp|features/lp/syntax.mdlp|index.mdlp|index.md

179 # python code may explicitly set a result as object, ready to process e.g. in a mode pipe 

180 rslt = Session.cur['locals'].get('result') lp|about/coverage.mdlp|about/credits.mdlp|features/lp/plugs/chart/index.mdlp|features/lp/plugs/flowchart/index.mdlp|features/lp/plugs/flowchart/index.mdlp|features/lp/plugs/lightbox/index.mdlp|features/lp/python/_tech.mdlp|features/lp/python/_tech.mdlp|features/lp/syntax.mdlp|index.mdlp|index.md

181 if rslt: lp|about/coverage.mdlp|about/credits.mdlp|features/lp/plugs/chart/index.mdlp|features/lp/plugs/flowchart/index.mdlp|features/lp/plugs/flowchart/index.mdlp|features/lp/plugs/lightbox/index.mdlp|features/lp/python/_tech.mdlp|features/lp/python/_tech.mdlp|features/lp/syntax.mdlp|index.mdlp|index.md

182 r['result'] = rslt lp|features/lp/plugs/chart/index.mdlp|features/lp/plugs/flowchart/index.md

183 # was fmt given by user? 

184 if kw['fmt'] == 'unset': lp|about/coverage.mdlp|about/credits.mdlp|features/lp/plugs/chart/index.mdlp|features/lp/plugs/flowchart/index.mdlp|features/lp/plugs/flowchart/index.mdlp|features/lp/plugs/lightbox/index.mdlp|features/lp/python/_tech.mdlp|features/lp/python/_tech.mdlp|features/lp/syntax.mdlp|index.mdlp|index.md

185 r['formatted'] = True lp|about/coverage.mdlp|about/credits.mdlp|features/lp/plugs/chart/index.mdlp|features/lp/plugs/flowchart/index.mdlp|features/lp/plugs/flowchart/index.mdlp|features/lp/plugs/lightbox/index.mdlp|features/lp/python/_tech.mdlp|features/lp/syntax.mdlp|index.mdlp|index.md

186 if 'nocache' in kw: lp|about/coverage.mdlp|about/credits.mdlp|features/lp/plugs/chart/index.mdlp|features/lp/plugs/flowchart/index.mdlp|features/lp/plugs/flowchart/index.mdlp|features/lp/plugs/lightbox/index.mdlp|features/lp/python/_tech.mdlp|features/lp/python/_tech.mdlp|features/lp/syntax.mdlp|index.mdlp|index.md

187 r['nocache'] = kw['nocache'] lp|index.md

188 r.update(Session.cur['assets']) lp|about/coverage.mdlp|about/credits.mdlp|features/lp/plugs/chart/index.mdlp|features/lp/plugs/flowchart/index.mdlp|features/lp/plugs/flowchart/index.mdlp|features/lp/plugs/lightbox/index.mdlp|features/lp/python/_tech.mdlp|features/lp/python/_tech.mdlp|features/lp/syntax.mdlp|index.mdlp|index.md

189 return r lp|about/coverage.mdlp|about/credits.mdlp|features/lp/plugs/chart/index.mdlp|features/lp/plugs/flowchart/index.mdlp|features/lp/plugs/flowchart/index.mdlp|features/lp/plugs/lightbox/index.mdlp|features/lp/python/_tech.mdlp|features/lp/python/_tech.mdlp|features/lp/syntax.mdlp|index.mdlp|index.md

190 

191 

192def import_pyplugs(frm): lp|index.md

193 m = import_module(frm) lp|index.md

194 for k in [i for i in dir(m) if not i.startswith('_')]: lp|index.md

195 v = getattr(m, k) lp|index.md

196 if hasattr(v, 'register'): 196 ↛ 194line 196 didn't jump to line 194, because the condition on line 196 was never falselp|index.md

197 v.register(fmts) lp|index.md

198 

199 

200import_pyplugs('lcdoc.mkdocs.lp.plugs.python.pyplugs') lp|index.md

201try: lp|index.md

202 import_pyplugs('lp_python_plugins') # allow customs lp|index.md

203except ModuleNotFoundError as ex: lp|index.md

204 pass lp|index.md