From 32a15f84c0b30a467013c9de76801f4659ebccb0 Mon Sep 17 00:00:00 2001 From: Jens Langhammer Date: Fri, 21 Feb 2020 09:03:59 +0100 Subject: [PATCH] root: run bandit as part of pre-commit --- passbook/sources/saml/processors/base.py | 7 ++++--- scripts/pre-commit.sh | 1 + 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/passbook/sources/saml/processors/base.py b/passbook/sources/saml/processors/base.py index db12f35dc..775791adf 100644 --- a/passbook/sources/saml/processors/base.py +++ b/passbook/sources/saml/processors/base.py @@ -1,6 +1,5 @@ """passbook saml source processor""" -from typing import Optional -from xml.etree.ElementTree import Element +from typing import TYPE_CHECKING, Optional from defusedxml import ElementTree from django.http import HttpRequest @@ -16,6 +15,8 @@ from passbook.sources.saml.exceptions import ( from passbook.sources.saml.models import SAMLSource LOGGER = get_logger() +if TYPE_CHECKING: + from xml.etree.ElementTree import Element # nosec class Processor: @@ -23,7 +24,7 @@ class Processor: _source: SAMLSource - _root: Element + _root: "Element" _root_xml: str def __init__(self, source: SAMLSource): diff --git a/scripts/pre-commit.sh b/scripts/pre-commit.sh index f4c2bf4f8..1658c5a96 100755 --- a/scripts/pre-commit.sh +++ b/scripts/pre-commit.sh @@ -2,5 +2,6 @@ isort -rc passbook black passbook scripts/coverage.sh +bandit -r passbook pylint passbook prospector