Fix failing tests from ruff/newton_raphson (ignore S307 "possibly insecure function") (#8862)

* chore: Fix failing tests (ignore S307 "possibly insecure function")

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* fix: Move noqa back to right line

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
This commit is contained in:
Caeden Perelli-Harris 2023-07-11 10:51:21 +01:00 committed by GitHub
parent a0eec90466
commit 44b1bcc7c7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -25,9 +25,11 @@ def newton_raphson(
"""
x = a
while True:
x = Decimal(x) - (Decimal(eval(func)) / Decimal(eval(str(diff(func)))))
x = Decimal(x) - (
Decimal(eval(func)) / Decimal(eval(str(diff(func)))) # noqa: S307
)
# This number dictates the accuracy of the answer
if abs(eval(func)) < precision:
if abs(eval(func)) < precision: # noqa: S307
return float(x)