From 5cc439d8461b04980da9a110c8c19ad5db1f6dad Mon Sep 17 00:00:00 2001 From: Andrew Senetar Date: Tue, 30 Jun 2020 00:51:06 -0500 Subject: [PATCH] Clean up rest of DeprecationWarnings --- core/directories.py | 4 ++-- core/results.py | 6 +++--- core/tests/results_test.py | 6 +++--- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/core/directories.py b/core/directories.py index 75477619..66ba8163 100644 --- a/core/directories.py +++ b/core/directories.py @@ -224,7 +224,7 @@ class Directories: root = ET.parse(infile).getroot() except Exception: return - for rdn in root.getiterator("root_directory"): + for rdn in root.iter("root_directory"): attrib = rdn.attrib if "path" not in attrib: continue @@ -233,7 +233,7 @@ class Directories: self.add_path(Path(path)) except (AlreadyThereError, InvalidPathError): pass - for sn in root.getiterator("state"): + for sn in root.iter("state"): attrib = sn.attrib if not ("path" in attrib and "value" in attrib): continue diff --git a/core/results.py b/core/results.py index 75c9e16a..1b3387d8 100644 --- a/core/results.py +++ b/core/results.py @@ -241,13 +241,13 @@ class Results(Markable): self.apply_filter(None) root = ET.parse(infile).getroot() - group_elems = list(root.getiterator("group")) + group_elems = list(root.iter("group")) groups = [] marked = set() for group_elem in j.iter_with_progress(group_elems, every=100): group = engine.Group() dupes = [] - for file_elem in group_elem.getiterator("file"): + for file_elem in group_elem.iter("file"): path = file_elem.get("path") words = file_elem.get("words", "") if not path: @@ -260,7 +260,7 @@ class Results(Markable): dupes.append(file) if file_elem.get("marked") == "y": marked.add(file) - for match_elem in group_elem.getiterator("match"): + for match_elem in group_elem.iter("match"): try: attrs = match_elem.attrib first_file = dupes[int(attrs["first"])] diff --git a/core/tests/results_test.py b/core/tests/results_test.py index 1f9e5ea6..fb7c5f0c 100644 --- a/core/tests/results_test.py +++ b/core/tests/results_test.py @@ -414,12 +414,12 @@ class TestCaseResultsMarkings: f.seek(0) doc = ET.parse(f) root = doc.getroot() - g1, g2 = root.getiterator("group") - d1, d2, d3 = g1.getiterator("file") + g1, g2 = root.iter("group") + d1, d2, d3 = g1.iter("file") eq_("n", d1.get("marked")) eq_("n", d2.get("marked")) eq_("y", d3.get("marked")) - d1, d2 = g2.getiterator("file") + d1, d2 = g2.iter("file") eq_("n", d1.get("marked")) eq_("y", d2.get("marked"))