-
Notifications
You must be signed in to change notification settings - Fork 1.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Inconsistent usage of warnings #2354
Comments
My suggestion would be to wait two more weeks (until next year). Then we will remove quite a bit of deprecated code. This will make it easier to find inconsistencies - which we should fix before the release! |
I've just merged #2367 The remaining warnings are: Mainly the deprecate / deprecate_with_replacement, but also |
The @stefan6419846 In #2356 you mention that warning. Do you think an Exception would have been better? I guess the effect was that a part of the text was not extracted, right? |
I personally do not have a strong opinion about whether this should be an exception or not. For my use case (basically identifying empty PDF files), The use-case or criticality of the error most likely differs for other locales and use-cases, although I would argue that |
Maybe that would even be a good case for logging.Error:
|
warnings.warn
is currently not being used in a consistent manner:pypdf._utils.deprecate
andpypdf._utils.deprecation
, but some places use plainwarnings.warn
with theDeprecationWarning
category.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.warn
with a different category. I am not sure whether they are eligble for converting them tologger_warning
instead 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.
The text was updated successfully, but these errors were encountered: