Skip to content

Commit c67295d

Browse files
Ruff: Add N817 (#12072)
1 parent a971816 commit c67295d

File tree

11 files changed

+22
-22
lines changed

11 files changed

+22
-22
lines changed

dojo/tools/crashtest_security/parser.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
import json
44
import re
55

6-
from defusedxml import ElementTree as ET
6+
from defusedxml import ElementTree
77

88
from dojo.models import Finding
99

@@ -163,7 +163,7 @@ def parse_xml(self, xml_output):
163163
@return xml_tree An xml tree instance. None if error.
164164
"""
165165
try:
166-
tree = ET.parse(xml_output)
166+
tree = ElementTree.parse(xml_output)
167167
except SyntaxError as se:
168168
raise ValueError(se)
169169

dojo/tools/hcl_appscan/parser.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
from xml.dom import NamespaceErr
22

3-
from defusedxml import ElementTree as ET
3+
from defusedxml import ElementTree
44

55
from dojo.models import Endpoint, Finding
66

@@ -28,7 +28,7 @@ def xmltreehelper(self, xml_input):
2828

2929
def get_findings(self, file, test):
3030
findings = []
31-
tree = ET.parse(file)
31+
tree = ElementTree.parse(file)
3232
root = tree.getroot()
3333
if "xml-report" not in root.tag:
3434
msg = "This doesn't seem to be a valid HCLAppScan xml file."

dojo/tools/hcl_asoc_sast/parser.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
from xml.dom import NamespaceErr
22

3-
from defusedxml import ElementTree as ET
3+
from defusedxml import ElementTree
44

55
from dojo.models import Finding
66

@@ -28,7 +28,7 @@ def xmltreehelper(self, xml_input):
2828

2929
def get_findings(self, file, test):
3030
findings = []
31-
tree = ET.parse(file)
31+
tree = ElementTree.parse(file)
3232
root = tree.getroot()
3333
if "xml-report" not in root.tag:
3434
msg = "This doesn't seem to be a valid HCL ASoC SAST xml file."

dojo/tools/nikto/xml_parser.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
import logging
33
import re
44

5-
from defusedxml import ElementTree as ET
5+
from defusedxml import ElementTree
66
from django.core.exceptions import ValidationError
77

88
from dojo.models import Endpoint, Finding
@@ -13,7 +13,7 @@
1313
class NiktoXMLParser:
1414
def process_xml(self, file, test):
1515
dupes = {}
16-
tree = ET.parse(file)
16+
tree = ElementTree.parse(file)
1717
root = tree.getroot()
1818
scan = root.find("scandetails")
1919
if scan is not None:

dojo/tools/openvas/xml_parser.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
import contextlib
22
from xml.dom import NamespaceErr
33

4-
from defusedxml import ElementTree as ET
4+
from defusedxml import ElementTree
55

66
from dojo.models import Endpoint, Finding
77

88

99
class OpenVASXMLParser:
1010
def get_findings(self, filename, test):
1111
findings = []
12-
tree = ET.parse(filename)
12+
tree = ElementTree.parse(filename)
1313
root = tree.getroot()
1414
if "report" not in root.tag:
1515
msg = "This doesn't seem to be a valid Greenbone OpenVAS XML file."

dojo/tools/spotbugs/parser.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import re
22

33
import html2text
4-
from defusedxml import ElementTree as ET
4+
from defusedxml import ElementTree
55

66
from dojo.models import Finding
77

@@ -26,7 +26,7 @@ def get_findings(self, filename, test):
2626

2727
SEVERITY = {"1": "High", "2": "Medium", "3": "Low"}
2828

29-
tree = ET.parse(filename)
29+
tree = ElementTree.parse(filename)
3030
root = tree.getroot()
3131

3232
html_parser = html2text.HTML2Text()
@@ -36,7 +36,7 @@ def get_findings(self, filename, test):
3636
for pattern in root.findall("BugPattern"):
3737
# Parse <BugPattern>...<Details> html content
3838
html_text = html_parser.handle(
39-
ET.tostring(pattern.find("Details"), method="text").decode(
39+
ElementTree.tostring(pattern.find("Details"), method="text").decode(
4040
"utf-8",
4141
),
4242
)

dojo/tools/sslscan/parser.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import hashlib
22
from xml.dom import NamespaceErr
33

4-
from defusedxml import ElementTree as ET
4+
from defusedxml import ElementTree
55

66
from dojo.models import Endpoint, Finding
77

@@ -19,7 +19,7 @@ def get_description_for_scan_types(self, scan_type):
1919
return "Import XML output of sslscan report."
2020

2121
def get_findings(self, file, test):
22-
tree = ET.parse(file)
22+
tree = ElementTree.parse(file)
2323
# get root of tree.
2424
root = tree.getroot()
2525
if "document" not in root.tag:

dojo/tools/sslyze/parser_xml.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import hashlib
22
from xml.dom import NamespaceErr
33

4-
from defusedxml import ElementTree as ET
4+
from defusedxml import ElementTree
55

66
from dojo.models import Endpoint, Finding
77

@@ -51,7 +51,7 @@
5151

5252
class SSLyzeXMLParser:
5353
def get_findings(self, file, test):
54-
tree = ET.parse(file)
54+
tree = ElementTree.parse(file)
5555
# get root of tree.
5656
root = tree.getroot()
5757
if "document" not in root.tag:

dojo/tools/xanitizer/parser.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
import re
44

5-
from defusedxml import ElementTree as ET
5+
from defusedxml import ElementTree
66

77
from dojo.models import Finding
88

@@ -28,7 +28,7 @@ def get_findings(self, filename, test):
2828

2929
def parse_xml(self, filename):
3030
try:
31-
tree = ET.parse(filename)
31+
tree = ElementTree.parse(filename)
3232
except SyntaxError as se:
3333
raise ValueError(se)
3434

dojo/tools/zap/parser.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
from defusedxml import ElementTree as ET
1+
from defusedxml import ElementTree
22
from html2text import html2text
33

44
from dojo.models import Endpoint, Finding
@@ -68,7 +68,7 @@ def get_findings(self, file, test):
6868
if not file.name.endswith(".xml"):
6969
msg = "Internal error: Wrong file format, please use xml."
7070
raise ValueError(msg)
71-
tree = ET.parse(file)
71+
tree = ElementTree.parse(file)
7272
items = []
7373
for node in tree.findall("site"):
7474
for item in node.findall("alerts/alertitem"):

0 commit comments

Comments
 (0)