From aef1917a668ca9f3cd26373d1d69bcb5001108cc Mon Sep 17 00:00:00 2001 From: Kernc Date: Sat, 23 Jan 2021 12:15:01 +0100 Subject: [PATCH] MNT: Fix CI with mypy 0.800 Namely improvements to finding namespace modules (failing test pdoc.test.ApiTest.test_namespace): https://mypy-lang.blogspot.com/2021/01/mypy-0800-released.html https://github.com/python/mypy/issues/4675#issuecomment-765600702 --- .github/workflows/ci.yml | 2 +- pdoc/html_helpers.py | 16 ++++++++-------- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index b03d6608..63cb61dd 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -59,7 +59,7 @@ jobs: run: | find -name '*.md' | xargs .github/lint-markdown.sh flake8 - mypy pdoc + mypy -p pdoc time coverage run -m unittest -v pdoc.test PDOC_TEST_PANDOC=1 time catchsegv python -m unittest -v pdoc.test.CliTest.test_pdf_pandoc bash <(curl -s https://codecov.io/bash) diff --git a/pdoc/html_helpers.py b/pdoc/html_helpers.py index 39d6d9b9..d552cb9a 100644 --- a/pdoc/html_helpers.py +++ b/pdoc/html_helpers.py @@ -84,10 +84,10 @@ def glimpse(text: str, max_length=153, *, paragraph=True, ], extension_configs={ "markdown.extensions.smarty": dict( - smart_dashes=True, # type: ignore[dict-item] - smart_ellipses=True, # type: ignore[dict-item] - smart_quotes=False, # type: ignore[dict-item] - smart_angled_quotes=False, # type: ignore[dict-item] + smart_dashes=True, + smart_ellipses=True, + smart_quotes=False, + smart_angled_quotes=False, ), }, ) @@ -417,10 +417,10 @@ def to_html(text: str, *, example template. """ # Optionally register our math syntax processor - if not latex_math and _MathPattern.NAME in _md.inlinePatterns: # type: ignore - _md.inlinePatterns.deregister(_MathPattern.NAME) # type: ignore - elif latex_math and _MathPattern.NAME not in _md.inlinePatterns: # type: ignore - _md.inlinePatterns.register(_MathPattern(_MathPattern.PATTERN), # type: ignore + if not latex_math and _MathPattern.NAME in _md.inlinePatterns: + _md.inlinePatterns.deregister(_MathPattern.NAME) + elif latex_math and _MathPattern.NAME not in _md.inlinePatterns: + _md.inlinePatterns.register(_MathPattern(_MathPattern.PATTERN), _MathPattern.NAME, _MathPattern.PRIORITY)