Skip to content

Commit 4733227

Browse files
fmigneaultmr-c
andauthored
update mistune to more recent version (#619)
* gitignore ./mypy_cache, .coverage, coverage.xml,pydocstyle_report.txt * fix mypy-stubs for mistune * use mypy.ini to share enable_recursive_aliases between mypy and mypyc calls * split pyproject.toml build-system requirements multi-line for better readability * add mistune pre-hook to handle problematic markdown lists (relates to lepture/mistune#296) * add tests for expected schema-salad-doc output * add make utilities to compute new hash and check html diff * fix missing newline in code sample & update metaschema-pre.yml with extra newline * align mismatchign mypy-requirements.txt / pyproject.toml mypy version * normalize use of get_data() in tests Co-authored-by: Michael R. Crusoe <[email protected]>
1 parent 567665f commit 4733227

26 files changed

+1052
-224
lines changed

.dockerignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
.coverage
22
coverage.xml
3+
pydocstyle_report.txt
34
.tox/
45
.eggs/
56
.vscode/

.gitignore

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,19 @@
22
.eggs
33
*.egg-info/
44
*pyc
5+
*.so
56

67
build/
78
dist/
89
mypy-stubs/ruamel/yaml
9-
# virtualenv
10+
# virtualenv
1011
venv/
1112
.cache/
13+
.mypy_cache/
1214
.pytest_cache/
15+
.coverage
16+
coverage.xml
17+
pydocstyle_report.txt
1318

1419
# PyCharm
1520
.idea/

Makefile

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -185,6 +185,23 @@ mypy_3.6: $(filter-out setup.py,$(PYSOURCES))
185185
mypyc: $(PYSOURCES)
186186
MYPYPATH=mypy-stubs SCHEMA_SALAD_USE_MYPYC=1 python setup.py test
187187

188+
mypyi:
189+
MYPYPATH=mypy-stubs SCHEMA_SALAD_USE_MYPYC=1 python setup.py install
190+
191+
check-metaschema-diff:
192+
docker run \
193+
-v "$(realpath ${MODULE}/metaschema/):/tmp/:ro" \
194+
"quay.io/commonwl/cwltool_module:latest" \
195+
schema-salad-doc /tmp/metaschema.yml \
196+
> /tmp/metaschema.orig.html
197+
schema-salad-doc \
198+
"$(realpath ${MODULE}/metaschema/metaschema.yml)" \
199+
> /tmp/metaschema.new.html
200+
diff -a --color /tmp/metaschema.orig.html /tmp/metaschema.new.html || true
201+
202+
compute-metaschema-hash:
203+
@python -c 'import hashlib; from schema_salad.tests.test_makedoc import generate_doc; hasher = hashlib.sha256(); hasher.update(generate_doc().encode("utf-8")); print(hasher.hexdigest());'
204+
188205
shellcheck: FORCE
189206
shellcheck build-schema_salad-docker.sh release-test.sh
190207

mypy-stubs/mistune.pyi

Lines changed: 0 additions & 197 deletions
This file was deleted.

mypy-stubs/mistune/__init__.pyi

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
from typing import Iterable, Optional, Union
2+
3+
from mistune._types import *
4+
from mistune.inline_parser import RendererT
5+
from mistune.markdown import Markdown, ParseHook, RenderHook
6+
from mistune.plugins import Plugin, PluginName
7+
from mistune.renderers import BaseRenderer, DataT, HTMLRenderer, HTMLType
8+
from typing_extensions import Literal
9+
10+
html: Markdown[HTMLType, HTMLRenderer]
11+
12+
RendererRef = Union[Literal["html", "ast"], BaseRenderer[DataT]]
13+
PluginRef = Union[PluginName, Plugin] # reference to register a plugin
14+
15+
def create_markdown(
16+
escape: bool = False,
17+
hard_wrap: bool = False,
18+
renderer: Optional[RendererRef[DataT]] = None,
19+
plugins: Optional[Iterable[PluginRef]] = None,
20+
) -> Markdown[DataT, RendererT]: ...
21+
def markdown(
22+
text: str,
23+
escape: bool = True,
24+
renderer: Optional[BaseRenderer[DataT]] = None,
25+
plugins: Optional[Iterable[PluginRef]] = None,
26+
) -> str: ...
27+
28+
__version__: str

mypy-stubs/mistune/_types.pyi

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
from typing import Any, Dict, List
2+
3+
# type aliases shared across modules
4+
State = Dict[str, Any] # extra options that work with a given 'ParsedType'
5+
Tokens = List[str]

0 commit comments

Comments
 (0)