Flake8 with pep8-naming complains about camelCase imports
Asked Answered
N

1

5

I tried using the following:

import xml.etree.ElementTree as ET

but flake8 with pep8-naming gives the following warning:

N817 camelcase 'xml.etree.ElementTree' imported as acronym 'ET'

then I tried:

import xml.etree.ElementTree as et
import xml.etree.ElementTree as element_tree

but yet again:

N813 camelcase 'xml.etree.ElementTree' imported as lowercase 'et'

What does flake8 want here?

Niels answered 22/4, 2021 at 12:47 Comment(1)
You can also disable N817 on that line with # noqa: N817 if you don't careHomework
N
6

Flake8 is ok with the following acronyms:

import xml.etree.ElementTree as Et
import xml.etree.ElementTree as eT

More verbose variants are also possible:

import xml.etree.ElementTree as ETree
import xml.etree.ElementTree as eTree
import xml.etree.ElementTree as ElementTree
Niels answered 22/4, 2021 at 12:47 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.