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

UP023 [*] `cElementTree` is deprecated, use `ElementTree`
 --> UP023.py:3:8
  |
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
  |        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
4 |
5 | # Weird spacing should not cause issues.
  |
help: Replace with `ElementTree`
  |
2 | from xml.etree.cElementTree import XML, Element, SubElement
  - import xml.etree.cElementTree as ET
3 + import xml.etree.ElementTree as ET
4 |
  |

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

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

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

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

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

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

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

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