From bf6a3a9c2054fbd7c9088e79fd220d7eb3392f44 Mon Sep 17 00:00:00 2001 From: Karim shoair Date: Sat, 8 Mar 2025 01:42:58 +0200 Subject: [PATCH] fix(TextHandler): auto handling non-string type variables Fix for #45 --- scrapling/core/custom_types.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/scrapling/core/custom_types.py b/scrapling/core/custom_types.py index 67e4e00..6d09592 100644 --- a/scrapling/core/custom_types.py +++ b/scrapling/core/custom_types.py @@ -19,9 +19,7 @@ class TextHandler(str): __slots__ = () def __new__(cls, string): - if isinstance(string, str): - return super().__new__(cls, string) - return super().__new__(cls, '') + return super().__new__(cls, str(string)) def __getitem__(self, key: Union[SupportsIndex, slice]) -> "TextHandler": lst = super().__getitem__(key)