Skip to content

Commit 6a54e2f

Browse files
committed
Deprecate get_illustration_sizes() method
1 parent 1cc9e87 commit 6a54e2f

File tree

2 files changed

+12
-1
lines changed

2 files changed

+12
-1
lines changed

libzim/libzim.pyx

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ import os
3939
import pathlib
4040
import sys
4141
import traceback
42+
import warnings
4243
from collections import OrderedDict
4344
from types import ModuleType
4445
from typing import Dict, Generator, Iterator, List, Optional, Set, TextIO, Tuple, Union
@@ -1304,9 +1305,18 @@ cdef class Archive:
13041305
def get_illustration_sizes(self) -> Set[pyint]:
13051306
"""Sizes for which an illustration is available (@1 scale only).
13061307

1308+
.. deprecated:: 3.8.0
1309+
Use :meth:`get_illustration_infos` instead for full illustration metadata
1310+
including width, height, and scale information.
1311+
13071312
Returns:
13081313
The set of available sizes of the illustration.
13091314
"""
1315+
warnings.warn(
1316+
"get_illustration_sizes() is deprecated, use get_illustration_infos() instead",
1317+
DeprecationWarning,
1318+
stacklevel=2
1319+
)
13101320
return self.c_archive.getIllustrationSizes()
13111321
13121322
def has_illustration(self, size: pyint = None) -> pybool:

tests/test_libzim_creator.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -369,7 +369,8 @@ def test_creator_illustration(fpath, favicon_data):
369369
assert zim.has_illustration(128) is False
370370
assert bytes(zim.get_illustration_item().content) == favicon_data
371371
assert bytes(zim.get_illustration_item(96).content) == favicon_data
372-
assert zim.get_illustration_sizes() == {48, 96}
372+
with pytest.warns(DeprecationWarning, match="get_illustration_sizes.*deprecated"):
373+
assert zim.get_illustration_sizes() == {48, 96}
373374

374375

375376
def test_creator_additem(fpath, lipsum_item):

0 commit comments

Comments
 (0)