[file.svg] use logger.warning over warnings.warn (for flexibility)

This commit is contained in:
Jan Petykiewicz 2025-10-30 01:15:44 -07:00
parent 006e7c428c
commit 3e88ed9438

View File

@ -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