From 95d681fa16e635a30e89a1dba5209713b3a78c4c Mon Sep 17 00:00:00 2001 From: Guillaume Ayoub Date: Tue, 2 Jul 2024 23:34:20 +0200 Subject: [PATCH] =?UTF-8?q?Don=E2=80=99t=20use=20too=20recent=20math.cbrt?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit It’s been added in Python 3.11 (!) --- tinycss2/color4.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/tinycss2/color4.py b/tinycss2/color4.py index 6296760..72387c4 100644 --- a/tinycss2/color4.py +++ b/tinycss2/color4.py @@ -1,5 +1,5 @@ from colorsys import hls_to_rgb -from math import cbrt, cos, sin, tau +from math import cos, sin, tau from .color3 import _BASIC_COLOR_KEYWORDS, _EXTENDED_COLOR_KEYWORDS, _HASH_REGEXPS from .parser import parse_one_component_value @@ -31,9 +31,9 @@ def _xyz_to_lab(X, Y, Z, d): x = X / d[0] y = Y / d[1] z = Z / d[2] - f0 = cbrt(x) if x > _ε else (_κ * x + 16) / 116 - f1 = cbrt(y) if y > _ε else (_κ * y + 16) / 116 - f2 = cbrt(z) if z > _ε else (_κ * z + 16) / 116 + f0 = x ** (1 / 3) if x > _ε else (_κ * x + 16) / 116 + f1 = y ** (1 / 3) if y > _ε else (_κ * y + 16) / 116 + f2 = z ** (1 / 3) if z > _ε else (_κ * z + 16) / 116 L = (116 * f1) - 16 a = 500 * (f0 - f1) b = 200 * (f1 - f2)