Skip to content

Commit 63b94fa

Browse files
committed
Deprecate get_illustration_sizes() method
1 parent d1d6124 commit 63b94fa

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
@@ -1305,9 +1306,18 @@ cdef class Archive:
13051306
def get_illustration_sizes(self) -> Set[pyint]:
13061307
"""Sizes for which an illustration is available (@1 scale only).
13071308

1309+
.. deprecated:: 3.8.0
1310+
Use :meth:`get_illustration_infos` instead for full illustration metadata
1311+
including width, height, and scale information.
1312+
13081313
Returns:
13091314
The set of available sizes of the illustration.
13101315
"""
1316+
warnings.warn(
1317+
"get_illustration_sizes() is deprecated, use get_illustration_infos() instead",
1318+
DeprecationWarning,
1319+
stacklevel=2
1320+
)
13111321
return self.c_archive.getIllustrationSizes()
13121322
13131323
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
@@ -357,7 +357,8 @@ def test_creator_illustration(fpath, favicon_data):
357357
assert zim.has_illustration(128) is False
358358
assert bytes(zim.get_illustration_item().content) == favicon_data
359359
assert bytes(zim.get_illustration_item(96).content) == favicon_data
360-
assert zim.get_illustration_sizes() == {48, 96}
360+
with pytest.warns(DeprecationWarning, match="get_illustration_sizes.*deprecated"):
361+
assert zim.get_illustration_sizes() == {48, 96}
361362

362363

363364
def test_creator_additem(fpath, lipsum_item):

0 commit comments

Comments
 (0)