Browse Source

update pre-commit

main
Simon Conseil 1 month ago
parent
commit
19c006731e
  1. 2
      .github/workflows/python-tests.yml
  2. 2
      .pre-commit-config.yaml
  3. 4
      src/sigal/plugins/nonmedia_files.py
  4. 1
      tests/sample/pictures/nonmedia_files/dummy.txt
  5. 5
      tests/test_settings.py

2
.github/workflows/python-tests.yml

@ -28,7 +28,7 @@ jobs:
python-version: ${{ matrix.python-version }}
cache: 'pip'
cache-dependency-path: pyproject.toml
- name: Install FFmpeg & Poppler
- name: Install FFmpeg & Poppler
run: |
sudo apt update
sudo apt install ffmpeg poppler-utils

2
.pre-commit-config.yaml

@ -12,7 +12,7 @@ repos:
exclude: ".*(galleria|photoswipe|jquery|leaflet).*$"
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.14.1
rev: v0.15.0
hooks:
- id: ruff-check
args: [ --fix, --show-fixes, --exit-non-zero-on-fix ]

4
src/sigal/plugins/nonmedia_files.py

@ -119,7 +119,9 @@ def process_thumb(media):
if plugin_settings.get("ext_as_thumb", DEFAULT_CONFIG["ext_as_thumb"]):
if pdf2img and media.src_ext.lower() == ".pdf":
images = pdf2img(media.src_path, single_file=True, size=settings["thumb_size"])
images = pdf2img(
media.src_path, single_file=True, size=settings["thumb_size"]
)
images[0].save(media.thumb_path)
else:
kwargs = {}

1
tests/sample/pictures/nonmedia_files/dummy.txt

@ -1 +0,0 @@

5
tests/test_settings.py

@ -36,10 +36,7 @@ def test_img_sizes(tmpdir):
"""Test that image size is swaped if needed."""
conf = tmpdir.join("sigal.conf.py")
conf.write(
"img_size = (600, 800)\n"
"thumb_size = (150, 200)"
)
conf.write("img_size = (600, 800)\nthumb_size = (150, 200)")
settings = read_settings(str(conf))
assert settings["img_size"] == (800, 600)

Loading…
Cancel
Save