Skip to content

Commit

Permalink
Post-review fixes 1 - use ast instead of _ast, comment
Browse files Browse the repository at this point in the history
  • Loading branch information
kfrydel committed Aug 23, 2022
1 parent 51a2e92 commit dccf635
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion bandit/core/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
import logging
import os.path
import sys
from _ast import Constant
from ast import Constant

try:
import configparser
Expand Down Expand Up @@ -378,6 +378,8 @@ def get_nosec(nosec_lines, context):
# use the last line in the case of multi-line strings:
# """some text
# with many lines""" # nosec ...
# Strings are parsed as ast.Constant since Python 3.8,
# for Python 3.7 context['lineno'] is returned for strings.
lineno = context['linerange'][-1]
else:
lineno = context['lineno']
Expand Down

0 comments on commit dccf635

Please sign in to comment.