Filter rl_safe_eval deprecation warning

Full message
eportlab/lib/rl_safe_eval.py:11: DeprecationWarning: ast.NameConstant is deprecated and will be removed in Python 3.14; use ast.Constant instead
    haveNameConstant = hasattr(ast,'NameConstant')

Warning triggered by reportlab-4.0.7 and Python 3.12
This commit is contained in:
James R. Barlow
2023-12-07 23:40:23 -08:00
parent 39eee05230
commit a4987733c4
3 changed files with 15 additions and 0 deletions
+5
View File
@@ -4,6 +4,7 @@
from __future__ import annotations
import pickle
import warnings
from io import BytesIO
from math import isclose
@@ -20,6 +21,10 @@ from ocrmypdf.helpers import IMG2PDF_KWARGS, Resolution
from ocrmypdf.pdfinfo import Colorspace, Encoding
from ocrmypdf.pdfinfo.layout import PDFPage
warnings.filterwarnings(
"ignore", category=DeprecationWarning, module="reportlab.lib.rl_safe_eval"
)
# pylint: disable=protected-access
+5
View File
@@ -3,6 +3,7 @@
from __future__ import annotations
import warnings
from unittest.mock import Mock
import pytest
@@ -14,6 +15,10 @@ from reportlab.pdfgen.canvas import Canvas
from ocrmypdf import _pipeline, pdfinfo
from ocrmypdf.helpers import Resolution
warnings.filterwarnings(
"ignore", category=DeprecationWarning, module="reportlab.lib.rl_safe_eval"
)
@pytest.fixture(scope='session')
def rgb_image():
+5
View File
@@ -4,6 +4,7 @@
from __future__ import annotations
import operator
import warnings
from io import BytesIO
from math import cos, pi, sin
from os import fspath
@@ -21,6 +22,10 @@ from ocrmypdf.pdfinfo import PdfInfo
from .conftest import check_ocrmypdf, run_ocrmypdf_api
warnings.filterwarnings(
"ignore", category=DeprecationWarning, module="reportlab.lib.rl_safe_eval"
)
# pylintx: disable=unused-variable
RENDERERS = ['hocr', 'sandwich']