Skip to content

Commit

Permalink
Merge branch 'main' into ericwb-patch-2
Browse files Browse the repository at this point in the history
  • Loading branch information
ericwb authored Dec 8, 2023
2 parents 6fa3f20 + 4dea02e commit c6f84d5
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 6 deletions.
5 changes: 1 addition & 4 deletions bandit/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,7 @@
# Copyright 2014 Hewlett-Packard Development Company, L.P.
#
# SPDX-License-Identifier: Apache-2.0
try:
from importlib import metadata
except ImportError:
import importlib_metadata as metadata
from importlib import metadata

from bandit.core import config # noqa
from bandit.core import context # noqa
Expand Down
4 changes: 3 additions & 1 deletion bandit/core/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,9 @@ def __init__(self, config_file=None):

try:
with f:
self._config = tomllib.load(f)["tool"]["bandit"]
self._config = (
tomllib.load(f).get("tool", {}).get("bandit", {})
)
except tomllib.TOMLDecodeError as err:
LOG.error(err)
raise utils.ConfigError("Error parsing file.", config_file)
Expand Down
1 change: 0 additions & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,3 @@ PyYAML>=5.3.1 # MIT
stevedore>=1.20.0 # Apache-2.0
colorama>=0.3.9;platform_system=="Windows" # BSD License (3 clause)
rich # MIT
importlib-metadata;python_version<"3.8" # Apache-2.0

0 comments on commit c6f84d5

Please sign in to comment.