refactor: Refactor storage system (#937)

This commit is contained in:
Fangyin Cheng
2023-12-15 16:35:45 +08:00
committed by GitHub
parent a1e415d68d
commit aed1c3fb2b
55 changed files with 3780 additions and 680 deletions

View File

@@ -73,9 +73,11 @@ def extract_content_open_ending(long_string, s1, s2, is_include: bool = False):
return match_map
if __name__ == "__main__":
s = "abcd123efghijkjhhh456xxx123aa456yyy123bb456xx123"
s1 = "123"
s2 = "456"
def _to_str(x, charset="utf8", errors="strict"):
if x is None or isinstance(x, str):
return x
print(extract_content_open_ending(s, s1, s2, True))
if isinstance(x, bytes):
return x.decode(charset, errors)
return str(x)