Skip to content

Commit e288d9e

Browse files
committed
Remove support for Python 3.7 due to end-of-life
Python 3.7 was end-of-life as of 6-27-2023. As such, there is no need for Bandit to continue to support it. Fixes #992 Signed-off-by: Eric Brown <[email protected]>
1 parent a3c0461 commit e288d9e

File tree

9 files changed

+15
-34
lines changed

9 files changed

+15
-34
lines changed

.github/workflows/publish-to-pypi.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,10 @@ jobs:
1010
- uses: actions/checkout@v3
1111
with:
1212
fetch-depth: 0
13-
- name: Set up Python 3.7
13+
- name: Set up Python 3.8
1414
uses: actions/setup-python@v4
1515
with:
16-
python-version: 3.7
16+
python-version: 3.8
1717

1818
- name: Install dependencies
1919
run: pip install wheel

.github/workflows/publish-to-test-pypi.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,10 @@ jobs:
1010
- uses: actions/checkout@v3
1111
with:
1212
fetch-depth: 0
13-
- name: Set up Python 3.7
13+
- name: Set up Python 3.8
1414
uses: actions/setup-python@v4
1515
with:
16-
python-version: 3.7
16+
python-version: 3.8
1717

1818
- name: Install dependencies
1919
run: pip install wheel

.github/workflows/pythonpackage.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ jobs:
77
runs-on: ubuntu-latest
88
strategy:
99
matrix:
10-
python-version: [3.7]
10+
python-version: [3.8]
1111
steps:
1212
- name: Checkout repository
1313
uses: actions/checkout@v3
@@ -26,7 +26,7 @@ jobs:
2626
runs-on: ubuntu-latest
2727
strategy:
2828
matrix:
29-
python-version: [3.7]
29+
python-version: [3.8]
3030
steps:
3131
- name: Checkout repository
3232
uses: actions/checkout@v3
@@ -47,7 +47,7 @@ jobs:
4747
strategy:
4848
matrix:
4949
python-version: [
50-
["3.7", "37"], ["3.8", "38"], ["3.9", "39"], ["3.10", "310"], ["3.11", "311"]
50+
["3.8", "38"], ["3.9", "39"], ["3.10", "310"], ["3.11", "311"]
5151
]
5252
os: [ubuntu-latest, macos-latest]
5353
runs-on: ${{ matrix.os }}

.pre-commit-config.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,17 +11,17 @@ repos:
1111
rev: v3.9.0
1212
hooks:
1313
- id: reorder-python-imports
14-
args: [--application-directories, '.:src', --py37-plus]
14+
args: [--application-directories, '.:src', --py38-plus]
1515
- repo: https://github.com/psf/black
1616
rev: 23.3.0
1717
hooks:
1818
- id: black
19-
args: [--line-length=79, --target-version=py37]
19+
args: [--line-length=79, --target-version=py38]
2020
- repo: https://github.com/asottile/pyupgrade
2121
rev: v3.3.2
2222
hooks:
2323
- id: pyupgrade
24-
args: [--py37-plus]
24+
args: [--py38-plus]
2525
- repo: https://github.com/jorisroovers/gitlint
2626
rev: v0.19.1
2727
hooks:

bandit/core/utils.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -219,7 +219,7 @@ def calc_linerange(node):
219219

220220
def linerange(node):
221221
"""Get line number range from a node."""
222-
if sys.version_info >= (3, 8) and hasattr(node, "lineno"):
222+
if hasattr(node, "lineno"):
223223
return list(range(node.lineno, node.end_lineno + 1))
224224
else:
225225
if hasattr(node, "_bandit_linerange_stripped"):

setup.cfg

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ classifier =
1818
Operating System :: MacOS :: MacOS X
1919
Programming Language :: Python
2020
Programming Language :: Python :: 3
21-
Programming Language :: Python :: 3.7
2221
Programming Language :: Python :: 3.8
2322
Programming Language :: Python :: 3.9
2423
Programming Language :: Python :: 3.10

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,5 @@
44
import setuptools
55

66
setuptools.setup(
7-
python_requires=">=3.7", setup_requires=["pbr>=2.0.0"], pbr=True
7+
python_requires=">=3.8", setup_requires=["pbr>=2.0.0"], pbr=True
88
)

tests/functional/test_functional.py

Lines changed: 2 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -461,18 +461,6 @@ def test_multiline_sql_statements(self):
461461
severity_medium_tests = 26
462462
nosec_tests = 7
463463
skipped_tests = 8
464-
if sys.version_info[:2] <= (3, 7):
465-
# In the case of implicit concatenation in python 3.7,
466-
# we know only the first line of multi-line string.
467-
# Thus, cases like:
468-
# query = ("SELECT * "
469-
# "FROM foo " # nosec
470-
# f"WHERE id = {identifier}")
471-
# are not skipped but reported as errors.
472-
confidence_low_tests = 17
473-
severity_medium_tests = 30
474-
nosec_tests = 5
475-
skipped_tests = 6
476464
expect = {
477465
"SEVERITY": {
478466
"UNDEFINED": 0,
@@ -790,19 +778,13 @@ def test_multiline_code(self):
790778
issues[0].fname.endswith("examples/multiline_statement.py")
791779
)
792780
self.assertEqual(1, issues[0].lineno)
793-
if sys.version_info >= (3, 8):
794-
self.assertEqual(list(range(1, 2)), issues[0].linerange)
795-
else:
796-
self.assertEqual(list(range(1, 3)), issues[0].linerange)
781+
self.assertEqual(list(range(1, 2)), issues[0].linerange)
797782
self.assertIn("subprocess", issues[0].get_code())
798783
self.assertEqual(5, issues[1].lineno)
799784
self.assertEqual(list(range(3, 6 + 1)), issues[1].linerange)
800785
self.assertIn("shell=True", issues[1].get_code())
801786
self.assertEqual(11, issues[2].lineno)
802-
if sys.version_info >= (3, 8):
803-
self.assertEqual(list(range(8, 13 + 1)), issues[2].linerange)
804-
else:
805-
self.assertEqual(list(range(8, 12 + 1)), issues[2].linerange)
787+
self.assertEqual(list(range(8, 13 + 1)), issues[2].linerange)
806788
self.assertIn("shell=True", issues[2].get_code())
807789

808790
def test_code_line_numbers(self):

tox.ini

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[tox]
22
minversion = 3.2.0
3-
envlist = py37,pep8
3+
envlist = py38,pep8
44

55
[testenv]
66
usedevelop = True

0 commit comments

Comments
 (0)