---
source: crates/ruff_linter/src/rules/pyupgrade/mod.rs
---
UP023.py:2:1: UP023 [*] `cElementTree` is deprecated, use `ElementTree`
  |
1 | # These two imports have something after cElementTree, so they should be fixed.
2 | from xml.etree.cElementTree import XML, Element, SubElement
  | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ UP023
3 | import xml.etree.cElementTree as ET
  |
  = help: Replace with `ElementTree`

ℹ Safe fix
1 1 | # These two imports have something after cElementTree, so they should be fixed.
2   |-from xml.etree.cElementTree import XML, Element, SubElement
  2 |+from xml.etree.ElementTree import XML, Element, SubElement
3 3 | import xml.etree.cElementTree as ET
4 4 | 
5 5 | # Weird spacing should not cause issues.

UP023.py:3:8: UP023 [*] `cElementTree` is deprecated, use `ElementTree`
  |
1 | # These two imports have something after cElementTree, so they should be fixed.
2 | from xml.etree.cElementTree import XML, Element, SubElement
3 | import xml.etree.cElementTree as ET
  |        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ UP023
4 | 
5 | # Weird spacing should not cause issues.
  |
  = help: Replace with `ElementTree`

ℹ Safe fix
1 1 | # These two imports have something after cElementTree, so they should be fixed.
2 2 | from xml.etree.cElementTree import XML, Element, SubElement
3   |-import xml.etree.cElementTree as ET
  3 |+import xml.etree.ElementTree as ET
4 4 | 
5 5 | # Weird spacing should not cause issues.
6 6 | from   xml.etree.cElementTree    import  XML

UP023.py:6:1: UP023 [*] `cElementTree` is deprecated, use `ElementTree`
  |
5 | # Weird spacing should not cause issues.
6 | from   xml.etree.cElementTree    import  XML
  | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ UP023
7 | import    xml.etree.cElementTree       as      ET
  |
  = help: Replace with `ElementTree`

ℹ Safe fix
3 3 | import xml.etree.cElementTree as ET
4 4 | 
5 5 | # Weird spacing should not cause issues.
6   |-from   xml.etree.cElementTree    import  XML
  6 |+from   xml.etree.ElementTree    import  XML
7 7 | import    xml.etree.cElementTree       as      ET
8 8 | 
9 9 | # Multi line imports should also work fine.

UP023.py:7:11: UP023 [*] `cElementTree` is deprecated, use `ElementTree`
  |
5 | # Weird spacing should not cause issues.
6 | from   xml.etree.cElementTree    import  XML
7 | import    xml.etree.cElementTree       as      ET
  |           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ UP023
8 | 
9 | # Multi line imports should also work fine.
  |
  = help: Replace with `ElementTree`

ℹ Safe fix
4 4 | 
5 5 | # Weird spacing should not cause issues.
6 6 | from   xml.etree.cElementTree    import  XML
7   |-import    xml.etree.cElementTree       as      ET
  7 |+import    xml.etree.ElementTree       as      ET
8 8 | 
9 9 | # Multi line imports should also work fine.
10 10 | from xml.etree.cElementTree import (

UP023.py:10:1: UP023 [*] `cElementTree` is deprecated, use `ElementTree`
   |
 9 |   # Multi line imports should also work fine.
10 | / from xml.etree.cElementTree import (
11 | |     XML,
12 | |     Element,
13 | |     SubElement,
14 | | )
   | |_^ UP023
15 |   if True:
16 |       import xml.etree.cElementTree as ET
   |
   = help: Replace with `ElementTree`

ℹ Safe fix
7  7  | import    xml.etree.cElementTree       as      ET
8  8  | 
9  9  | # Multi line imports should also work fine.
10    |-from xml.etree.cElementTree import (
   10 |+from xml.etree.ElementTree import (
11 11 |     XML,
12 12 |     Element,
13 13 |     SubElement,

UP023.py:16:12: UP023 [*] `cElementTree` is deprecated, use `ElementTree`
   |
14 | )
15 | if True:
16 |     import xml.etree.cElementTree as ET
   |            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ UP023
17 |     from xml.etree import cElementTree as CET
   |
   = help: Replace with `ElementTree`

ℹ Safe fix
13 13 |     SubElement,
14 14 | )
15 15 | if True:
16    |-    import xml.etree.cElementTree as ET
   16 |+    import xml.etree.ElementTree as ET
17 17 |     from xml.etree import cElementTree as CET
18 18 | 
19 19 | from xml.etree import cElementTree as ET

UP023.py:17:27: UP023 [*] `cElementTree` is deprecated, use `ElementTree`
   |
15 | if True:
16 |     import xml.etree.cElementTree as ET
17 |     from xml.etree import cElementTree as CET
   |                           ^^^^^^^^^^^^^^^^^^^ UP023
18 | 
19 | from xml.etree import cElementTree as ET
   |
   = help: Replace with `ElementTree`

ℹ Safe fix
14 14 | )
15 15 | if True:
16 16 |     import xml.etree.cElementTree as ET
17    |-    from xml.etree import cElementTree as CET
   17 |+    from xml.etree import ElementTree as CET
18 18 | 
19 19 | from xml.etree import cElementTree as ET
20 20 | 

UP023.py:19:23: UP023 [*] `cElementTree` is deprecated, use `ElementTree`
   |
17 |     from xml.etree import cElementTree as CET
18 | 
19 | from xml.etree import cElementTree as ET
   |                       ^^^^^^^^^^^^^^^^^^ UP023
20 | 
21 | import contextlib, xml.etree.cElementTree as ET
   |
   = help: Replace with `ElementTree`

ℹ Safe fix
16 16 |     import xml.etree.cElementTree as ET
17 17 |     from xml.etree import cElementTree as CET
18 18 | 
19    |-from xml.etree import cElementTree as ET
   19 |+from xml.etree import ElementTree as ET
20 20 | 
21 21 | import contextlib, xml.etree.cElementTree as ET
22 22 | 

UP023.py:21:20: UP023 [*] `cElementTree` is deprecated, use `ElementTree`
   |
19 | from xml.etree import cElementTree as ET
20 | 
21 | import contextlib, xml.etree.cElementTree as ET
   |                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ UP023
22 | 
23 | # This should fix the second, but not the first invocation.
   |
   = help: Replace with `ElementTree`

ℹ Safe fix
18 18 | 
19 19 | from xml.etree import cElementTree as ET
20 20 | 
21    |-import contextlib, xml.etree.cElementTree as ET
   21 |+import contextlib, xml.etree.ElementTree as ET
22 22 | 
23 23 | # This should fix the second, but not the first invocation.
24 24 | import xml.etree.cElementTree, xml.etree.cElementTree as ET

UP023.py:24:32: UP023 [*] `cElementTree` is deprecated, use `ElementTree`
   |
23 | # This should fix the second, but not the first invocation.
24 | import xml.etree.cElementTree, xml.etree.cElementTree as ET
   |                                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ UP023
25 | 
26 | # The below items should NOT be changed.
   |
   = help: Replace with `ElementTree`

ℹ Safe fix
21 21 | import contextlib, xml.etree.cElementTree as ET
22 22 | 
23 23 | # This should fix the second, but not the first invocation.
24    |-import xml.etree.cElementTree, xml.etree.cElementTree as ET
   24 |+import xml.etree.cElementTree, xml.etree.ElementTree as ET
25 25 | 
26 26 | # The below items should NOT be changed.
27 27 | import xml.etree.cElementTree


