From ae9ca16aaad6dfd7d5d869dd7e1a36a8cdcf8eab Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rn-Michael=20Miehe?= Date: Wed, 22 Nov 2023 19:26:30 +0100 Subject: [PATCH] rename RE constants --- api/advent22_api/core/transformed_string.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/api/advent22_api/core/transformed_string.py b/api/advent22_api/core/transformed_string.py index 3099abb..7e354c2 100644 --- a/api/advent22_api/core/transformed_string.py +++ b/api/advent22_api/core/transformed_string.py @@ -4,11 +4,11 @@ from random import Random from pydantic import BaseModel, field_validator -_RE_WHITESPACE = re.compile( +RE_WHITESPACE = re.compile( pattern=r"\s+", flags=re.UNICODE | re.IGNORECASE, ) -_RE_SPECIAL_CHARS = re.compile( +RE_SPECIAL_CHARS = re.compile( pattern=r"[^a-zA-Z0-9\s]+", flags=re.UNICODE | re.IGNORECASE, ) @@ -67,14 +67,14 @@ class TransformedString(BaseModel): result = result.strip() elif self.whitespace is TransformedString.__Whitespace.SPACE: - result = _RE_WHITESPACE.sub(string=result, repl=" ") + result = RE_WHITESPACE.sub(string=result, repl=" ") elif self.whitespace is TransformedString.__Whitespace.REMOVE: - result = _RE_WHITESPACE.sub(string=result, repl="") + result = RE_WHITESPACE.sub(string=result, repl="") # Sonderzeichen verarbeiten if self.special_chars is TransformedString.__SpecialChars.REMOVE: - result = _RE_SPECIAL_CHARS.sub(string=result, repl="") + result = RE_SPECIAL_CHARS.sub(string=result, repl="") # Groß-/Kleinschreibung verarbeiten if self.case is TransformedString.__Case.UPPER: