From 6b19d5f9e44ebc065fa788e33f5d24cc47aee524 Mon Sep 17 00:00:00 2001 From: Sermet Pekin <96650846+SermetPekin@users.noreply.github.com> Date: Sat, 8 Jun 2024 09:33:37 +0300 Subject: [PATCH] Update utils_general.py --- evdspy/EVDSlocal/utils/utils_general.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/evdspy/EVDSlocal/utils/utils_general.py b/evdspy/EVDSlocal/utils/utils_general.py index 370d73b..72a572c 100644 --- a/evdspy/EVDSlocal/utils/utils_general.py +++ b/evdspy/EVDSlocal/utils/utils_general.py @@ -35,7 +35,12 @@ def encode(text: str) -> bytes: t_bytes = text.encode("ascii") encoded = base64.b64encode(t_bytes) return encoded - +def replace_recursive(content: str, char: str, new_char: str): + if char not in content: + return content + content = content.replace(char, new_char) + return replace_recursive(content, char, new_char) + def api_key_looks_valid(key: str): return isinstance(key, str) and len(key) == 10 class ApiKeyErrorEnvir(BaseException): @@ -128,4 +133,4 @@ def get_random_hash(num=5): import string letters = string.ascii_letters randomF = ''.join(random.choice(letters) for i in range(num)) - return randomF \ No newline at end of file + return randomF