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,8 +34,7 @@ from pyrogram.errors import (
FloodWait, FloodWait,
MessageTooLong, MessageTooLong,
PeerIdInvalid, PeerIdInvalid,
ReactionInvalid, )
)
from pyrogram.raw.types import UpdateBotStopped from pyrogram.raw.types import UpdateBotStopped
from pyrogram.types import ( from pyrogram.types import (
InlineKeyboardButton, InlineKeyboardButton,

View file

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