warnings.warn is currently not being used in a consistent manner:
- There is
pypdf._utils.deprecate and pypdf._utils.deprecation, but some places use plain warnings.warn with the DeprecationWarning category.
|
warnings.warn( |
|
"The parameter 'ido' is depreciated and will be removed in " |
|
"pypdf 4.0.0.", |
|
DeprecationWarning, |
|
) |
|
warnings.warn( |
|
"Please use 'user_password' instead of 'user_pwd'. " |
|
"The 'user_pwd' argument is deprecated and " |
|
"will be removed in pypdf 4.0.0." |
|
) |
|
warnings.warn( |
|
message=( |
|
f"{old_term} is deprecated as an argument and will be " |
|
f"removed in pypdf 4.0.0. Use {new_term} instead" |
|
), |
|
category=DeprecationWarning, |
|
) |
|
warnings.warn( |
|
message=( |
|
f"{old_term} is deprecated as an argument and will be " |
|
f"removed in pypdf 4.0.0. Use {new_term} instead" |
|
), |
|
category=DeprecationWarning, |
|
) |
|
warnings.warn( |
|
message=( |
|
f"{old_term} is deprecated as an argument and will be " |
|
f"removed in pypdf 4.0.0. Use {new_term} instead" |
|
), |
|
category=DeprecationWarning, |
|
) |
|
warnings.warn( |
|
message=( |
|
f"{old_term} is deprecated as an argument and will be " |
|
f"removed in pypdf 4.0.0. Use {new_term} instead" |
|
), |
|
category=DeprecationWarning, |
|
) |
|
warnings.warn( |
|
"The 'ignore_byte_string_object' argument of remove_images is " |
|
"deprecated and will be removed in pypdf 4.0.0.", |
|
category=DeprecationWarning, |
|
) |
|
warnings.warn( |
|
"The 'ignore_byte_string_object' argument of remove_images is " |
|
"deprecated and will be removed in pypdf 4.0.0.", |
|
category=DeprecationWarning, |
|
) |
|
warnings.warn( |
|
"The 'pagenum' argument of add_uri is deprecated and will be " |
|
"removed in pypdf 4.0.0. Use 'page_number' instead.", |
|
category=DeprecationWarning, |
|
) |
|
warnings.warn( |
|
( |
|
"indirect_ref is deprecated and will be removed in " |
|
"pypdf 4.0.0. Use indirect_reference instead of indirect_ref." |
|
), |
|
DeprecationWarning, |
|
) |
|
warnings.warn( |
|
( |
|
"indirect_ref is deprecated and will be removed in pypdf 4.0.0" |
|
"Use indirect_reference instead of indirect_ref." |
|
), |
|
DeprecationWarning, |
|
) |
|
warnings.warn( |
|
"parameters Tj_Sep, TJ_sep depreciated, and will be removed in pypdf 4.0.0.", |
|
DeprecationWarning, |
|
) |
|
warnings.warn( |
|
( |
|
f"{old_term} is deprecated as an argument and will be " |
|
f"removed in pypdf=4.0.0. Use {new_term} instead" |
|
), |
|
DeprecationWarning, |
|
) |
|
warnings.warn( |
|
( |
|
f"{old_term} is deprecated as an argument and will be " |
|
f"removed in pypdf==4.0.0. Use {new_term} instead" |
|
), |
|
DeprecationWarning, |
|
) |
|
warnings.warn( |
|
( |
|
f"{old_term} is deprecated as an argument and will be " |
|
f"removed in pypdf==4.0.0. Use {new_term} instead" |
|
), |
|
DeprecationWarning, |
|
) |
- There are some plain
warnings.warn with a different category. I am not sure whether they are eligble for converting them to logger_warning instead as there is not much which can be done on the user side anyway (besides submitting a PR to implement it ;)):
|
warnings.warn( |
|
f"Advanced encoding {enc} not implemented yet", |
|
PdfReadWarning, |
|
) |
|
warnings.warn( |
|
f"Advanced encoding {encoding} not implemented yet", |
|
PdfReadWarning, |
|
) |
I would like to see this harmonized and I am open to submit a corresponding PR for this.
warnings.warnis currently not being used in a consistent manner:pypdf._utils.deprecateandpypdf._utils.deprecation, but some places use plainwarnings.warnwith theDeprecationWarningcategory.pypdf/pypdf/_writer.py
Lines 274 to 278 in 908797f
pypdf/pypdf/_writer.py
Lines 1286 to 1290 in 908797f
pypdf/pypdf/_writer.py
Lines 1305 to 1311 in 908797f
pypdf/pypdf/_writer.py
Lines 1745 to 1751 in 908797f
pypdf/pypdf/_writer.py
Lines 2038 to 2044 in 908797f
pypdf/pypdf/_writer.py
Lines 2083 to 2089 in 908797f
pypdf/pypdf/_writer.py
Lines 2321 to 2325 in 908797f
pypdf/pypdf/_writer.py
Lines 2363 to 2367 in 908797f
pypdf/pypdf/_writer.py
Lines 2405 to 2409 in 908797f
pypdf/pypdf/_page.py
Lines 361 to 367 in 908797f
pypdf/pypdf/_page.py
Lines 375 to 381 in 908797f
pypdf/pypdf/_page.py
Lines 2281 to 2284 in 908797f
pypdf/pypdf/_merger.py
Lines 163 to 169 in 908797f
pypdf/pypdf/_merger.py
Lines 702 to 708 in 908797f
pypdf/pypdf/_merger.py
Lines 809 to 815 in 908797f
warnings.warnwith a different category. I am not sure whether they are eligble for converting them tologger_warninginstead as there is not much which can be done on the user side anyway (besides submitting a PR to implement it ;)):pypdf/pypdf/_cmap.py
Lines 183 to 186 in 908797f
pypdf/pypdf/_cmap.py
Lines 192 to 195 in 908797f
I would like to see this harmonized and I am open to submit a corresponding PR for this.