Skip to content

Commit

Permalink
Merge pull request #38 from spraakbanken/37-unneccesary
Browse files Browse the repository at this point in the history
Remove unneccessary branch in compute_map
  • Loading branch information
kod-kristoff authored Apr 29, 2024
2 parents 12201d7 + a92d372 commit db573ab
Show file tree
Hide file tree
Showing 7 changed files with 32 additions and 17 deletions.
2 changes: 0 additions & 2 deletions .github/workflows/check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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:
Expand Down
3 changes: 1 addition & 2 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,6 @@ jobs:
os: [ubuntu]

runs-on: ${{ matrix.os }}-latest
continue-on-error: true
env:
OS: ${{ matrix.os }}-latest
steps:
Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -179,4 +177,5 @@ jobs:
uses: re-actors/alls-green@release/v1
with:
jobs: ${{ toJSON(needs) }}
allowed-failures: doctests, minimal

7 changes: 7 additions & 0 deletions mypy.ini
Original file line number Diff line number Diff line change
@@ -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
13 changes: 12 additions & 1 deletion pdm.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -32,4 +32,5 @@ dev = [
"ruff>=0.4.2",
"mypy>=1.4.1",
"syrupy>=3.0.6",
"types-markdown>=3.5.0.3",
]
21 changes: 10 additions & 11 deletions skbl/computeviews.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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"],
Expand Down Expand Up @@ -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(
Expand Down
2 changes: 1 addition & 1 deletion skbl/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit db573ab

Please sign in to comment.