|
58 | 58 | StrByteType, |
59 | 59 | StreamType, |
60 | 60 | _get_max_pdf_version_header, |
61 | | - deprecate, |
62 | | - deprecate_no_replacement, |
63 | | - deprecation_with_replacement, |
| 61 | + deprecation_no_replacement, |
64 | 62 | logger_warning, |
65 | 63 | ) |
66 | 64 | from .constants import AnnotationDictionaryAttributes as AA |
@@ -377,12 +375,12 @@ def xmp_metadata(self, value: Optional[XmpInformation]) -> None: |
377 | 375 |
|
378 | 376 | @property |
379 | 377 | def with_as_usage(self) -> bool: |
380 | | - deprecate_no_replacement("with_as_usage", "6.0") |
| 378 | + deprecation_no_replacement("with_as_usage", "5.0") |
381 | 379 | return self._with_as_usage |
382 | 380 |
|
383 | 381 | @with_as_usage.setter |
384 | 382 | def with_as_usage(self, value: bool) -> None: |
385 | | - deprecate_no_replacement("with_as_usage", "6.0") |
| 383 | + deprecation_no_replacement("with_as_usage", "5.0") |
386 | 384 | self._with_as_usage = value |
387 | 385 |
|
388 | 386 | def __enter__(self) -> "PdfWriter": |
@@ -1426,10 +1424,6 @@ def write_stream(self, stream: StreamType) -> None: |
1426 | 1424 | "It may not be written to correctly.", |
1427 | 1425 | __name__, |
1428 | 1426 | ) |
1429 | | - # deprecated to be removed in pypdf 6.0.0 : |
1430 | | - # if not self._root: |
1431 | | - # self._root = self._add_object(self._root_object) |
1432 | | - # self._sweep_indirect_references(self._root) |
1433 | 1427 | self._resolve_links() |
1434 | 1428 |
|
1435 | 1429 | if self.incremental: |
@@ -1754,74 +1748,6 @@ def replace_in_obj( |
1754 | 1748 | for i in compress(range(len(self._objects)), orphans): |
1755 | 1749 | self._objects[i] = None |
1756 | 1750 |
|
1757 | | - def _sweep_indirect_references( |
1758 | | - self, |
1759 | | - root: Union[ |
1760 | | - ArrayObject, |
1761 | | - BooleanObject, |
1762 | | - DictionaryObject, |
1763 | | - FloatObject, |
1764 | | - IndirectObject, |
1765 | | - NameObject, |
1766 | | - PdfObject, |
1767 | | - NumberObject, |
1768 | | - TextStringObject, |
1769 | | - NullObject, |
1770 | | - ], |
1771 | | - ) -> None: # deprecated |
1772 | | - """ |
1773 | | - Resolving any circular references to Page objects. |
1774 | | -
|
1775 | | - Circular references to Page objects can arise when objects such as |
1776 | | - annotations refer to their associated page. If these references are not |
1777 | | - properly handled, the PDF file will contain multiple copies of the same |
1778 | | - Page object. To address this problem, Page objects store their original |
1779 | | - object reference number. This method adds the reference number of any |
1780 | | - circularly referenced Page objects to an external reference map. This |
1781 | | - ensures that self-referencing trees reference the correct new object |
1782 | | - location, rather than copying in a new copy of the Page object. |
1783 | | -
|
1784 | | - Args: |
1785 | | - root: The root of the PDF object tree to sweep. |
1786 | | -
|
1787 | | - """ |
1788 | | - deprecate( |
1789 | | - "_sweep_indirect_references has been removed, please report to dev team if this warning is observed", |
1790 | | - ) |
1791 | | - |
1792 | | - def _resolve_indirect_object( |
1793 | | - self, data: IndirectObject |
1794 | | - ) -> IndirectObject: # deprecated |
1795 | | - """ |
1796 | | - Resolves an indirect object to an indirect object in this PDF file. |
1797 | | -
|
1798 | | - If the input indirect object already belongs to this PDF file, it is |
1799 | | - returned directly. Otherwise, the object is retrieved from the input |
1800 | | - object's PDF file using the object's ID number and generation number. If |
1801 | | - the object cannot be found, a warning is logged and a `NullObject` is |
1802 | | - returned. |
1803 | | -
|
1804 | | - If the object is not already in this PDF file, it is added to the file's |
1805 | | - list of objects and assigned a new ID number and generation number of 0. |
1806 | | - The hash value of the object is then added to the `_idnum_hash` |
1807 | | - dictionary, with the corresponding `IndirectObject` reference as the |
1808 | | - value. |
1809 | | -
|
1810 | | - Args: |
1811 | | - data: The `IndirectObject` to resolve. |
1812 | | -
|
1813 | | - Returns: |
1814 | | - The resolved `IndirectObject` in this PDF file. |
1815 | | -
|
1816 | | - Raises: |
1817 | | - ValueError: If the input stream is closed. |
1818 | | -
|
1819 | | - """ |
1820 | | - deprecate( |
1821 | | - "_resolve_indirect_object has been removed, please report to dev team if this warning is observed", |
1822 | | - ) |
1823 | | - return IndirectObject(0, 0, self) |
1824 | | - |
1825 | 1751 | def get_reference(self, obj: PdfObject) -> IndirectObject: |
1826 | 1752 | idnum = self._objects.index(obj) + 1 |
1827 | 1753 | ref = IndirectObject(idnum, 0, self) |
@@ -3255,17 +3181,6 @@ def find_outline_item( |
3255 | 3181 | else: |
3256 | 3182 | return None |
3257 | 3183 |
|
3258 | | - def find_bookmark( |
3259 | | - self, |
3260 | | - outline_item: dict[str, Any], |
3261 | | - root: Optional[OutlineType] = None, |
3262 | | - ) -> None: # deprecated |
3263 | | - """ |
3264 | | - .. deprecated:: 2.9.0 |
3265 | | - Use :meth:`find_outline_item` instead. |
3266 | | - """ |
3267 | | - deprecation_with_replacement("find_bookmark", "find_outline_item", "5.0.0") |
3268 | | - |
3269 | 3184 | def reset_translation( |
3270 | 3185 | self, reader: Union[None, PdfReader, IndirectObject] = None |
3271 | 3186 | ) -> None: |
|
0 commit comments