From a84a79ba6476346b09871d96d7004bed36725d47 Mon Sep 17 00:00:00 2001 From: comasqw Date: Sat, 14 Dec 2024 00:12:01 +0400 Subject: [PATCH] small optimizations --- Tools/_CP14/ColorReplacer/color_replacer/rgb_container.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/Tools/_CP14/ColorReplacer/color_replacer/rgb_container.py b/Tools/_CP14/ColorReplacer/color_replacer/rgb_container.py index df991e58cf..3e71580fba 100644 --- a/Tools/_CP14/ColorReplacer/color_replacer/rgb_container.py +++ b/Tools/_CP14/ColorReplacer/color_replacer/rgb_container.py @@ -18,10 +18,11 @@ class RGBContainer: def from_hex(cls, hex_color: str): hex_color = hex_color.lstrip('#') - if len(hex_color) not in [6, 8]: + hex_len = len(hex_color) + if hex_len not in (6, 8): raise InvalidHexLen("HEX string length must be 6 or 8 characters.") - if len(hex_color) == 6: + if hex_len == 6: hex_color += 'FF' red = int(hex_color[0:2], 16)