From ef10f05a7333a22ee3d6bf3c2dc99a5c7f2cf30c Mon Sep 17 00:00:00 2001 From: Maxim Slipenko Date: Mon, 8 Jul 2024 00:55:33 +0300 Subject: [PATCH] =?UTF-8?q?=D0=94=D0=BE=D0=B1=D0=B0=D0=B2=D0=BB=D0=B5?= =?UTF-8?q?=D0=BD=D1=8B=20`nosec`=20=D0=B4=D0=BB=D1=8F=20=D0=BF=D1=80?= =?UTF-8?q?=D0=BE=D1=85=D0=BE=D0=B6=D0=B4=D0=B5=D0=BD=D0=B8=D1=8F=20`bandi?= =?UTF-8?q?t`?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/modules/external/yandexgpt/yandexgpt.py | 8 +++++--- src/modules/standard/config/tests/test_config.py | 2 +- src/modules/standard/database/tests/test_db.py | 2 +- src/modules/standard/roles/tests/test_roles.py | 2 +- src/modules/standard/welcome/handlers.py | 8 ++++---- 5 files changed, 12 insertions(+), 10 deletions(-) diff --git a/src/modules/external/yandexgpt/yandexgpt.py b/src/modules/external/yandexgpt/yandexgpt.py index 1658e0d..1d726d6 100644 --- a/src/modules/external/yandexgpt/yandexgpt.py +++ b/src/modules/external/yandexgpt/yandexgpt.py @@ -99,7 +99,7 @@ class YandexGPT: "messages": messages, } - response = requests.post(url, headers=headers, json=prompt).text + response = requests.post(url, headers=headers, json=prompt).text # nosec return json.loads(response)["result"]["alternatives"][0]["message"]["text"] async def async_yandexgpt( @@ -135,7 +135,9 @@ class YandexGPT: }, "messages": messages, } - response = await self.async_request(url=url, headers=headers, prompt=request) + response = await self.async_request( + url=url, headers=headers, prompt=request + ) # nosec return response["result"]["alternatives"][0]["message"]["text"] async def async_yandexgpt_translate(self, input_language, output_language, text): @@ -187,7 +189,7 @@ class YandexGPT: "messages": messages, } - response = requests.post(url, headers=headers, json=prompt).text + response = requests.post(url, headers=headers, json=prompt).text # nosec return json.loads(response)["result"]["alternatives"][0]["message"]["text"] async def async_yandex_cloud_text_to_speech( diff --git a/src/modules/standard/config/tests/test_config.py b/src/modules/standard/config/tests/test_config.py index a71ce52..011d5c1 100644 --- a/src/modules/standard/config/tests/test_config.py +++ b/src/modules/standard/config/tests/test_config.py @@ -33,7 +33,7 @@ class TestConfig(unittest.TestCase): ) def test_yaml_values(self): - expected_token = "xxxxxxxxxxxxxxxxxxxx" + expected_token = "xxxxxxxxxxxxxxxxxxxx" # nosec expected_role_values = {"ADMIN": 0, "MODERATOR": 1, "USER": 2, "BOT": 3} self.assertEqual(yaml_load["TELEGRAM"]["TOKEN"], expected_token) diff --git a/src/modules/standard/database/tests/test_db.py b/src/modules/standard/database/tests/test_db.py index fd47d9b..0052a7e 100644 --- a/src/modules/standard/database/tests/test_db.py +++ b/src/modules/standard/database/tests/test_db.py @@ -135,7 +135,7 @@ class TestDatabaseAPI(unittest.TestCase): @classmethod def tearDownClass(cls): cls.database.close() - os.system(f"rm {cls.path}") + os.system(f"rm {cls.path}") # nosec if __name__ == "__main__": diff --git a/src/modules/standard/roles/tests/test_roles.py b/src/modules/standard/roles/tests/test_roles.py index 7a7c85e..4828306 100644 --- a/src/modules/standard/roles/tests/test_roles.py +++ b/src/modules/standard/roles/tests/test_roles.py @@ -73,7 +73,7 @@ class TestRoles(unittest.IsolatedAsyncioTestCase): @classmethod def tearDownClass(cls): cls.database.close() - os.system(f"rm {cls.path}") + os.system(f"rm {cls.path}") # nosec if __name__ == "__main__": diff --git a/src/modules/standard/welcome/handlers.py b/src/modules/standard/welcome/handlers.py index 5a1af77..16102b9 100644 --- a/src/modules/standard/welcome/handlers.py +++ b/src/modules/standard/welcome/handlers.py @@ -16,13 +16,13 @@ from src.modules.standard.roles.roles import Roles async def create_math_task(): - first_number = random.randint(1, 100) - second_number = random.randint(1, 100) + first_number = random.randint(1, 100) # nosec + second_number = random.randint(1, 100) # nosec answer = first_number + second_number fake_answers = [] for i in range(3): - diff = random.randint(1, 10) - diff_sign = random.choice(["+", "-"]) + diff = random.randint(1, 10) # nosec + diff_sign = random.choice(["+", "-"]) # nosec fake_answers.append(answer + diff if diff_sign == "+" else answer - diff) fake_answers.append(answer) random.shuffle(fake_answers)