From 3e88ed94382c8b11f781c87b31743ee972f7b973 Mon Sep 17 00:00:00 2001 From: Jan Petykiewicz Date: Thu, 30 Oct 2025 01:15:44 -0700 Subject: [PATCH] [file.svg] use logger.warning over warnings.warn (for flexibility) --- masque/file/svg.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/masque/file/svg.py b/masque/file/svg.py index 148f6d4..859c074 100644 --- a/masque/file/svg.py +++ b/masque/file/svg.py @@ -2,7 +2,7 @@ SVG file format readers and writers """ from collections.abc import Mapping -import warnings +import logging import numpy from numpy.typing import ArrayLike @@ -12,6 +12,9 @@ from .utils import mangle_name from .. import Pattern +logger = logging.getLogger(__name__) + + def writefile( library: Mapping[str, Pattern], top: str, @@ -50,7 +53,7 @@ def writefile( bounds = pattern.get_bounds(library=library) if bounds is None: bounds_min, bounds_max = numpy.array([[-1, -1], [1, 1]]) - warnings.warn('Pattern had no bounds (empty?); setting arbitrary viewbox', stacklevel=1) + logger.warning('Pattern had no bounds (empty?); setting arbitrary viewbox', stacklevel=1) else: bounds_min, bounds_max = bounds @@ -117,7 +120,7 @@ def writefile_inverted( bounds = pattern.get_bounds(library=library) if bounds is None: bounds_min, bounds_max = numpy.array([[-1, -1], [1, 1]]) - warnings.warn('Pattern had no bounds (empty?); setting arbitrary viewbox', stacklevel=1) + logger.warning('Pattern had no bounds (empty?); setting arbitrary viewbox', stacklevel=1) else: bounds_min, bounds_max = bounds