Module is imported with ‘import’ and ‘import from’¶
ID: py/import-and-import-fromKind: problemSecurity severity: Severity: recommendationPrecision: very-highTags: - quality - maintainability - readabilityQuery suites: - python-security-and-quality.qls
Click to see the query in the CodeQL repository
Importing a module twice using theimportxxx andfromxxximportyyy is confusing.
Recommendation¶
Remove thefromxxximportyyy statement. Addyyy=xxx.yyy if required.
Example¶
importosfromosimportwalk
References¶
Python Language Reference:The import statement.