Skip to content

Commit 6928b20

Browse files
committed
Make get_digests() emit a DeprecationWarning
1 parent 1878fbe commit 6928b20

File tree

2 files changed

+8
-0
lines changed

2 files changed

+8
-0
lines changed

src/pypi_simple/classes.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import re
22
from typing import Any, Dict, List, NamedTuple, Optional, Union
33
from urllib.parse import urlparse, urlunparse
4+
from warnings import warn
45
from .filenames import parse_filename
56
from .util import basejoin
67

@@ -144,6 +145,11 @@ def get_digests(self) -> Dict[str, str]:
144145
145146
Use `digests` instead
146147
"""
148+
warn(
149+
"The get_digests() method is deprecated. Use the `digests`"
150+
" attribute instead.",
151+
DeprecationWarning,
152+
)
147153
return self.digests
148154

149155
@classmethod

test/test_distrib_pkg.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,8 @@ def test_from_link_digests() -> None:
3434
assert pkg.digests == {
3535
"sha256": "da69d28dcd527c0e372b3fa7b92fc333b327f8470175f035abc4e351b539189f"
3636
}
37+
with pytest.deprecated_call():
38+
assert pkg.get_digests() is pkg.digests
3739

3840

3941
@pytest.mark.parametrize("has_sig", [True, False])

0 commit comments

Comments
 (0)