Skip to content

Commit

Permalink
MAINT: Revert 92bb037 (#2961)
Browse files Browse the repository at this point in the history
Undo PR: 92bb037

According to our deprecation policy, we would have to issue a new major release for that change.
  • Loading branch information
j-t-1 authored Nov 21, 2024
1 parent bd5b962 commit ae1a179
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 8 deletions.
6 changes: 3 additions & 3 deletions pypdf/_doc_common.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@
from ._page import PageObject, _VirtualList
from ._page_labels import index2label as page_index2page_label
from ._utils import (
deprecation_with_replacement,
deprecate_with_replacement,
logger_warning,
parse_iso8824_date,
)
Expand Down Expand Up @@ -1281,10 +1281,10 @@ def decode_permissions(
self, permissions_code: int
) -> Dict[str, bool]: # pragma: no cover
"""Take the permissions as an integer, return the allowed access."""
deprecation_with_replacement(
deprecate_with_replacement(
old_name="decode_permissions",
new_name="user_access_permissions",
removed_in="6.0.0",
removed_in="5.0.0",
)

permissions_mapping = {
Expand Down
9 changes: 4 additions & 5 deletions tests/test_reader.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
from pypdf.constants import PageAttributes as PG
from pypdf.constants import UserAccessPermissions as UAP
from pypdf.errors import (
DeprecationError,
EmptyFileError,
FileNotDecryptedError,
PdfReadError,
Expand Down Expand Up @@ -746,16 +745,16 @@ def test_decode_permissions():
print_ = base.copy()
print_["print"] = True
with pytest.raises(
DeprecationError,
match="decode_permissions is deprecated and was removed in pypdf 6.0.0. Use user_access_permissions instead",
DeprecationWarning,
match="decode_permissions is deprecated and will be removed in pypdf 5.0.0. Use user_access_permissions instead", # noqa: E501
):
assert reader.decode_permissions(4) == print_

modify = base.copy()
modify["modify"] = True
with pytest.raises(
DeprecationError,
match="decode_permissions is deprecated and was removed in pypdf 6.0.0. Use user_access_permissions instead",
DeprecationWarning,
match="decode_permissions is deprecated and will be removed in pypdf 5.0.0. Use user_access_permissions instead", # noqa: E501
):
assert reader.decode_permissions(8) == modify

Expand Down

0 comments on commit ae1a179

Please sign in to comment.