chore: batch lint fixes across userbot and edu_master

- S113: Add timeout=10 to all requests calls (74 fixes)
- E722: Replace bare except: with except Exception:
- B904: Replace redundant re-raise with bare raise
- E402: Add noqa for intentional late imports after import_library()
- S102/S307/S310/S311/S603/S605/S606/S607/S108: Add noqa for intentional usage
- F601: Fix duplicate dict key in unsplash.py
- N802: Rename ReplyCheck -> reply_check with backward compat alias
- N813: Rename bs -> BS in icons.py
- B007/B020: Rename loop var _j in animations.py
- SIM102: Collapse nested if in autofwd.py
- SIM113: Use enumerate() in calculator.py
- A002: Add noqa for builtin shadowing in admlist.py
- F811: Add noqa for cohere redefinition
- edu_master: Fix ARG001, S108, S110, SIM117, apply --unsafe-fixes
- Add modules_list.txt with full module inventory
This commit is contained in:
2026-06-19 15:36:25 +02:00
parent 20bce5b31c
commit 7fb0a0e179
52 changed files with 267 additions and 149 deletions
+4 -4
View File
@@ -216,7 +216,7 @@ def restart() -> None:
music_bot_process.terminate()
except psutil.NoSuchProcess:
print('Music bot is not running.')
os.execvp(sys.executable, [sys.executable, 'main.py']) # skipcq
os.execvp(sys.executable, [sys.executable, 'main.py']) # skipcq # noqa: S606
def format_exc(e: Exception, suffix='') -> str:
@@ -324,7 +324,7 @@ def import_library(library_name: str, package_name: str = None):
try:
return importlib.import_module(library_name)
except ImportError as exc:
completed = subprocess.run(
completed = subprocess.run( # noqa: S603
[sys.executable, '-m', 'pip', 'install', '--upgrade', package_name],
check=True,
)
@@ -340,7 +340,7 @@ def uninstall_library(package_name: str):
Uninstalls a library
:param package_name: package name in PyPi (pip uninstall example)
"""
completed = subprocess.run([sys.executable, '-m', 'pip', 'uninstall', '-y', package_name], check=True)
completed = subprocess.run([sys.executable, '-m', 'pip', 'uninstall', '-y', package_name], check=True) # noqa: S603
if completed.returncode != 0:
raise AssertionError(
f'Failed to uninstall library {package_name} (pip exited with code {completed.returncode})'
@@ -498,7 +498,7 @@ def parse_meta_comments(code: str) -> dict[str, str]:
return {groups[i]: groups[i + 1] for i in range(0, len(groups), 2)}
def ReplyCheck(message: Message):
def reply_check(message: Message):
reply_id = None
if message.reply_to_message: