From 57e70333c70b95f865e5000dad8a2db9f2a61586 Mon Sep 17 00:00:00 2001 From: Mohamed Cheikh Sidiya Date: Wed, 18 Oct 2023 07:28:46 +0200 Subject: [PATCH] ~ --- models/conversation.py | 4 ++-- utils/utils.py | 10 +++++----- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/models/conversation.py b/models/conversation.py index 1782aba..d1de6a9 100644 --- a/models/conversation.py +++ b/models/conversation.py @@ -5,7 +5,7 @@ """ from datetime import datetime, timedelta -from re import Pattern as RegexPattern +from re import Pattern from re import compile as re_compile from time import ctime from typing import Any @@ -226,7 +226,7 @@ def to_markdown(self) -> str: def sanitized_title(self) -> str: """Sanitized title of the conversation, compatible with file names.""" - file_anti_pattern: RegexPattern[str] = re_compile( + file_anti_pattern: Pattern[str] = re_compile( pattern=r'[<>:"/\\|?*\n\r\t\f\v]', ) return ( diff --git a/utils/utils.py b/utils/utils.py index 831b544..7f79cbe 100644 --- a/utils/utils.py +++ b/utils/utils.py @@ -1,7 +1,7 @@ """Utility functions for the project.""" from pathlib import Path -from re import sub as re_sub +from re import sub from zipfile import ZipFile @@ -30,10 +30,10 @@ def ensure_closed_code_blocks(string: str) -> str: def replace_latex_delimiters(string: str) -> str: """Replace all the LaTeX bracket delimiters in the string with dollar sign ones.""" - string = re_sub(pattern=r"\\\[", repl="$$", string=string) - string = re_sub(pattern=r"\\\]", repl="$$", string=string) - string = re_sub(pattern=r"\\\(", repl="$", string=string) - string = re_sub(pattern=r"\\\)", repl="$", string=string) + string = sub(pattern=r"\\\[", repl="$$", string=string) + string = sub(pattern=r"\\\]", repl="$$", string=string) + string = sub(pattern=r"\\\(", repl="$", string=string) + string = sub(pattern=r"\\\)", repl="$", string=string) return string