This commit is contained in:
Maxim Devaev
2024-07-08 03:41:29 +03:00
parent e0bbf6968e
commit 630610bc53
50 changed files with 3835 additions and 77 deletions

View File

@@ -99,3 +99,11 @@ def check_any(arg: Any, name: str, validators: list[Callable[[Any], Any]]) -> An
except Exception:
pass
raise_error(arg, name)
# =====
def filter_printable(arg: str, replace: str, limit: int) -> str:
return "".join(
(ch if ch.isprintable() else replace)
for ch in arg[:limit]
)