diff --git a/.github/workflows/check.yml b/.github/workflows/check.yml index 845fefd..a8d9a49 100644 --- a/.github/workflows/check.yml +++ b/.github/workflows/check.yml @@ -50,7 +50,6 @@ jobs: lint: runs-on: ubuntu-latest name: ubuntu / 3.8 / lint - continue-on-error: true steps: - uses: actions/checkout@v4 with: @@ -74,7 +73,6 @@ jobs: type-check: runs-on: ubuntu-latest name: ubuntu / 3.8 / type-check - continue-on-error: true steps: - uses: actions/checkout@v4 with: diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 95e2ddb..b496cdc 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -92,7 +92,6 @@ jobs: os: [ubuntu] runs-on: ${{ matrix.os }}-latest - continue-on-error: true env: OS: ${{ matrix.os }}-latest steps: @@ -147,7 +146,6 @@ jobs: runs-on: ubuntu-latest name: ubuntu / 3.8 / minimal-versions - continue-on-error: true steps: - uses: actions/checkout@v4 with: @@ -179,4 +177,5 @@ jobs: uses: re-actors/alls-green@release/v1 with: jobs: ${{ toJSON(needs) }} + allowed-failures: doctests, minimal diff --git a/mypy.ini b/mypy.ini new file mode 100644 index 0000000..9a02ea9 --- /dev/null +++ b/mypy.ini @@ -0,0 +1,7 @@ +[mypy] +mypy_path = . +# namespace_packages = True +explicit_package_bases = True +show_error_codes = True +ignore_missing_imports = True +# plugins = pydantic.mypy diff --git a/pdm.lock b/pdm.lock index 6f2ee41..292c1fc 100644 --- a/pdm.lock +++ b/pdm.lock @@ -5,7 +5,7 @@ groups = ["default", "dev"] strategy = ["cross_platform", "inherit_metadata"] lock_version = "4.4.1" -content_hash = "sha256:3e86d07a889f1c9f516b977ddddbf7d01773cf4b89e44ffa2254242a94487cf9" +content_hash = "sha256:9366568a4f617942f5b381e4432791844e1edf7fc16a3415a4e53961a3f3ea44" [[package]] name = "babel" @@ -874,6 +874,17 @@ files = [ {file = "typed_ast-1.5.5.tar.gz", hash = "sha256:94282f7a354f36ef5dbce0ef3467ebf6a258e370ab33d5b40c249fa996e590dd"}, ] +[[package]] +name = "types-markdown" +version = "3.5.0.3" +requires_python = ">=3.7" +summary = "Typing stubs for Markdown" +groups = ["dev"] +files = [ + {file = "types-Markdown-3.5.0.3.tar.gz", hash = "sha256:9afd38a8f53e19d43de3f8d89742b3674b5736767806ed9356d64ccb09f76439"}, + {file = "types_Markdown-3.5.0.3-py3-none-any.whl", hash = "sha256:2299b9086c695f408a3ebabf820f1fba3b239f1b3bfdbb32bf42d530b42cdd83"}, +] + [[package]] name = "typing-extensions" version = "4.7.1" diff --git a/pyproject.toml b/pyproject.toml index 2ab99a6..7718949 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -32,4 +32,5 @@ dev = [ "ruff>=0.4.2", "mypy>=1.4.1", "syrupy>=3.0.6", + "types-markdown>=3.5.0.3", ] diff --git a/skbl/computeviews.py b/skbl/computeviews.py index 7302de0..0f90b50 100644 --- a/skbl/computeviews.py +++ b/skbl/computeviews.py @@ -229,7 +229,7 @@ def compute_activity(lang="", cache=True, url=""): return art -def compute_article(lang="", cache=True, url="", map=False): +def compute_article(lang="", url="", *, cache=True, with_map=False): """Compute article view.""" helpers.set_language_switch_link("article_index", lang=lang) art, lang = getcache("article", lang, cache) @@ -269,7 +269,7 @@ def compute_article(lang="", cache=True, url="", map=False): mode=current_app.config["SKBL_LINKS"], ) - if map: + if with_map: art = render_template( "map.html", hits=data["hits"], @@ -342,15 +342,14 @@ def compute_map(lang="", cache=True, url=""): mode=current_app.config["KARP_MODE"], ) - if map: - art = render_template( - "map.html", - hits=data["hits"], - headline=gettext("Map"), - infotext=infotext, - title="Map", - page_url=url, - ) + art = render_template( + "map.html", + hits=data["hits"], + headline=gettext("Map"), + infotext=infotext, + title="Map", + page_url=url, + ) try: with g.mc_pool.reserve() as client: client.set( diff --git a/skbl/views.py b/skbl/views.py index b562e9f..f17169d 100644 --- a/skbl/views.py +++ b/skbl/views.py @@ -651,7 +651,7 @@ def show_article(data, lang="sv"): source["furtherreference"] = helpers.aggregate_by_type( source["furtherreference"], use_markdown=True ) - if type(source["article_author"]) != list: + if not isinstance(source["article_author"], list): source["article_author"] = [source["article_author"]] # Set description for meta data