fotolab 0.31.13__tar.gz → 0.31.15__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: fotolab
3
- Version: 0.31.13
3
+ Version: 0.31.15
4
4
  Summary: A console program that manipulate images.
5
5
  Keywords: photography,photo
6
6
  Author-email: Kian-Meng Ang <kianmeng@cpan.org>
@@ -18,6 +18,7 @@
18
18
  import argparse
19
19
  import logging
20
20
  from pathlib import Path
21
+ from contextlib import ExitStack
21
22
 
22
23
  from PIL import Image
23
24
 
@@ -150,14 +151,13 @@ def run(args: argparse.Namespace) -> None:
150
151
  log.debug(args)
151
152
 
152
153
  first_image_filepath = args.image_filenames[0]
153
- main_frame = None
154
154
  other_frames = []
155
155
 
156
- try:
157
- main_frame = Image.open(first_image_filepath)
156
+ with ExitStack() as stack:
157
+ main_frame = stack.enter_context(Image.open(first_image_filepath))
158
158
 
159
159
  for image_filename in args.image_filenames[1:]:
160
- img = Image.open(image_filename)
160
+ img = stack.enter_context(Image.open(image_filename))
161
161
  other_frames.append(img)
162
162
 
163
163
  image_file = Path(first_image_filepath)
@@ -188,11 +188,6 @@ def run(args: argparse.Namespace) -> None:
188
188
  save_kwargs["method"] = args.webp_method
189
189
 
190
190
  main_frame.save(new_filename, **save_kwargs)
191
- finally:
192
- if main_frame:
193
- main_frame.close()
194
- for frame in other_frames:
195
- frame.close()
196
191
 
197
192
  if args.open:
198
193
  _open_image(new_filename)
@@ -20,7 +20,7 @@ classifiers = [
20
20
  "Programming Language :: Python :: 3.13",
21
21
  "Programming Language :: Python",
22
22
  ]
23
- version = "0.31.13"
23
+ version = "0.31.15"
24
24
  dynamic = ["description"]
25
25
  keywords = ["photography", "photo"]
26
26
  dependencies = [
@@ -54,3 +54,7 @@ dev = [
54
54
  "sphinx-copybutton",
55
55
  "tomli",
56
56
  ]
57
+
58
+ # verify through: uv run ruff check --show-settings
59
+ [tool.ruff]
60
+ line-length = 79
File without changes
File without changes
File without changes
File without changes
File without changes