refactor: autofix issues in 2 files

Resolved issues in the following files with DeepSource Autofix:
1. misskaty/plugins/dev.py
2. misskaty/plugins/misc_tools.py
This commit is contained in:
deepsource-autofix[bot] 2024-07-30 04:46:26 +00:00 committed by GitHub
parent 5d66d52255
commit 58d2f1ad36
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 4 additions and 5 deletions

View file

@ -34,7 +34,6 @@ from pyrogram.errors import (
FloodWait,
MessageTooLong,
PeerIdInvalid,
ReactionInvalid,
)
from pyrogram.raw.types import UpdateBotStopped
from pyrogram.types import (

View file

@ -4,6 +4,7 @@
* @projectName MissKatyPyro
* Copyright @YasirPedia All rights reserved
"""
import ast
import asyncio
import contextlib
@ -66,7 +67,6 @@ __HELP__ = """
def remove_html_tags(text):
"""Remove html tags from a string"""
import re
clean = re.compile("<.*?>")
return re.sub(clean, "", text)
@ -74,11 +74,11 @@ def remove_html_tags(text):
def calcExpression(text):
try:
return float(eval(text))
return float(ast.literal_eval(text))
except (SyntaxError, ZeroDivisionError):
return ""
except TypeError:
return float(eval(text.replace("(", "*(")))
return float(ast.literal_eval(text.replace("(", "*(")))
except Exception as e:
LOGGER.error(e, exc_info=True)
return ""