mdformat-py-edu-fr 0.1.6__py3-none-any.whl → 0.1.8__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.
- mdformat_py_edu_fr/__init__.py +3 -3
- mdformat_py_edu_fr/format_with_jupytext.py +8 -3
- {mdformat_py_edu_fr-0.1.6.dist-info → mdformat_py_edu_fr-0.1.8.dist-info}/METADATA +1 -1
- {mdformat_py_edu_fr-0.1.6.dist-info → mdformat_py_edu_fr-0.1.8.dist-info}/RECORD +7 -7
- {mdformat_py_edu_fr-0.1.6.dist-info → mdformat_py_edu_fr-0.1.8.dist-info}/WHEEL +1 -1
- {mdformat_py_edu_fr-0.1.6.dist-info → mdformat_py_edu_fr-0.1.8.dist-info}/entry_points.txt +0 -0
- {mdformat_py_edu_fr-0.1.6.dist-info → mdformat_py_edu_fr-0.1.8.dist-info}/licenses/LICENSE.txt +0 -0
mdformat_py_edu_fr/__init__.py
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import sys
|
|
2
2
|
from pathlib import Path
|
|
3
|
-
from typing import List
|
|
3
|
+
from typing import List
|
|
4
4
|
|
|
5
5
|
import mdformat
|
|
6
6
|
|
|
7
|
-
from .format_with_jupytext import
|
|
7
|
+
from .format_with_jupytext import format_md_with_jupytext
|
|
8
8
|
|
|
9
9
|
try:
|
|
10
10
|
from importlib.metadata import version
|
|
@@ -106,7 +106,7 @@ def format_file(filepath: Path, check: bool = False, verbose: bool = False) -> b
|
|
|
106
106
|
_filename=str(filepath),
|
|
107
107
|
)
|
|
108
108
|
|
|
109
|
-
formatted_str =
|
|
109
|
+
formatted_str = format_md_with_jupytext(formatted_str, filepath)
|
|
110
110
|
|
|
111
111
|
formatted = formatted_str == original_str
|
|
112
112
|
|
|
@@ -13,7 +13,7 @@ path_config_file = Path(__file__).absolute().parent / "jupytext.toml"
|
|
|
13
13
|
config = jupytext.config.load_jupytext_configuration_file(str(path_config_file))
|
|
14
14
|
|
|
15
15
|
|
|
16
|
-
def
|
|
16
|
+
def format_md_with_jupytext(text: str, path_input_file: Path | None = None) -> str:
|
|
17
17
|
"""Format the code of a notebook code using jupytext"""
|
|
18
18
|
|
|
19
19
|
notebook = jupytext.reads(text, fmt="md:myst")
|
|
@@ -36,12 +36,17 @@ def format_str(text: str) -> str:
|
|
|
36
36
|
learning[a][b] = [s.strip() for s in learning[a][b].split(",")]
|
|
37
37
|
|
|
38
38
|
for cell in notebook.cells:
|
|
39
|
-
if
|
|
39
|
+
if (
|
|
40
|
+
language == "python"
|
|
41
|
+
and cell["cell_type"] == "code"
|
|
42
|
+
and cell["metadata"].get("format", True)
|
|
43
|
+
):
|
|
40
44
|
try:
|
|
41
45
|
cell.source = format_code_with_ruff(cell["source"].strip())
|
|
42
46
|
except RuffFormattingError as exc:
|
|
43
47
|
print(
|
|
44
|
-
f"Ruff formatting failed for
|
|
48
|
+
f"Ruff formatting failed for file\n{path_input_file or '???'}\n"
|
|
49
|
+
f"cell source:\n{cell.source}\n",
|
|
45
50
|
exc,
|
|
46
51
|
file=sys.stderr,
|
|
47
52
|
)
|
|
@@ -3,13 +3,13 @@ mdformat_myst_pef/__init__.py,sha256=aYAObHCbEiPg3WwadhJ_TB7SCk8bGlTTmNMO2tj1Q40
|
|
|
3
3
|
mdformat_myst_pef/_directives.py,sha256=gr9XXHeE1OpEPrUKZdy2S9iI4aQVgX4kO2UyhJlmSEk,4793
|
|
4
4
|
mdformat_myst_pef/plugin.py,sha256=fFqNG4UV_2aNSDYnJxbgV541K3qf7jQ53VMBSB1ktCU,7733
|
|
5
5
|
mdformat_myst_pef/py.typed,sha256=8PjyZ1aVoQpRVvt71muvuq5qE-jTFZkK-GLHkhdebmc,26
|
|
6
|
-
mdformat_py_edu_fr-0.1.
|
|
7
|
-
mdformat_py_edu_fr-0.1.
|
|
8
|
-
mdformat_py_edu_fr-0.1.
|
|
9
|
-
mdformat_py_edu_fr-0.1.
|
|
10
|
-
mdformat_py_edu_fr/__init__.py,sha256=
|
|
6
|
+
mdformat_py_edu_fr-0.1.8.dist-info/METADATA,sha256=a_9_q6sZwrT1mjDB7EqcJqoiimus_0GFKxBC_OKK5AA,1506
|
|
7
|
+
mdformat_py_edu_fr-0.1.8.dist-info/WHEEL,sha256=XavltlFgTGbuUtnh6QqpzgnrcFlEfDRGf5pyLtB4b10,104
|
|
8
|
+
mdformat_py_edu_fr-0.1.8.dist-info/entry_points.txt,sha256=dNsCwKXSNYQUbo19idpAR7WOLX6XiklUmMmb_Tfj7gs,149
|
|
9
|
+
mdformat_py_edu_fr-0.1.8.dist-info/licenses/LICENSE.txt,sha256=86p_CLJNsO7121AMS-JOKevnqSH4FKqOAbRPaf2Bu0U,1524
|
|
10
|
+
mdformat_py_edu_fr/__init__.py,sha256=l1_JIUAgbXQcn6voAW8CxSgmMWxGF8hfdnD09Q73pTo,3338
|
|
11
11
|
mdformat_py_edu_fr/__main__.py,sha256=SI9uVJaNxyo8MVoAzb2pJWdXszT-zdWl6afekldFn2c,2509
|
|
12
|
-
mdformat_py_edu_fr/format_with_jupytext.py,sha256
|
|
12
|
+
mdformat_py_edu_fr/format_with_jupytext.py,sha256=blASTXzHaBpcCMrW5-CcXsHYqMUdPFZn14uDJ90olR4,2531
|
|
13
13
|
mdformat_py_edu_fr/jupytext.toml,sha256=ZQwweaKSvIGXWw-lEwJfnzTPSbEqiGQjNmPBxsQVxmQ,872
|
|
14
14
|
mdformat_py_edu_fr/util_ruff.py,sha256=FDatJwUPcB3YElJmLfNfXh3ERzJyTIkikGigXGVb8Fw,647
|
|
15
|
-
mdformat_py_edu_fr-0.1.
|
|
15
|
+
mdformat_py_edu_fr-0.1.8.dist-info/RECORD,,
|
|
File without changes
|
{mdformat_py_edu_fr-0.1.6.dist-info → mdformat_py_edu_fr-0.1.8.dist-info}/licenses/LICENSE.txt
RENAMED
|
File without changes
|