Fix future-to-__future__ typo (#85)

This commit is contained in:
Charlie Marsh 2022-09-02 08:56:26 -04:00 committed by GitHub
parent 994f5d452c
commit bf4722a62f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 5 additions and 6 deletions

View File

@ -1,3 +1,4 @@
from __future__ import all_feature_names
import os
import functools
from collections import (

View File

@ -195,12 +195,11 @@ impl Visitor for Checker<'_> {
.asname
.clone()
.unwrap_or_else(|| alias.node.name.clone());
if let Some("future") = module.as_deref() {
if let Some("__future__") = module.as_deref() {
self.add_binding(
name,
Binding {
kind: BindingKind::FutureImportation,
used: Some(self.scopes.last().expect("No current scope found.").id),
location: stmt.location,
},
@ -210,7 +209,6 @@ impl Visitor for Checker<'_> {
name,
Binding {
kind: BindingKind::StarImportation,
used: None,
location: stmt.location,
},

View File

@ -103,17 +103,17 @@ mod tests {
let expected = vec![
Message {
kind: CheckKind::UnusedImport("logging.handlers".to_string()),
location: Location::new(11, 1),
location: Location::new(12, 1),
filename: "./resources/test/src/F401.py".to_string(),
},
Message {
kind: CheckKind::UnusedImport("functools".to_string()),
location: Location::new(2, 1),
location: Location::new(3, 1),
filename: "./resources/test/src/F401.py".to_string(),
},
Message {
kind: CheckKind::UnusedImport("collections.OrderedDict".to_string()),
location: Location::new(3, 1),
location: Location::new(4, 1),
filename: "./resources/test/src/F401.py".to_string(),
},
];