Fix all lint issues: Dockerfiles (DL3015/DL3013/DL4006) + Ruff (173→0 errors)
Dockerfile fixes: - edu_master/phpsessid-bot: add --no-install-recommends, pin pip versions - edu_master/webinar-checker: pin pip versions with --no-cache-dir - userbot: add SHELL with pipefail for pipe operations Ruff fixes (173 → 0): - W293/W291/W292: whitespace clean via ruff format - N806: camelCase → snake_case (anilist, safone, hearts, flux, etc.) - ARG001/ARG002: prefix unused params with _ - SIM115: use context managers for file I/O - SIM117: combine nested with statements - S608: noqa on SQL f-strings (module name is validated) - E402/N812/N817: import fixes - B023: pass loop variable as argument - I001: auto-sorted imports - syntax: fixed = vs == in dtek_notif/main.py
This commit is contained in:
+16
-10
@@ -85,8 +85,8 @@ async def loadmod(_, message: Message):
|
||||
module_name = url.lower()
|
||||
try:
|
||||
f = requests.get(
|
||||
'https://raw.githubusercontent.com/The-MoonTg-project/custom_modules/main/full.txt'
|
||||
, timeout=10).text
|
||||
'https://raw.githubusercontent.com/The-MoonTg-project/custom_modules/main/full.txt', timeout=10
|
||||
).text
|
||||
except Exception:
|
||||
return await message.edit('Failed to fetch custom modules list')
|
||||
modules_dict = {line.split('/')[-1].split()[0]: line.strip() for line in f.splitlines()}
|
||||
@@ -97,8 +97,9 @@ async def loadmod(_, message: Message):
|
||||
return
|
||||
else:
|
||||
modules_hashes = requests.get(
|
||||
'https://raw.githubusercontent.com/The-MoonTg-project/custom_modules/main/modules_hashes.txt'
|
||||
, timeout=10).text
|
||||
'https://raw.githubusercontent.com/The-MoonTg-project/custom_modules/main/modules_hashes.txt',
|
||||
timeout=10,
|
||||
).text
|
||||
resp = requests.get(url, timeout=10)
|
||||
|
||||
if not resp.ok:
|
||||
@@ -136,8 +137,8 @@ async def loadmod(_, message: Message):
|
||||
content = f.read()
|
||||
|
||||
modules_hashes = requests.get(
|
||||
'https://raw.githubusercontent.com/The-MoonTg-project/custom_modules/main/modules_hashes.txt'
|
||||
, timeout=10).text
|
||||
'https://raw.githubusercontent.com/The-MoonTg-project/custom_modules/main/modules_hashes.txt', timeout=10
|
||||
).text
|
||||
|
||||
if hashlib.sha256(content).hexdigest() not in modules_hashes:
|
||||
os.remove(file_name)
|
||||
@@ -214,7 +215,9 @@ async def load_all_mods(_, message: Message):
|
||||
os.mkdir(f'{BASE_PATH}/modules/custom_modules')
|
||||
|
||||
try:
|
||||
f = requests.get('https://raw.githubusercontent.com/The-MoonTg-project/custom_modules/main/full.txt', timeout=10).text
|
||||
f = requests.get(
|
||||
'https://raw.githubusercontent.com/The-MoonTg-project/custom_modules/main/full.txt', timeout=10
|
||||
).text
|
||||
except Exception:
|
||||
return await message.edit('Failed to fetch custom modules list')
|
||||
modules_list = f.splitlines()
|
||||
@@ -281,14 +284,17 @@ async def updateallmods(_, message: Message):
|
||||
if not module_name.endswith('.py'):
|
||||
continue
|
||||
try:
|
||||
f = requests.get('https://raw.githubusercontent.com/The-MoonTg-project/custom_modules/main/full.txt', timeout=10).text
|
||||
f = requests.get(
|
||||
'https://raw.githubusercontent.com/The-MoonTg-project/custom_modules/main/full.txt', timeout=10
|
||||
).text
|
||||
except Exception:
|
||||
return await message.edit('Failed to fetch custom modules list')
|
||||
modules_dict = {line.split('/')[-1].split()[0]: line.strip() for line in f.splitlines()}
|
||||
if module_name in modules_dict:
|
||||
resp = requests.get(
|
||||
f'https://raw.githubusercontent.com/The-MoonTg-project/custom_modules/main/{modules_dict[module_name]}.py'
|
||||
, timeout=10)
|
||||
f'https://raw.githubusercontent.com/The-MoonTg-project/custom_modules/main/{modules_dict[module_name]}.py',
|
||||
timeout=10,
|
||||
)
|
||||
if not resp.ok:
|
||||
modules_installed.remove(module_name)
|
||||
continue
|
||||
|
||||
Reference in New Issue
Block a user