mirror of https://github.com/astral-sh/ruff
Fix future-to-__future__ typo (#85)
This commit is contained in:
parent
994f5d452c
commit
bf4722a62f
|
|
@ -1,3 +1,4 @@
|
||||||
|
from __future__ import all_feature_names
|
||||||
import os
|
import os
|
||||||
import functools
|
import functools
|
||||||
from collections import (
|
from collections import (
|
||||||
|
|
|
||||||
|
|
@ -195,12 +195,11 @@ impl Visitor for Checker<'_> {
|
||||||
.asname
|
.asname
|
||||||
.clone()
|
.clone()
|
||||||
.unwrap_or_else(|| alias.node.name.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(
|
self.add_binding(
|
||||||
name,
|
name,
|
||||||
Binding {
|
Binding {
|
||||||
kind: BindingKind::FutureImportation,
|
kind: BindingKind::FutureImportation,
|
||||||
|
|
||||||
used: Some(self.scopes.last().expect("No current scope found.").id),
|
used: Some(self.scopes.last().expect("No current scope found.").id),
|
||||||
location: stmt.location,
|
location: stmt.location,
|
||||||
},
|
},
|
||||||
|
|
@ -210,7 +209,6 @@ impl Visitor for Checker<'_> {
|
||||||
name,
|
name,
|
||||||
Binding {
|
Binding {
|
||||||
kind: BindingKind::StarImportation,
|
kind: BindingKind::StarImportation,
|
||||||
|
|
||||||
used: None,
|
used: None,
|
||||||
location: stmt.location,
|
location: stmt.location,
|
||||||
},
|
},
|
||||||
|
|
|
||||||
|
|
@ -103,17 +103,17 @@ mod tests {
|
||||||
let expected = vec![
|
let expected = vec![
|
||||||
Message {
|
Message {
|
||||||
kind: CheckKind::UnusedImport("logging.handlers".to_string()),
|
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(),
|
filename: "./resources/test/src/F401.py".to_string(),
|
||||||
},
|
},
|
||||||
Message {
|
Message {
|
||||||
kind: CheckKind::UnusedImport("functools".to_string()),
|
kind: CheckKind::UnusedImport("functools".to_string()),
|
||||||
location: Location::new(2, 1),
|
location: Location::new(3, 1),
|
||||||
filename: "./resources/test/src/F401.py".to_string(),
|
filename: "./resources/test/src/F401.py".to_string(),
|
||||||
},
|
},
|
||||||
Message {
|
Message {
|
||||||
kind: CheckKind::UnusedImport("collections.OrderedDict".to_string()),
|
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(),
|
filename: "./resources/test/src/F401.py".to_string(),
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue