Skip to content

Commit

Permalink
Update calculate.py
Browse files Browse the repository at this point in the history
  • Loading branch information
ikostan committed Sep 23, 2024
1 parent be6d8c2 commit 3ac7275
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions kyu_7/basic_math_add_or_subtract/calculate.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
GitHub: https://github.com/ikostan
"""


CONVERSION: dict = {
'plus': '+',
'minus': '-'}
Expand All @@ -20,5 +19,4 @@ def calculate(s: str) -> str:
for key, item in CONVERSION.items():
if key in s:
s = s.replace(key, item)

return f'{eval(s)}'
return f'{eval(s)}' # pylint: disable=W0123

Check warning on line 22 in kyu_7/basic_math_add_or_subtract/calculate.py

View check run for this annotation

Codacy Production / Codacy Static Code Analysis

kyu_7/basic_math_add_or_subtract/calculate.py#L22

Detected the use of eval(). eval() can be dangerous if used to evaluate dynamic content.

Check failure on line 22 in kyu_7/basic_math_add_or_subtract/calculate.py

View check run for this annotation

Codacy Production / Codacy Static Code Analysis

kyu_7/basic_math_add_or_subtract/calculate.py#L22

The application was found calling the `eval` function with non-literal data.

Check warning on line 22 in kyu_7/basic_math_add_or_subtract/calculate.py

View check run for this annotation

Codacy Production / Codacy Static Code Analysis

kyu_7/basic_math_add_or_subtract/calculate.py#L22

Use of possibly insecure function - consider using safer ast.literal_eval.

0 comments on commit 3ac7275

Please sign in to comment.