Creating an issue to preserve conversation with @sachinsharma9780 regarding the Bandit security issue with the use of assert in non-test code.
Here is the error produced:
>> Issue: [B101:assert_used] Use of assert detected. The enclosed code will be removed when compiling to optimised byte code.
Severity: Low Confidence: High
CWE: CWE-703 (https://cwe.mitre.org/data/definitions/703.html)
Location: fastgraphml/graph_embeddings/downstream_tasks/similarity_search.py:64:8
More Info: https://bandit.readthedocs.io/en/0.0.0/plugins/b101_assert_used.html
63 else:
64 assert (
65 search_type == "exact" or search_type == "approx"
66 ), "pass search type either exact or approx"
Upon reading further into https://bandit.readthedocs.io/en/0.0.0/plugins/b101_assert_used.html as assert can be removed from code while compiling in some instances it seems reasonable to abide by the rule and replace assert with something else, in this case, perhaps an exception.
I can make the change and will close the issue unless we have any other reason to keep assert?
Creating an issue to preserve conversation with @sachinsharma9780 regarding the Bandit security issue with the use of
assert
in non-test code.Here is the error produced:
Upon reading further into https://bandit.readthedocs.io/en/0.0.0/plugins/b101_assert_used.html as assert can be removed from code while compiling in some instances it seems reasonable to abide by the rule and replace assert with something else, in this case, perhaps an exception.
I can make the change and will close the issue unless we have any other reason to keep assert?