Skip to content

Commit

Permalink
update pre-commit
Browse files Browse the repository at this point in the history
  • Loading branch information
saimn committed Dec 16, 2024
1 parent 906aa8a commit 73d4bb2
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 9 deletions.
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ repos:
exclude: ".*(galleria|photoswipe|jquery|leaflet).*$"

- repo: https://github.com/charliermarsh/ruff-pre-commit
rev: v0.7.4
rev: v0.8.3
hooks:
- id: ruff
args: [ --fix, --show-fixes, --exit-non-zero-on-fix ]
Expand Down
6 changes: 3 additions & 3 deletions src/sigal/gallery.py
Original file line number Diff line number Diff line change
Expand Up @@ -781,15 +781,15 @@ def __init__(self, settings, ncpu=None, show_progress=False):

with progressbar(
albums.values(),
label="%16s" % "Sorting albums",
label="{:>16s}".format("Sorting albums"),
file=self.progressbar_target,
) as progress_albums:
for album in progress_albums:
album.sort_subdirs(settings["albums_sort_attr"])

with progressbar(
albums.values(),
label="%16s" % "Sorting media",
label="{:>16s}".format("Sorting medias"),
file=self.progressbar_target,
) as progress_albums:
for album in progress_albums:
Expand Down Expand Up @@ -911,7 +911,7 @@ def log_func(x):
)
with progressbar(
self.albums.values(),
label="%16s" % "Writing files",
label="{:>16s}".format("Writing files"),
item_show_func=log_func,
show_eta=False,
file=self.progressbar_target,
Expand Down
2 changes: 1 addition & 1 deletion src/sigal/plugins/encrypt/encrypt.py
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,7 @@ def encrypt_files(settings, config, cache, albums, progressbar_target):
medias = list(chain.from_iterable(albums.values()))
with progressbar(
medias,
label="%16s" % "Encrypting files",
label="{:>16s}".format("Encrypting files"),
file=progressbar_target,
show_eta=True,
) as medias:
Expand Down
4 changes: 2 additions & 2 deletions src/sigal/plugins/encrypt/endec.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ def wrapper(args):

def encrypt(key: bytes, infile: BinaryIO, outfile: BinaryIO, tag: bytes):
if len(key) != 128 / 8:
raise ValueError("Unsupported key length: %d" % len(key))
raise ValueError(f"Unsupported key length: {len(key)}")
aesgcm = AESGCM(key)
iv = os.urandom(12)
plaintext = infile
Expand All @@ -80,7 +80,7 @@ def encrypt(key: bytes, infile: BinaryIO, outfile: BinaryIO, tag: bytes):

def decrypt(key: bytes, infile: BinaryIO, outfile: BinaryIO, tag: bytes):
if len(key) != 128 / 8:
raise ValueError("Unsupported key length: %d" % len(key))
raise ValueError(f"Unsupported key length: {len(key)}")
aesgcm = AESGCM(key)
ciphertext = infile
plaintext = outfile
Expand Down
4 changes: 2 additions & 2 deletions src/sigal/video.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,10 +98,10 @@ def get_resize_options(source, converter, output_size):
# + I made a drawing on paper to figure this out
if h_dst * w_src < h_src * w_dst:
# biggest fitting dimension is height
resize_opt = ["-vf", "scale=trunc(oh*a/2)*2:%i" % h_dst]
resize_opt = ["-vf", f"scale=trunc(oh*a/2)*2:{h_dst:d}"]
else:
# biggest fitting dimension is width
resize_opt = ["-vf", "scale=%i:trunc(ow/a/2)*2" % w_dst]
resize_opt = ["-vf", f"scale={w_dst:d}:trunc(ow/a/2)*2"]

return resize_opt

Expand Down

0 comments on commit 73d4bb2

Please sign in to comment.