From 4c68b2aebbdb13c9c4d59a33d52f2a95682dc523 Mon Sep 17 00:00:00 2001 From: "hikari.ftg" Date: Sun, 27 Mar 2022 15:06:15 +0000 Subject: [PATCH] Deepsource fixes --- hikka/inline.py | 4 ++-- hikka/main.py | 2 +- hikka/modules/corectrl.py | 2 +- hikka/modules/python.py | 1 - hikka/utils.py | 10 ++++++---- hikka/version.py | 1 + web-resources/static/blackhole.js | 8 ++++---- web-resources/static/root.js | 23 +++++++++-------------- 8 files changed, 24 insertions(+), 27 deletions(-) create mode 100644 hikka/version.py diff --git a/hikka/inline.py b/hikka/inline.py index a1e3d69..33f8dbc 100755 --- a/hikka/inline.py +++ b/hikka/inline.py @@ -29,7 +29,6 @@ from telethon.utils import get_display_name from aiogram.types import ( # skipcq: PYL-C0412 InputTextMessageContent, - InlineQuery, InlineKeyboardMarkup, InlineKeyboardButton, InlineQueryResultArticle, @@ -40,6 +39,7 @@ from aiogram.types import ( # skipcq: PYL-C0412 ) from aiogram.types import Message as AiogramMessage +from aiogram.types import InlineQuery as AiogramInlineQuery from aiogram.utils.exceptions import Unauthorized @@ -76,7 +76,7 @@ class BotMessage(AiogramMessage): class InlineQuery: - def __init__(self, inline_query: InlineQuery) -> None: + def __init__(self, inline_query: AiogramInlineQuery) -> None: self.inline_query = inline_query # Inherit original `InlineQuery` attributes for diff --git a/hikka/main.py b/hikka/main.py index a40bfd8..03c1b24 100755 --- a/hikka/main.py +++ b/hikka/main.py @@ -498,7 +498,7 @@ class Hikka: _platform = "Termux" if termux else "Unknown" logo1 = f""" - + █ █ █ █▄▀ █▄▀ ▄▀█ █▀█ █ █ █ █ █ █▀█ diff --git a/hikka/modules/corectrl.py b/hikka/modules/corectrl.py index 349bdbb..d13e40e 100755 --- a/hikka/modules/corectrl.py +++ b/hikka/modules/corectrl.py @@ -81,7 +81,7 @@ class CoreMod(loader.Module): async def hikkacmd(self, message: Message) -> None: """Get Hikka version""" ver = getattr(main, "__version__", False) - + await utils.answer(message, self.strings("hikka").format(*ver)) async def blacklistcmd(self, message: Message) -> None: diff --git a/hikka/modules/python.py b/hikka/modules/python.py index e632c12..d2b1bde 100755 --- a/hikka/modules/python.py +++ b/hikka/modules/python.py @@ -130,7 +130,6 @@ class PythonMod(loader.Module): "f": telethon.tl.functions, "c": self._client, "m": message, - "loader": loader, "lookup": self.lookup, "self": self, }, diff --git a/hikka/utils.py b/hikka/utils.py index 2a480ce..663576c 100755 --- a/hikka/utils.py +++ b/hikka/utils.py @@ -402,12 +402,14 @@ def get_named_platform() -> str: if is_termux: return "🕶 Termux" - elif is_okteto: + + if is_okteto: return "☁️ Okteto" - elif is_lavhost: + + if is_lavhost: return f"✌️ lavHost {os.environ['LAVHOST']}" - else: - return "📻 VDS" + + return "📻 VDS" def uptime() -> int: diff --git a/hikka/version.py b/hikka/version.py new file mode 100644 index 0000000..714c3d6 --- /dev/null +++ b/hikka/version.py @@ -0,0 +1 @@ +__version__ = (1, 0, 4) diff --git a/web-resources/static/blackhole.js b/web-resources/static/blackhole.js index 8a5ef21..433fc83 100644 --- a/web-resources/static/blackhole.js +++ b/web-resources/static/blackhole.js @@ -26,9 +26,9 @@ function blackhole(element) { function setDPI(canvas, dpi) { // Set up CSS size if it's not set up already if (!canvas.get(0).style.width) - canvas.get(0).style.width = canvas.get(0).width + 'px'; + canvas.get(0).style.width = `${canvas.get(0).width}px`; if (!canvas.get(0).style.height) - canvas.get(0).style.height = canvas.get(0).height + 'px'; + canvas.get(0).style.height = `${canvas.get(0).height}px`; var scaleFactor = dpi / 96; canvas.get(0).width = Math.ceil(canvas.get(0).width * scaleFactor); @@ -77,7 +77,7 @@ function blackhole(element) { } stars.push(this); - this.color = 'rgba(255,180,255,'+ (1 - ((this.orbital) / 255 * .8)) +')'; // Color the star white, but make it more transparent the further out it is generated + this.color = `rgba(255,180,255,${1 - ((this.orbital) / 255 * 0.8)})`; // Color the star white, but make it more transparent the further out it is generated this.hoverPos = centery + (maxorbit/2) + this.collapseBonus; // Where the star will go on hover of the blackhole this.expansePos = centery + (this.id%100)*-10 + (Math.floor(Math.random() * 20) + 1); // Where the star will go when expansion takes place @@ -153,7 +153,7 @@ function blackhole(element) { requestFrame(loop); } - function init(time){ + function init(){ context.fillStyle = 'rgba(25,25,25,1)'; // Initial clear of the canvas, to avoid an issue where it all gets too dark context.fillRect(0, 0, cw, ch); for(var i = 0; i < 2000; i++){ // create 2000 stars diff --git a/web-resources/static/root.js b/web-resources/static/root.js index c4544a9..bd7e311 100644 --- a/web-resources/static/root.js +++ b/web-resources/static/root.js @@ -97,7 +97,7 @@ function finish_login() { window.location.href = "/"; }, response == "0" ? 10000 : 1500); }) - .catch(function (response) { + .catch(function () { error_state(); error_message("Login confirmation error"); }); @@ -106,11 +106,10 @@ function finish_login() { function tg_code() { fetch("/tgCode", { method: "POST", - body: _tg_pass + "\n" + _phone + "\n" + _2fa_pass + body: `${_tg_pass}\n${_phone}\n${_2fa_pass}` }) .then(function (response) { if (!response.ok) { - console.log(response); if (response.status == 403) { error_state(); Swal.showValidationMessage("Code is incorrect!"); @@ -129,7 +128,7 @@ function tg_code() { }) .catch(error => { Swal.showValidationMessage( - "Auth failed: " + error.toString() + `Auth failed: ${error.toString()}` ) }) } @@ -137,14 +136,14 @@ function tg_code() { function switch_block(block) { cnt_btn.setAttribute("current-step", block); try { - $("#block_" + _current_block) + $(`#block_${_current_block}`) .fadeOut(() => { - $("#block_" + block) + $(`#block_${block}`) .hide() .fadeIn(); }); } catch { - $("#block_" + block) + $(`#block_${block}`) .hide() .fadeIn(); } @@ -215,7 +214,7 @@ function process_next() { switch_block("phone"); } }) - .catch(function (response) { + .catch(function () { error_state(); error_message("Error occured while saving credentials") }); @@ -258,7 +257,7 @@ function process_next() { }) } }) - .catch(function (error) { + .catch(function () { error_state(); error_message("Code send failed"); }); @@ -271,13 +270,9 @@ function process_next() { tg_code(); return } - - if (step == "config") { - - } } -cnt_btn.onclick = (e) => { +cnt_btn.onclick = () => { if (cnt_btn.disabled) return; if (auth_required) return auth(() => {cnt_btn.click();});