From f893a6b991cbae74dbc38a1d0c919993a56bc122 Mon Sep 17 00:00:00 2001 From: j-t-1 <120829237+j-t-1@users.noreply.github.com> Date: Thu, 27 Jun 2024 18:23:55 +0100 Subject: [PATCH] =?UTF-8?q?MAINT:=20Add=20deprecate=5Fwith=5Freplacement?= =?UTF-8?q?=20to=20StreamObject.initializeFromD=E2=80=A6=20(#2728)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * MAINT: Add deprecate_with_replacement to StreamObject.initializeFromDictionary --- pypdf/generic/_data_structures.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/pypdf/generic/_data_structures.py b/pypdf/generic/_data_structures.py index 93ffbfa78..87d688674 100644 --- a/pypdf/generic/_data_structures.py +++ b/pypdf/generic/_data_structures.py @@ -903,10 +903,13 @@ def write_to_stream( stream.write(b"\nendstream") @staticmethod - def initializeFromDictionary( # TODO: mention when to deprecate + def initializeFromDictionary( data: Dict[str, Any] - ) -> Union["EncodedStreamObject", "DecodedStreamObject"]: # deprecated - return StreamObject.initialize_from_dictionary(data) + ) -> Union["EncodedStreamObject", "DecodedStreamObject"]: + deprecate_with_replacement( + "initializeFromDictionary", "initialize_from_dictionary", "5.0.0" + ) # pragma: no cover + return StreamObject.initialize_from_dictionary(data) # pragma: no cover @staticmethod def initialize_from_dictionary(