mirror of
https://gitflic.ru/project/alt-gnome/karkas.git
synced 2024-12-24 00:33:06 +03:00
Добавлены nosec
для прохождения bandit
This commit is contained in:
parent
ef0dda07f7
commit
ef10f05a73
8
src/modules/external/yandexgpt/yandexgpt.py
vendored
8
src/modules/external/yandexgpt/yandexgpt.py
vendored
@ -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(
|
||||
|
@ -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)
|
||||
|
@ -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__":
|
||||
|
@ -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__":
|
||||
|
@ -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)
|
||||
|
Loading…
Reference in New Issue
Block a user