Skip to content

N817 not correctly detecting from xml.etree import ElementTree as ET #12940

@lengau

Description

@lengau

In ruff 0.6.1, this file:

from xml.etree import ElementTree as ET

_ = ET

causes N817 to trigger an error with the default ruff settings,even though the default value of lint.flake8-import-conventions contains that mapping and it's supposed to be ignored according to the docs.

$ ruff check --fix --unsafe-fixes --select ICN001,N817 sample.py 
sample.py:2:23: N817 CamelCase `ElementTree` imported as acronym `ET`
  |
2 | from xml.etree import ElementTree as ET
  |                       ^^^^^^^^^^^^^^^^^ N817
3 | 
4 | _ = ET
  |

Found 1 error.
import xml.etree.ElementTree as ET

_ = ET

failed in 0.6.0 but is fixed in 0.6.1

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions