markdown-exec 1.8.2__py3-none-any.whl → 1.8.3__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,8 @@
1
+ """Special module without future annotations for executing Python code."""
2
+
3
+ from typing import Any, Dict, Optional
4
+
5
+
6
+ def exec_python(code: str, filename: str, exec_globals: Optional[Dict[str, Any]] = None) -> None:
7
+ compiled = compile(code, filename=filename, mode="exec")
8
+ exec(compiled, exec_globals) # noqa: S102
@@ -11,6 +11,7 @@ from io import StringIO
11
11
  from types import ModuleType
12
12
  from typing import Any
13
13
 
14
+ from markdown_exec.formatters._exec_python import exec_python
14
15
  from markdown_exec.formatters.base import ExecutionError, base_format
15
16
  from markdown_exec.rendering import code_block
16
17
 
@@ -67,8 +68,7 @@ def _run_python(
67
68
  exec_globals["print"] = partial(_buffer_print, buffer)
68
69
 
69
70
  try:
70
- compiled = compile(code, filename=code_block_id, mode="exec")
71
- exec(compiled, exec_globals) # noqa: S102
71
+ exec_python(code, code_block_id, exec_globals)
72
72
  except Exception as error: # noqa: BLE001
73
73
  trace = traceback.TracebackException.from_exception(error)
74
74
  for frame in trace.stack:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: markdown-exec
3
- Version: 1.8.2
3
+ Version: 1.8.3
4
4
  Summary: Utilities to execute code blocks in Markdown files.
5
5
  Keywords: markdown,python,exec,shell,bash,mkdocs
6
6
  Author-Email: =?utf-8?q?Timoth=C3=A9e_Mazzucotelli?= <dev@pawamoy.fr>
@@ -1,18 +1,19 @@
1
- markdown_exec-1.8.2.dist-info/METADATA,sha256=tx7RBQpDl8CiB4TV2Zm8xFjldQKCDCuClMd17bth-l8,4954
2
- markdown_exec-1.8.2.dist-info/WHEEL,sha256=vnE8JVcI2Wz7GRKorsPArnBdnW2SWKWGow5gu5tHlRU,90
3
- markdown_exec-1.8.2.dist-info/entry_points.txt,sha256=W-JWRoZzS5TXRcyVnxYmsaVBV4HSl7B_7uTgtaZ-Pms,81
4
- markdown_exec-1.8.2.dist-info/licenses/LICENSE,sha256=eZQBcJKqlN0QepmOi0u09hlqKMPFdzWjY6NUWYeJGZs,754
1
+ markdown_exec-1.8.3.dist-info/METADATA,sha256=Zb4ucOswqJdnlb39c6CjEuzb-J-9TssLja6SpsRKcz8,4954
2
+ markdown_exec-1.8.3.dist-info/WHEEL,sha256=vnE8JVcI2Wz7GRKorsPArnBdnW2SWKWGow5gu5tHlRU,90
3
+ markdown_exec-1.8.3.dist-info/entry_points.txt,sha256=W-JWRoZzS5TXRcyVnxYmsaVBV4HSl7B_7uTgtaZ-Pms,81
4
+ markdown_exec-1.8.3.dist-info/licenses/LICENSE,sha256=eZQBcJKqlN0QepmOi0u09hlqKMPFdzWjY6NUWYeJGZs,754
5
5
  markdown_exec/__init__.py,sha256=cdQDNiSeWnQ8NK3hqNOfyxKT8uoxLkKm4VI_8E7ztcM,4366
6
6
  markdown_exec/ansi.css,sha256=6PTJxTSsExVgPbMySCuKjih0gr-fdfx2aZ9--u7zWf0,8090
7
7
  markdown_exec/debug.py,sha256=dy0bTd9mTTyTaWuUGNkH0UUdMp2ZThsmGh5q9wt9O0c,2840
8
8
  markdown_exec/formatters/__init__.py,sha256=w8ui1JaGUA5SCyWd2pPAAopQ5y6QYtDvOUHUa7KW2Wg,51
9
+ markdown_exec/formatters/_exec_python.py,sha256=eVomRZQQl2DySCZIrtqipmBme3kgwIjjRIu8dl22JdE,323
9
10
  markdown_exec/formatters/base.py,sha256=frtAFV1mxi0JMmgESrbmLk5XD-MMAgc6SrmpwLcS3gQ,4761
10
11
  markdown_exec/formatters/bash.py,sha256=qVn6nPqitUuFX72ll00w_x343zl_bMuXrr-Xyox4dJY,886
11
12
  markdown_exec/formatters/console.py,sha256=D2JBIC4MU0ct2MiRCkBO-qo4MiH6Hjy6LXjYAsRmuRA,815
12
13
  markdown_exec/formatters/markdown.py,sha256=pd0akvFGUXrc41NABcHUTTkKFA3k5Ju8im-b3kzOvIw,276
13
14
  markdown_exec/formatters/pycon.py,sha256=F9xpSRKFWsVpGu5XXybtCkMMJ_PAfyd48Qqo1SWl6RA,854
14
15
  markdown_exec/formatters/pyodide.py,sha256=fsAkEq9cgI_-AipV4tS4iXbaOcqQVi-HjJ-VcfMv6aE,2898
15
- markdown_exec/formatters/python.py,sha256=Jm-_yUxJgeQcP80nom_NXS2juaeU34mRSluIUmxJUCg,3029
16
+ markdown_exec/formatters/python.py,sha256=RMNOPBpTbcF6esxpQ6aW1hpU6YH5OAKq7dcsanUAhiw,3025
16
17
  markdown_exec/formatters/sh.py,sha256=41kmwFjkyisWYmfJeBMC40kqhEe7sI2E0vvbO9ixjCg,876
17
18
  markdown_exec/formatters/tree.py,sha256=4XU1KaNqChkkNxMYanwy6glTE2uwcY8Mz9jBZiIf3zY,2046
18
19
  markdown_exec/logger.py,sha256=e06Ih9EonG3KCAPbwraCEYmS0Nt9yRytyMjVJMAREIQ,2109
@@ -22,4 +23,4 @@ markdown_exec/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
22
23
  markdown_exec/pyodide.css,sha256=rJ-HW-ymcgUfrZ9Mm6QB1qo6eE-I3YQcqSxTmG1NhvM,849
23
24
  markdown_exec/pyodide.js,sha256=6iL-9xA4b9UeZgsxVYq_BiCE-Bwu58NfYwYCzz9C9j0,3845
24
25
  markdown_exec/rendering.py,sha256=ssWg6U-7Ez45N6sLak-oGD2e55qtEkPY8T8l7h1RbDM,9459
25
- markdown_exec-1.8.2.dist-info/RECORD,,
26
+ markdown_exec-1.8.3.dist-info/RECORD,,