diff --git a/crates/ruff_linter/resources/test/fixtures/pyupgrade/UP035.py b/crates/ruff_linter/resources/test/fixtures/pyupgrade/UP035_0.py similarity index 100% rename from crates/ruff_linter/resources/test/fixtures/pyupgrade/UP035.py rename to crates/ruff_linter/resources/test/fixtures/pyupgrade/UP035_0.py diff --git a/crates/ruff_linter/resources/test/fixtures/pyupgrade/UP035_1.py b/crates/ruff_linter/resources/test/fixtures/pyupgrade/UP035_1.py new file mode 100644 index 0000000000000..ac580817ad571 --- /dev/null +++ b/crates/ruff_linter/resources/test/fixtures/pyupgrade/UP035_1.py @@ -0,0 +1,29 @@ +"""Things that were moved from `collections` to `collections.abc`.""" + +from collections import ( + AsyncGenerator, + AsyncIterable, + AsyncIterator, + Awaitable, + ByteString, + Callable, + Collection, + Container, + Coroutine, + Generator, + Hashable, + ItemsView, + Iterable, + Iterator, + KeysView, + Mapping, + MappingView, + MutableMapping, + MutableSequence, + MutableSet, + Reversible, + Sequence, + Set, + Sized, + ValuesView, +) diff --git a/crates/ruff_linter/resources/test/fixtures/pyupgrade/UP035_2.py b/crates/ruff_linter/resources/test/fixtures/pyupgrade/UP035_2.py new file mode 100644 index 0000000000000..8cd9a8a784c39 --- /dev/null +++ b/crates/ruff_linter/resources/test/fixtures/pyupgrade/UP035_2.py @@ -0,0 +1,98 @@ +"""Things that were moved from `typing_extensions` to `typing`.""" +from typing_extensions import AbstractSet +from typing_extensions import AnyStr +from typing_extensions import AsyncIterable +from typing_extensions import AsyncIterator +from typing_extensions import Awaitable +from typing_extensions import BinaryIO +from typing_extensions import Callable +from typing_extensions import ClassVar +from typing_extensions import Collection +from typing_extensions import Container +from typing_extensions import ContextManager +from typing_extensions import Coroutine +from typing_extensions import DefaultDict +from typing_extensions import Dict +from typing_extensions import FrozenSet +from typing_extensions import Generator +from typing_extensions import Generic +from typing_extensions import Hashable +from typing_extensions import IO +from typing_extensions import ItemsView +from typing_extensions import Iterable +from typing_extensions import KeysView +from typing_extensions import List +from typing_extensions import Mapping +from typing_extensions import MappingView +from typing_extensions import Match +from typing_extensions import MutableMapping +from typing_extensions import MutableSequence +from typing_extensions import MutableSet +from typing_extensions import Optional +from typing_extensions import Pattern +from typing_extensions import Reversible +from typing_extensions import Sequence +from typing_extensions import Set +from typing_extensions import Sized +from typing_extensions import TYPE_CHECKING +from typing_extensions import Text +from typing_extensions import TextIO +from typing_extensions import Tuple +from typing_extensions import Type +from typing_extensions import Union +from typing_extensions import ValuesView +from typing_extensions import cast +from typing_extensions import no_type_check +from typing_extensions import no_type_check_decorator + +from typing_extensions import AsyncContextManager +from typing_extensions import AsyncGenerator +from typing_extensions import ChainMap +from typing_extensions import Counter +from typing_extensions import Deque +from typing_extensions import ForwardRef +from typing_extensions import NoReturn + +from typing_extensions import Final +from typing_extensions import OrderedDict +from typing_extensions import runtime_checkable + +from typing_extensions import Annotated +from typing_extensions import get_type_hints + +from typing_extensions import Concatenate +from typing_extensions import Literal +from typing_extensions import NewType +from typing_extensions import ParamSpecArgs +from typing_extensions import ParamSpecKwargs +from typing_extensions import TypeAlias +from typing_extensions import TypeGuard +from typing_extensions import get_args +from typing_extensions import get_origin +from typing_extensions import is_typeddict + +from typing_extensions import Any +from typing_extensions import LiteralString +from typing_extensions import Never +from typing_extensions import NotRequired +from typing_extensions import Required +from typing_extensions import Self +from typing_extensions import assert_never +from typing_extensions import assert_type +from typing_extensions import clear_overloads +from typing_extensions import final +from typing_extensions import get_overloads +from typing_extensions import overload +from typing_extensions import reveal_type + +from typing_extensions import Protocol +from typing_extensions import SupportsAbs +from typing_extensions import SupportsBytes +from typing_extensions import SupportsComplex +from typing_extensions import SupportsFloat +from typing_extensions import SupportsInt +from typing_extensions import SupportsRound +from typing_extensions import Unpack +from typing_extensions import dataclass_transform +from typing_extensions import NamedTuple +from typing_extensions import TypedDict diff --git a/crates/ruff_linter/resources/test/fixtures/pyupgrade/UP035_3.py b/crates/ruff_linter/resources/test/fixtures/pyupgrade/UP035_3.py new file mode 100644 index 0000000000000..1d247b468d669 --- /dev/null +++ b/crates/ruff_linter/resources/test/fixtures/pyupgrade/UP035_3.py @@ -0,0 +1,2 @@ +"""Things moved from `pipes` to `shlex`.""" +from pipes import quote diff --git a/crates/ruff_linter/resources/test/fixtures/pyupgrade/UP035_4.py b/crates/ruff_linter/resources/test/fixtures/pyupgrade/UP035_4.py new file mode 100644 index 0000000000000..85d4f4a66c080 --- /dev/null +++ b/crates/ruff_linter/resources/test/fixtures/pyupgrade/UP035_4.py @@ -0,0 +1,4 @@ +"""Things moved from `mypy_extensions` to `typing`.""" +from mypy_extensions import NoReturn + +from mypy_extensions import TypedDict diff --git a/crates/ruff_linter/resources/test/fixtures/pyupgrade/UP035_5.py b/crates/ruff_linter/resources/test/fixtures/pyupgrade/UP035_5.py new file mode 100644 index 0000000000000..828e876c55f44 --- /dev/null +++ b/crates/ruff_linter/resources/test/fixtures/pyupgrade/UP035_5.py @@ -0,0 +1,26 @@ +"""Members of `typing` that were moved to `collections.abc`.""" +from typing import AsyncGenerator +from typing import AsyncIterable +from typing import AsyncIterator +from typing import Awaitable +from typing import ByteString +from typing import Collection +from typing import Container +from typing import Coroutine +from typing import Generator +from typing import Hashable +from typing import ItemsView +from typing import Iterable +from typing import Iterator +from typing import KeysView +from typing import Mapping +from typing import MappingView +from typing import MutableMapping +from typing import MutableSequence +from typing import MutableSet +from typing import Reversible +from typing import Sequence +from typing import Sized +from typing import ValuesView + +from typing import Callable diff --git a/crates/ruff_linter/resources/test/fixtures/pyupgrade/UP035_6.py b/crates/ruff_linter/resources/test/fixtures/pyupgrade/UP035_6.py new file mode 100644 index 0000000000000..771aad59bd13d --- /dev/null +++ b/crates/ruff_linter/resources/test/fixtures/pyupgrade/UP035_6.py @@ -0,0 +1,4 @@ +"""Members of `typing` that were moved to `collections`.""" +from typing import ChainMap +from typing import Counter +from typing import OrderedDict diff --git a/crates/ruff_linter/resources/test/fixtures/pyupgrade/UP035_7.py b/crates/ruff_linter/resources/test/fixtures/pyupgrade/UP035_7.py new file mode 100644 index 0000000000000..fb4f9b17d7e1f --- /dev/null +++ b/crates/ruff_linter/resources/test/fixtures/pyupgrade/UP035_7.py @@ -0,0 +1,3 @@ +"""Members of `typing` that were moved to `typing.re`.""" +from typing import Match +from typing import Pattern diff --git a/crates/ruff_linter/resources/test/fixtures/pyupgrade/UP035_8.py b/crates/ruff_linter/resources/test/fixtures/pyupgrade/UP035_8.py new file mode 100644 index 0000000000000..b4a4263757506 --- /dev/null +++ b/crates/ruff_linter/resources/test/fixtures/pyupgrade/UP035_8.py @@ -0,0 +1,3 @@ +"""Members of `typing.re` that were moved to `re`.""" +from typing.re import Match +from typing.re import Pattern diff --git a/crates/ruff_linter/resources/test/fixtures/pyupgrade/UP035_9.py b/crates/ruff_linter/resources/test/fixtures/pyupgrade/UP035_9.py new file mode 100644 index 0000000000000..4f830e03595af --- /dev/null +++ b/crates/ruff_linter/resources/test/fixtures/pyupgrade/UP035_9.py @@ -0,0 +1,2 @@ +"""Members of `backports.strenum` that were moved to `enum`.""" +from backports.strenum import StrEnum diff --git a/crates/ruff_linter/src/rules/pyupgrade/mod.rs b/crates/ruff_linter/src/rules/pyupgrade/mod.rs index 194bcef73fa3f..e7ca7bd573396 100644 --- a/crates/ruff_linter/src/rules/pyupgrade/mod.rs +++ b/crates/ruff_linter/src/rules/pyupgrade/mod.rs @@ -21,7 +21,16 @@ mod tests { #[test_case(Rule::ConvertNamedTupleFunctionalToClass, Path::new("UP014.py"))] #[test_case(Rule::ConvertTypedDictFunctionalToClass, Path::new("UP013.py"))] #[test_case(Rule::DeprecatedCElementTree, Path::new("UP023.py"))] - #[test_case(Rule::DeprecatedImport, Path::new("UP035.py"))] + #[test_case(Rule::DeprecatedImport, Path::new("UP035_0.py"))] + #[test_case(Rule::DeprecatedImport, Path::new("UP035_1.py"))] + #[test_case(Rule::DeprecatedImport, Path::new("UP035_2.py"))] + #[test_case(Rule::DeprecatedImport, Path::new("UP035_3.py"))] + #[test_case(Rule::DeprecatedImport, Path::new("UP035_4.py"))] + #[test_case(Rule::DeprecatedImport, Path::new("UP035_5.py"))] + #[test_case(Rule::DeprecatedImport, Path::new("UP035_6.py"))] + #[test_case(Rule::DeprecatedImport, Path::new("UP035_7.py"))] + #[test_case(Rule::DeprecatedImport, Path::new("UP035_8.py"))] + #[test_case(Rule::DeprecatedImport, Path::new("UP035_9.py"))] #[test_case(Rule::DeprecatedMockImport, Path::new("UP026.py"))] #[test_case(Rule::DeprecatedUnittestAlias, Path::new("UP005.py"))] #[test_case(Rule::ExtraneousParentheses, Path::new("UP034.py"))] diff --git a/crates/ruff_linter/src/rules/pyupgrade/rules/deprecated_import.rs b/crates/ruff_linter/src/rules/pyupgrade/rules/deprecated_import.rs index 01e7e35f6775a..b1b9ed7310afb 100644 --- a/crates/ruff_linter/src/rules/pyupgrade/rules/deprecated_import.rs +++ b/crates/ruff_linter/src/rules/pyupgrade/rules/deprecated_import.rs @@ -111,6 +111,7 @@ fn is_relevant_module(module: &str) -> bool { } // Members of `collections` that were moved to `collections.abc`. +// These fixes are safe. const COLLECTIONS_TO_ABC: &[&str] = &[ "AsyncGenerator", "AsyncIterable", @@ -140,9 +141,11 @@ const COLLECTIONS_TO_ABC: &[&str] = &[ ]; // Members of `pipes` that were moved to `shlex`. +// These fixes are safe. const PIPES_TO_SHLEX: &[&str] = &["quote"]; // Members of `typing_extensions` that were moved to `typing`. +// These fixes are safe. const TYPING_EXTENSIONS_TO_TYPING: &[&str] = &[ "AbstractSet", "AnyStr", @@ -198,9 +201,11 @@ const TYPING_EXTENSIONS_TO_TYPING: &[&str] = &[ // Python 3.7+ // Members of `mypy_extensions` that were moved to `typing`. +// This fix is unsafe. const MYPY_EXTENSIONS_TO_TYPING_37: &[&str] = &["NoReturn"]; // Members of `typing_extensions` that were moved to `typing`. +// These fixes are safe. const TYPING_EXTENSIONS_TO_TYPING_37: &[&str] = &[ "AsyncContextManager", "AsyncGenerator", @@ -214,9 +219,11 @@ const TYPING_EXTENSIONS_TO_TYPING_37: &[&str] = &[ // Python 3.8+ // Members of `mypy_extensions` that were moved to `typing`. +// This fix is unsafe. const MYPY_EXTENSIONS_TO_TYPING_38: &[&str] = &["TypedDict"]; // Members of `typing_extensions` that were moved to `typing`. +// These fixes are safe. const TYPING_EXTENSIONS_TO_TYPING_38: &[&str] = &[ "Final", "OrderedDict", @@ -231,6 +238,7 @@ const TYPING_EXTENSIONS_TO_TYPING_38: &[&str] = &[ // Python 3.9+ // Members of `typing` that were moved to `collections.abc`. +// These fixes are unsafe. const TYPING_TO_COLLECTIONS_ABC_39: &[&str] = &[ "AsyncGenerator", "AsyncIterable", @@ -258,16 +266,20 @@ const TYPING_TO_COLLECTIONS_ABC_39: &[&str] = &[ ]; // Members of `typing` that were moved to `collections`. +// These fixes is unsafe. const TYPING_TO_COLLECTIONS_39: &[&str] = &["ChainMap", "Counter", "OrderedDict"]; // Members of `typing` that were moved to `typing.re`. +// These fixes are unsafe. const TYPING_TO_RE_39: &[&str] = &["Match", "Pattern"]; // Members of `typing.re` that were moved to `re`. +// These are fixes are unsafe. const TYPING_RE_TO_RE_39: &[&str] = &["Match", "Pattern"]; // Members of `typing_extensions` that were moved to `typing`. -const TYPING_EXTENSIONS_TO_TYPING_39: &[&str] = &["Annotated", "get_type_hints"]; +const TYPING_EXTENSIONS_TO_TYPING_39_SAFE: &[&str] = &["Annotated"]; +const TYPING_EXTENSIONS_TO_TYPING_39_UNSAFE: &[&str] = &["get_type_hints"]; // Members of `typing` that were moved _and_ renamed (and thus cannot be // automatically fixed). @@ -291,10 +303,11 @@ const TYPING_TO_RENAME_PY39: &[(&str, &str)] = &[ // Python 3.10+ // Members of `typing` that were moved to `collections.abc`. +// This fix is unsafe. const TYPING_TO_COLLECTIONS_ABC_310: &[&str] = &["Callable"]; // Members of `typing_extensions` that were moved to `typing`. -const TYPING_EXTENSIONS_TO_TYPING_310: &[&str] = &[ +const TYPING_EXTENSIONS_TO_TYPING_310_SAFE: &[&str] = &[ "Concatenate", "Literal", "NewType", @@ -304,12 +317,13 @@ const TYPING_EXTENSIONS_TO_TYPING_310: &[&str] = &[ "TypeGuard", "get_args", "get_origin", - "is_typeddict", ]; +const TYPING_EXTENSIONS_TO_TYPING_310_UNSAFE: &[&str] = &["is_typeddict"]; // Python 3.11+ // Members of `typing_extensions` that were moved to `typing`. +// These fixes are safe. const TYPING_EXTENSIONS_TO_TYPING_311: &[&str] = &[ "Any", "LiteralString", @@ -326,13 +340,14 @@ const TYPING_EXTENSIONS_TO_TYPING_311: &[&str] = &[ "reveal_type", ]; +// Members of `backports.strenum` that are now in `enum`. +// This fix is unsafe. const BACKPORTS_STR_ENUM_TO_ENUM_311: &[&str] = &["StrEnum"]; // Python 3.12+ // Members of `typing_extensions` that were moved to `typing`. -const TYPING_EXTENSIONS_TO_TYPING_312: &[&str] = &[ - "NamedTuple", +const TYPING_EXTENSIONS_TO_TYPING_312_SAFE: &[&str] = &[ // Introduced in Python 3.8, but `typing_extensions` backports a ton of optimizations that were // added in Python 3.12. "Protocol", @@ -342,12 +357,12 @@ const TYPING_EXTENSIONS_TO_TYPING_312: &[&str] = &[ "SupportsFloat", "SupportsInt", "SupportsRound", - "TypedDict", "Unpack", // Introduced in Python 3.11, but `typing_extensions` backports the `frozen_default` argument, // which was introduced in Python 3.12. "dataclass_transform", ]; +const TYPING_EXTENSIONS_TO_TYPING_312_UNSAFE: &[&str] = &["NamedTuple", "TypedDict"]; struct ImportReplacer<'a> { stmt: &'a Stmt, @@ -425,16 +440,50 @@ impl<'a> ImportReplacer<'a> { typing_extensions_to_typing.extend(TYPING_EXTENSIONS_TO_TYPING_38); } if self.version >= PythonVersion::Py39 { - typing_extensions_to_typing.extend(TYPING_EXTENSIONS_TO_TYPING_39); + typing_extensions_to_typing.extend(TYPING_EXTENSIONS_TO_TYPING_39_SAFE); } if self.version >= PythonVersion::Py310 { - typing_extensions_to_typing.extend(TYPING_EXTENSIONS_TO_TYPING_310); + typing_extensions_to_typing.extend(TYPING_EXTENSIONS_TO_TYPING_310_SAFE); } if self.version >= PythonVersion::Py311 { typing_extensions_to_typing.extend(TYPING_EXTENSIONS_TO_TYPING_311); } if self.version >= PythonVersion::Py312 { - typing_extensions_to_typing.extend(TYPING_EXTENSIONS_TO_TYPING_312); + typing_extensions_to_typing.extend(TYPING_EXTENSIONS_TO_TYPING_312_SAFE); + } + if let Some(operation) = self.try_replace(&typing_extensions_to_typing, "typing") { + operations.push(operation); + } + } + "typing" => { + // `typing` to `re` + let mut typing_to_re = vec![]; + if self.version >= PythonVersion::Py39 { + typing_to_re.extend(TYPING_TO_RE_39); + } + if let Some(operation) = self.try_replace(&typing_to_re, "re") { + operations.push(operation); + } + } + + _ => {} + } + operations + } + + fn without_renames_unsafe(&self) -> Vec<(WithoutRename, Option)> { + let mut operations = vec![]; + match self.module { + "typing_extensions" => { + let mut typing_extensions_to_typing = vec![]; + if self.version >= PythonVersion::Py39 { + typing_extensions_to_typing.extend(TYPING_EXTENSIONS_TO_TYPING_39_UNSAFE); + } + if self.version >= PythonVersion::Py310 { + typing_extensions_to_typing.extend(TYPING_EXTENSIONS_TO_TYPING_310_UNSAFE); + } + if self.version >= PythonVersion::Py312 { + typing_extensions_to_typing.extend(TYPING_EXTENSIONS_TO_TYPING_312_UNSAFE); } if let Some(operation) = self.try_replace(&typing_extensions_to_typing, "typing") { operations.push(operation); @@ -466,7 +515,6 @@ impl<'a> ImportReplacer<'a> { { operations.push(operation); } - // `typing` to `collections` let mut typing_to_collections = vec![]; if self.version >= PythonVersion::Py39 { @@ -475,15 +523,6 @@ impl<'a> ImportReplacer<'a> { if let Some(operation) = self.try_replace(&typing_to_collections, "collections") { operations.push(operation); } - - // `typing` to `re` - let mut typing_to_re = vec![]; - if self.version >= PythonVersion::Py39 { - typing_to_re.extend(TYPING_TO_RE_39); - } - if let Some(operation) = self.try_replace(&typing_to_re, "re") { - operations.push(operation); - } } "typing.re" if self.version >= PythonVersion::Py39 => { if let Some(operation) = self.try_replace(TYPING_RE_TO_RE_39, "re") { @@ -652,6 +691,22 @@ pub(crate) fn deprecated_import( checker.diagnostics.push(diagnostic); } + for (operation, fix) in fixer.without_renames_unsafe() { + let mut diagnostic = Diagnostic::new( + DeprecatedImport { + deprecation: Deprecation::WithoutRename(operation), + }, + stmt.range(), + ); + if let Some(content) = fix { + diagnostic.set_fix(Fix::unsafe_edit(Edit::range_replacement( + content, + stmt.range(), + ))); + } + checker.diagnostics.push(diagnostic); + } + for operation in fixer.with_renames() { let diagnostic = Diagnostic::new( DeprecatedImport { diff --git a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP035_0.py.snap b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP035_0.py.snap new file mode 100644 index 0000000000000..55eb30985c06c --- /dev/null +++ b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP035_0.py.snap @@ -0,0 +1,1053 @@ +--- +source: crates/ruff_linter/src/rules/pyupgrade/mod.rs +--- +UP035_0.py:2:1: UP035 [*] Import from `collections.abc` instead: `Mapping` + | +1 | # UP035 +2 | from collections import Mapping + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ UP035 +3 | +4 | from collections import Mapping as MAP + | + = help: Import from `collections.abc` + +ℹ Safe fix +1 1 | # UP035 +2 |-from collections import Mapping + 2 |+from collections.abc import Mapping +3 3 | +4 4 | from collections import Mapping as MAP +5 5 | + +UP035_0.py:4:1: UP035 [*] Import from `collections.abc` instead: `Mapping` + | +2 | from collections import Mapping +3 | +4 | from collections import Mapping as MAP + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ UP035 +5 | +6 | from collections import Mapping, Sequence + | + = help: Import from `collections.abc` + +ℹ Safe fix +1 1 | # UP035 +2 2 | from collections import Mapping +3 3 | +4 |-from collections import Mapping as MAP + 4 |+from collections.abc import Mapping as MAP +5 5 | +6 6 | from collections import Mapping, Sequence +7 7 | + +UP035_0.py:6:1: UP035 [*] Import from `collections.abc` instead: `Mapping`, `Sequence` + | +4 | from collections import Mapping as MAP +5 | +6 | from collections import Mapping, Sequence + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ UP035 +7 | +8 | from collections import Counter, Mapping + | + = help: Import from `collections.abc` + +ℹ Safe fix +3 3 | +4 4 | from collections import Mapping as MAP +5 5 | +6 |-from collections import Mapping, Sequence + 6 |+from collections.abc import Mapping, Sequence +7 7 | +8 8 | from collections import Counter, Mapping +9 9 | + +UP035_0.py:8:1: UP035 [*] Import from `collections.abc` instead: `Mapping` + | + 6 | from collections import Mapping, Sequence + 7 | + 8 | from collections import Counter, Mapping + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ UP035 + 9 | +10 | from collections import (Counter, Mapping) + | + = help: Import from `collections.abc` + +ℹ Safe fix +5 5 | +6 6 | from collections import Mapping, Sequence +7 7 | +8 |-from collections import Counter, Mapping + 8 |+from collections import Counter + 9 |+from collections.abc import Mapping +9 10 | +10 11 | from collections import (Counter, Mapping) +11 12 | + +UP035_0.py:10:1: UP035 [*] Import from `collections.abc` instead: `Mapping` + | + 8 | from collections import Counter, Mapping + 9 | +10 | from collections import (Counter, Mapping) + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ UP035 +11 | +12 | from collections import (Counter, + | + = help: Import from `collections.abc` + +ℹ Safe fix +7 7 | +8 8 | from collections import Counter, Mapping +9 9 | +10 |-from collections import (Counter, Mapping) + 10 |+from collections import (Counter) + 11 |+from collections.abc import Mapping +11 12 | +12 13 | from collections import (Counter, +13 14 | Mapping) + +UP035_0.py:12:1: UP035 [*] Import from `collections.abc` instead: `Mapping` + | +10 | from collections import (Counter, Mapping) +11 | +12 | / from collections import (Counter, +13 | | Mapping) + | |_________________________________^ UP035 +14 | +15 | from collections import Counter, \ + | + = help: Import from `collections.abc` + +ℹ Safe fix +9 9 | +10 10 | from collections import (Counter, Mapping) +11 11 | +12 |-from collections import (Counter, +13 |- Mapping) + 12 |+from collections import (Counter) + 13 |+from collections.abc import Mapping +14 14 | +15 15 | from collections import Counter, \ +16 16 | Mapping + +UP035_0.py:15:1: UP035 [*] Import from `collections.abc` instead: `Mapping` + | +13 | Mapping) +14 | +15 | / from collections import Counter, \ +16 | | Mapping + | |________________________________^ UP035 +17 | +18 | from collections import Counter, Mapping, Sequence + | + = help: Import from `collections.abc` + +ℹ Safe fix +12 12 | from collections import (Counter, +13 13 | Mapping) +14 14 | +15 |-from collections import Counter, \ +16 |- Mapping + 15 |+from collections import Counter + 16 |+from collections.abc import Mapping +17 17 | +18 18 | from collections import Counter, Mapping, Sequence +19 19 | + +UP035_0.py:18:1: UP035 [*] Import from `collections.abc` instead: `Mapping`, `Sequence` + | +16 | Mapping +17 | +18 | from collections import Counter, Mapping, Sequence + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ UP035 +19 | +20 | from collections import Mapping as mapping, Counter + | + = help: Import from `collections.abc` + +ℹ Safe fix +15 15 | from collections import Counter, \ +16 16 | Mapping +17 17 | +18 |-from collections import Counter, Mapping, Sequence + 18 |+from collections import Counter + 19 |+from collections.abc import Mapping, Sequence +19 20 | +20 21 | from collections import Mapping as mapping, Counter +21 22 | + +UP035_0.py:20:1: UP035 [*] Import from `collections.abc` instead: `Mapping` + | +18 | from collections import Counter, Mapping, Sequence +19 | +20 | from collections import Mapping as mapping, Counter + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ UP035 +21 | +22 | if True: + | + = help: Import from `collections.abc` + +ℹ Safe fix +17 17 | +18 18 | from collections import Counter, Mapping, Sequence +19 19 | +20 |-from collections import Mapping as mapping, Counter + 20 |+from collections import Counter + 21 |+from collections.abc import Mapping as mapping +21 22 | +22 23 | if True: +23 24 | from collections import Mapping, Counter + +UP035_0.py:23:5: UP035 [*] Import from `collections.abc` instead: `Mapping` + | +22 | if True: +23 | from collections import Mapping, Counter + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ UP035 +24 | +25 | if True: + | + = help: Import from `collections.abc` + +ℹ Safe fix +20 20 | from collections import Mapping as mapping, Counter +21 21 | +22 22 | if True: +23 |- from collections import Mapping, Counter + 23 |+ from collections import Counter + 24 |+ from collections.abc import Mapping +24 25 | +25 26 | if True: +26 27 | if True: + +UP035_0.py:28:5: UP035 [*] Import from `collections.abc` instead: `Mapping` + | +26 | if True: +27 | pass +28 | from collections import Mapping, Counter + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ UP035 +29 | +30 | if True: from collections import Mapping + | + = help: Import from `collections.abc` + +ℹ Safe fix +25 25 | if True: +26 26 | if True: +27 27 | pass +28 |- from collections import Mapping, Counter + 28 |+ from collections import Counter + 29 |+ from collections.abc import Mapping +29 30 | +30 31 | if True: from collections import Mapping +31 32 | + +UP035_0.py:30:10: UP035 [*] Import from `collections.abc` instead: `Mapping` + | +28 | from collections import Mapping, Counter +29 | +30 | if True: from collections import Mapping + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ UP035 +31 | +32 | import os + | + = help: Import from `collections.abc` + +ℹ Safe fix +27 27 | pass +28 28 | from collections import Mapping, Counter +29 29 | +30 |-if True: from collections import Mapping + 30 |+if True: from collections.abc import Mapping +31 31 | +32 32 | import os +33 33 | from collections import Counter, Mapping + +UP035_0.py:33:1: UP035 [*] Import from `collections.abc` instead: `Mapping` + | +32 | import os +33 | from collections import Counter, Mapping + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ UP035 +34 | import sys + | + = help: Import from `collections.abc` + +ℹ Safe fix +30 30 | if True: from collections import Mapping +31 31 | +32 32 | import os +33 |-from collections import Counter, Mapping + 33 |+from collections import Counter + 34 |+from collections.abc import Mapping +34 35 | import sys +35 36 | +36 37 | if True: + +UP035_0.py:37:5: UP035 [*] Import from `collections.abc` instead: `Mapping`, `Callable` + | +36 | if True: +37 | from collections import ( + | _____^ +38 | | Mapping, +39 | | Callable, +40 | | Bad, +41 | | Good, +42 | | ) + | |_____^ UP035 +43 | +44 | from typing import Callable, Match, Pattern, List, OrderedDict, AbstractSet, ContextManager + | + = help: Import from `collections.abc` + +ℹ Safe fix +35 35 | +36 36 | if True: +37 37 | from collections import ( +38 |- Mapping, +39 |- Callable, +40 38 | Bad, +41 39 | Good, +42 40 | ) + 41 |+ from collections.abc import Mapping, Callable +43 42 | +44 43 | from typing import Callable, Match, Pattern, List, OrderedDict, AbstractSet, ContextManager +45 44 | + +UP035_0.py:44:1: UP035 [*] Import from `re` instead: `Match`, `Pattern` + | +42 | ) +43 | +44 | from typing import Callable, Match, Pattern, List, OrderedDict, AbstractSet, ContextManager + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ UP035 +45 | +46 | if True: from collections import ( + | + = help: Import from `re` + +ℹ Safe fix +41 41 | Good, +42 42 | ) +43 43 | +44 |-from typing import Callable, Match, Pattern, List, OrderedDict, AbstractSet, ContextManager + 44 |+from typing import Callable, List, OrderedDict, AbstractSet, ContextManager + 45 |+from re import Match, Pattern +45 46 | +46 47 | if True: from collections import ( +47 48 | Mapping, Counter) + +UP035_0.py:44:1: UP035 [*] Import from `collections.abc` instead: `Callable` + | +42 | ) +43 | +44 | from typing import Callable, Match, Pattern, List, OrderedDict, AbstractSet, ContextManager + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ UP035 +45 | +46 | if True: from collections import ( + | + = help: Import from `collections.abc` + +ℹ Unsafe fix +41 41 | Good, +42 42 | ) +43 43 | +44 |-from typing import Callable, Match, Pattern, List, OrderedDict, AbstractSet, ContextManager + 44 |+from typing import Match, Pattern, List, OrderedDict, AbstractSet, ContextManager + 45 |+from collections.abc import Callable +45 46 | +46 47 | if True: from collections import ( +47 48 | Mapping, Counter) + +UP035_0.py:44:1: UP035 [*] Import from `collections` instead: `OrderedDict` + | +42 | ) +43 | +44 | from typing import Callable, Match, Pattern, List, OrderedDict, AbstractSet, ContextManager + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ UP035 +45 | +46 | if True: from collections import ( + | + = help: Import from `collections` + +ℹ Unsafe fix +41 41 | Good, +42 42 | ) +43 43 | +44 |-from typing import Callable, Match, Pattern, List, OrderedDict, AbstractSet, ContextManager + 44 |+from typing import Callable, Match, Pattern, List, AbstractSet, ContextManager + 45 |+from collections import OrderedDict +45 46 | +46 47 | if True: from collections import ( +47 48 | Mapping, Counter) + +UP035_0.py:44:1: UP035 `typing.List` is deprecated, use `list` instead + | +42 | ) +43 | +44 | from typing import Callable, Match, Pattern, List, OrderedDict, AbstractSet, ContextManager + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ UP035 +45 | +46 | if True: from collections import ( + | + +UP035_0.py:44:1: UP035 `typing.AbstractSet` is deprecated, use `collections.abc.Set` instead + | +42 | ) +43 | +44 | from typing import Callable, Match, Pattern, List, OrderedDict, AbstractSet, ContextManager + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ UP035 +45 | +46 | if True: from collections import ( + | + +UP035_0.py:44:1: UP035 `typing.ContextManager` is deprecated, use `contextlib.AbstractContextManager` instead + | +42 | ) +43 | +44 | from typing import Callable, Match, Pattern, List, OrderedDict, AbstractSet, ContextManager + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ UP035 +45 | +46 | if True: from collections import ( + | + +UP035_0.py:46:10: UP035 Import from `collections.abc` instead: `Mapping` + | +44 | from typing import Callable, Match, Pattern, List, OrderedDict, AbstractSet, ContextManager +45 | +46 | if True: from collections import ( + | __________^ +47 | | Mapping, Counter) + | |_____________________^ UP035 +48 | +49 | # Bad imports from PYI027 that are now handled by PYI022 (UP035) + | + = help: Import from `collections.abc` + +UP035_0.py:50:1: UP035 `typing.ContextManager` is deprecated, use `contextlib.AbstractContextManager` instead + | +49 | # Bad imports from PYI027 that are now handled by PYI022 (UP035) +50 | from typing import ContextManager + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ UP035 +51 | from typing import OrderedDict +52 | from typing_extensions import OrderedDict + | + +UP035_0.py:51:1: UP035 [*] Import from `collections` instead: `OrderedDict` + | +49 | # Bad imports from PYI027 that are now handled by PYI022 (UP035) +50 | from typing import ContextManager +51 | from typing import OrderedDict + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ UP035 +52 | from typing_extensions import OrderedDict +53 | from typing import Callable + | + = help: Import from `collections` + +ℹ Unsafe fix +48 48 | +49 49 | # Bad imports from PYI027 that are now handled by PYI022 (UP035) +50 50 | from typing import ContextManager +51 |-from typing import OrderedDict + 51 |+from collections import OrderedDict +52 52 | from typing_extensions import OrderedDict +53 53 | from typing import Callable +54 54 | from typing import ByteString + +UP035_0.py:52:1: UP035 [*] Import from `typing` instead: `OrderedDict` + | +50 | from typing import ContextManager +51 | from typing import OrderedDict +52 | from typing_extensions import OrderedDict + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ UP035 +53 | from typing import Callable +54 | from typing import ByteString + | + = help: Import from `typing` + +ℹ Safe fix +49 49 | # Bad imports from PYI027 that are now handled by PYI022 (UP035) +50 50 | from typing import ContextManager +51 51 | from typing import OrderedDict +52 |-from typing_extensions import OrderedDict + 52 |+from typing import OrderedDict +53 53 | from typing import Callable +54 54 | from typing import ByteString +55 55 | from typing import Container + +UP035_0.py:53:1: UP035 [*] Import from `collections.abc` instead: `Callable` + | +51 | from typing import OrderedDict +52 | from typing_extensions import OrderedDict +53 | from typing import Callable + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ UP035 +54 | from typing import ByteString +55 | from typing import Container + | + = help: Import from `collections.abc` + +ℹ Unsafe fix +50 50 | from typing import ContextManager +51 51 | from typing import OrderedDict +52 52 | from typing_extensions import OrderedDict +53 |-from typing import Callable + 53 |+from collections.abc import Callable +54 54 | from typing import ByteString +55 55 | from typing import Container +56 56 | from typing import Hashable + +UP035_0.py:54:1: UP035 [*] Import from `collections.abc` instead: `ByteString` + | +52 | from typing_extensions import OrderedDict +53 | from typing import Callable +54 | from typing import ByteString + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ UP035 +55 | from typing import Container +56 | from typing import Hashable + | + = help: Import from `collections.abc` + +ℹ Unsafe fix +51 51 | from typing import OrderedDict +52 52 | from typing_extensions import OrderedDict +53 53 | from typing import Callable +54 |-from typing import ByteString + 54 |+from collections.abc import ByteString +55 55 | from typing import Container +56 56 | from typing import Hashable +57 57 | from typing import ItemsView + +UP035_0.py:55:1: UP035 [*] Import from `collections.abc` instead: `Container` + | +53 | from typing import Callable +54 | from typing import ByteString +55 | from typing import Container + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ UP035 +56 | from typing import Hashable +57 | from typing import ItemsView + | + = help: Import from `collections.abc` + +ℹ Unsafe fix +52 52 | from typing_extensions import OrderedDict +53 53 | from typing import Callable +54 54 | from typing import ByteString +55 |-from typing import Container + 55 |+from collections.abc import Container +56 56 | from typing import Hashable +57 57 | from typing import ItemsView +58 58 | from typing import Iterable + +UP035_0.py:56:1: UP035 [*] Import from `collections.abc` instead: `Hashable` + | +54 | from typing import ByteString +55 | from typing import Container +56 | from typing import Hashable + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ UP035 +57 | from typing import ItemsView +58 | from typing import Iterable + | + = help: Import from `collections.abc` + +ℹ Unsafe fix +53 53 | from typing import Callable +54 54 | from typing import ByteString +55 55 | from typing import Container +56 |-from typing import Hashable + 56 |+from collections.abc import Hashable +57 57 | from typing import ItemsView +58 58 | from typing import Iterable +59 59 | from typing import Iterator + +UP035_0.py:57:1: UP035 [*] Import from `collections.abc` instead: `ItemsView` + | +55 | from typing import Container +56 | from typing import Hashable +57 | from typing import ItemsView + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ UP035 +58 | from typing import Iterable +59 | from typing import Iterator + | + = help: Import from `collections.abc` + +ℹ Unsafe fix +54 54 | from typing import ByteString +55 55 | from typing import Container +56 56 | from typing import Hashable +57 |-from typing import ItemsView + 57 |+from collections.abc import ItemsView +58 58 | from typing import Iterable +59 59 | from typing import Iterator +60 60 | from typing import KeysView + +UP035_0.py:58:1: UP035 [*] Import from `collections.abc` instead: `Iterable` + | +56 | from typing import Hashable +57 | from typing import ItemsView +58 | from typing import Iterable + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ UP035 +59 | from typing import Iterator +60 | from typing import KeysView + | + = help: Import from `collections.abc` + +ℹ Unsafe fix +55 55 | from typing import Container +56 56 | from typing import Hashable +57 57 | from typing import ItemsView +58 |-from typing import Iterable + 58 |+from collections.abc import Iterable +59 59 | from typing import Iterator +60 60 | from typing import KeysView +61 61 | from typing import Mapping + +UP035_0.py:59:1: UP035 [*] Import from `collections.abc` instead: `Iterator` + | +57 | from typing import ItemsView +58 | from typing import Iterable +59 | from typing import Iterator + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ UP035 +60 | from typing import KeysView +61 | from typing import Mapping + | + = help: Import from `collections.abc` + +ℹ Unsafe fix +56 56 | from typing import Hashable +57 57 | from typing import ItemsView +58 58 | from typing import Iterable +59 |-from typing import Iterator + 59 |+from collections.abc import Iterator +60 60 | from typing import KeysView +61 61 | from typing import Mapping +62 62 | from typing import MappingView + +UP035_0.py:60:1: UP035 [*] Import from `collections.abc` instead: `KeysView` + | +58 | from typing import Iterable +59 | from typing import Iterator +60 | from typing import KeysView + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ UP035 +61 | from typing import Mapping +62 | from typing import MappingView + | + = help: Import from `collections.abc` + +ℹ Unsafe fix +57 57 | from typing import ItemsView +58 58 | from typing import Iterable +59 59 | from typing import Iterator +60 |-from typing import KeysView + 60 |+from collections.abc import KeysView +61 61 | from typing import Mapping +62 62 | from typing import MappingView +63 63 | from typing import MutableMapping + +UP035_0.py:61:1: UP035 [*] Import from `collections.abc` instead: `Mapping` + | +59 | from typing import Iterator +60 | from typing import KeysView +61 | from typing import Mapping + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ UP035 +62 | from typing import MappingView +63 | from typing import MutableMapping + | + = help: Import from `collections.abc` + +ℹ Unsafe fix +58 58 | from typing import Iterable +59 59 | from typing import Iterator +60 60 | from typing import KeysView +61 |-from typing import Mapping + 61 |+from collections.abc import Mapping +62 62 | from typing import MappingView +63 63 | from typing import MutableMapping +64 64 | from typing import MutableSequence + +UP035_0.py:62:1: UP035 [*] Import from `collections.abc` instead: `MappingView` + | +60 | from typing import KeysView +61 | from typing import Mapping +62 | from typing import MappingView + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ UP035 +63 | from typing import MutableMapping +64 | from typing import MutableSequence + | + = help: Import from `collections.abc` + +ℹ Unsafe fix +59 59 | from typing import Iterator +60 60 | from typing import KeysView +61 61 | from typing import Mapping +62 |-from typing import MappingView + 62 |+from collections.abc import MappingView +63 63 | from typing import MutableMapping +64 64 | from typing import MutableSequence +65 65 | from typing import MutableSet + +UP035_0.py:63:1: UP035 [*] Import from `collections.abc` instead: `MutableMapping` + | +61 | from typing import Mapping +62 | from typing import MappingView +63 | from typing import MutableMapping + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ UP035 +64 | from typing import MutableSequence +65 | from typing import MutableSet + | + = help: Import from `collections.abc` + +ℹ Unsafe fix +60 60 | from typing import KeysView +61 61 | from typing import Mapping +62 62 | from typing import MappingView +63 |-from typing import MutableMapping + 63 |+from collections.abc import MutableMapping +64 64 | from typing import MutableSequence +65 65 | from typing import MutableSet +66 66 | from typing import Sequence + +UP035_0.py:64:1: UP035 [*] Import from `collections.abc` instead: `MutableSequence` + | +62 | from typing import MappingView +63 | from typing import MutableMapping +64 | from typing import MutableSequence + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ UP035 +65 | from typing import MutableSet +66 | from typing import Sequence + | + = help: Import from `collections.abc` + +ℹ Unsafe fix +61 61 | from typing import Mapping +62 62 | from typing import MappingView +63 63 | from typing import MutableMapping +64 |-from typing import MutableSequence + 64 |+from collections.abc import MutableSequence +65 65 | from typing import MutableSet +66 66 | from typing import Sequence +67 67 | from typing import Sized + +UP035_0.py:65:1: UP035 [*] Import from `collections.abc` instead: `MutableSet` + | +63 | from typing import MutableMapping +64 | from typing import MutableSequence +65 | from typing import MutableSet + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ UP035 +66 | from typing import Sequence +67 | from typing import Sized + | + = help: Import from `collections.abc` + +ℹ Unsafe fix +62 62 | from typing import MappingView +63 63 | from typing import MutableMapping +64 64 | from typing import MutableSequence +65 |-from typing import MutableSet + 65 |+from collections.abc import MutableSet +66 66 | from typing import Sequence +67 67 | from typing import Sized +68 68 | from typing import ValuesView + +UP035_0.py:66:1: UP035 [*] Import from `collections.abc` instead: `Sequence` + | +64 | from typing import MutableSequence +65 | from typing import MutableSet +66 | from typing import Sequence + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ UP035 +67 | from typing import Sized +68 | from typing import ValuesView + | + = help: Import from `collections.abc` + +ℹ Unsafe fix +63 63 | from typing import MutableMapping +64 64 | from typing import MutableSequence +65 65 | from typing import MutableSet +66 |-from typing import Sequence + 66 |+from collections.abc import Sequence +67 67 | from typing import Sized +68 68 | from typing import ValuesView +69 69 | from typing import Awaitable + +UP035_0.py:67:1: UP035 [*] Import from `collections.abc` instead: `Sized` + | +65 | from typing import MutableSet +66 | from typing import Sequence +67 | from typing import Sized + | ^^^^^^^^^^^^^^^^^^^^^^^^ UP035 +68 | from typing import ValuesView +69 | from typing import Awaitable + | + = help: Import from `collections.abc` + +ℹ Unsafe fix +64 64 | from typing import MutableSequence +65 65 | from typing import MutableSet +66 66 | from typing import Sequence +67 |-from typing import Sized + 67 |+from collections.abc import Sized +68 68 | from typing import ValuesView +69 69 | from typing import Awaitable +70 70 | from typing import AsyncIterator + +UP035_0.py:68:1: UP035 [*] Import from `collections.abc` instead: `ValuesView` + | +66 | from typing import Sequence +67 | from typing import Sized +68 | from typing import ValuesView + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ UP035 +69 | from typing import Awaitable +70 | from typing import AsyncIterator + | + = help: Import from `collections.abc` + +ℹ Unsafe fix +65 65 | from typing import MutableSet +66 66 | from typing import Sequence +67 67 | from typing import Sized +68 |-from typing import ValuesView + 68 |+from collections.abc import ValuesView +69 69 | from typing import Awaitable +70 70 | from typing import AsyncIterator +71 71 | from typing import AsyncIterable + +UP035_0.py:69:1: UP035 [*] Import from `collections.abc` instead: `Awaitable` + | +67 | from typing import Sized +68 | from typing import ValuesView +69 | from typing import Awaitable + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ UP035 +70 | from typing import AsyncIterator +71 | from typing import AsyncIterable + | + = help: Import from `collections.abc` + +ℹ Unsafe fix +66 66 | from typing import Sequence +67 67 | from typing import Sized +68 68 | from typing import ValuesView +69 |-from typing import Awaitable + 69 |+from collections.abc import Awaitable +70 70 | from typing import AsyncIterator +71 71 | from typing import AsyncIterable +72 72 | from typing import Coroutine + +UP035_0.py:70:1: UP035 [*] Import from `collections.abc` instead: `AsyncIterator` + | +68 | from typing import ValuesView +69 | from typing import Awaitable +70 | from typing import AsyncIterator + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ UP035 +71 | from typing import AsyncIterable +72 | from typing import Coroutine + | + = help: Import from `collections.abc` + +ℹ Unsafe fix +67 67 | from typing import Sized +68 68 | from typing import ValuesView +69 69 | from typing import Awaitable +70 |-from typing import AsyncIterator + 70 |+from collections.abc import AsyncIterator +71 71 | from typing import AsyncIterable +72 72 | from typing import Coroutine +73 73 | from typing import Collection + +UP035_0.py:71:1: UP035 [*] Import from `collections.abc` instead: `AsyncIterable` + | +69 | from typing import Awaitable +70 | from typing import AsyncIterator +71 | from typing import AsyncIterable + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ UP035 +72 | from typing import Coroutine +73 | from typing import Collection + | + = help: Import from `collections.abc` + +ℹ Unsafe fix +68 68 | from typing import ValuesView +69 69 | from typing import Awaitable +70 70 | from typing import AsyncIterator +71 |-from typing import AsyncIterable + 71 |+from collections.abc import AsyncIterable +72 72 | from typing import Coroutine +73 73 | from typing import Collection +74 74 | from typing import AsyncGenerator + +UP035_0.py:72:1: UP035 [*] Import from `collections.abc` instead: `Coroutine` + | +70 | from typing import AsyncIterator +71 | from typing import AsyncIterable +72 | from typing import Coroutine + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ UP035 +73 | from typing import Collection +74 | from typing import AsyncGenerator + | + = help: Import from `collections.abc` + +ℹ Unsafe fix +69 69 | from typing import Awaitable +70 70 | from typing import AsyncIterator +71 71 | from typing import AsyncIterable +72 |-from typing import Coroutine + 72 |+from collections.abc import Coroutine +73 73 | from typing import Collection +74 74 | from typing import AsyncGenerator +75 75 | from typing import Reversible + +UP035_0.py:73:1: UP035 [*] Import from `collections.abc` instead: `Collection` + | +71 | from typing import AsyncIterable +72 | from typing import Coroutine +73 | from typing import Collection + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ UP035 +74 | from typing import AsyncGenerator +75 | from typing import Reversible + | + = help: Import from `collections.abc` + +ℹ Unsafe fix +70 70 | from typing import AsyncIterator +71 71 | from typing import AsyncIterable +72 72 | from typing import Coroutine +73 |-from typing import Collection + 73 |+from collections.abc import Collection +74 74 | from typing import AsyncGenerator +75 75 | from typing import Reversible +76 76 | from typing import Generator + +UP035_0.py:74:1: UP035 [*] Import from `collections.abc` instead: `AsyncGenerator` + | +72 | from typing import Coroutine +73 | from typing import Collection +74 | from typing import AsyncGenerator + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ UP035 +75 | from typing import Reversible +76 | from typing import Generator + | + = help: Import from `collections.abc` + +ℹ Unsafe fix +71 71 | from typing import AsyncIterable +72 72 | from typing import Coroutine +73 73 | from typing import Collection +74 |-from typing import AsyncGenerator + 74 |+from collections.abc import AsyncGenerator +75 75 | from typing import Reversible +76 76 | from typing import Generator +77 77 | from typing import Callable + +UP035_0.py:75:1: UP035 [*] Import from `collections.abc` instead: `Reversible` + | +73 | from typing import Collection +74 | from typing import AsyncGenerator +75 | from typing import Reversible + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ UP035 +76 | from typing import Generator +77 | from typing import Callable + | + = help: Import from `collections.abc` + +ℹ Unsafe fix +72 72 | from typing import Coroutine +73 73 | from typing import Collection +74 74 | from typing import AsyncGenerator +75 |-from typing import Reversible + 75 |+from collections.abc import Reversible +76 76 | from typing import Generator +77 77 | from typing import Callable +78 78 | from typing import cast + +UP035_0.py:76:1: UP035 [*] Import from `collections.abc` instead: `Generator` + | +74 | from typing import AsyncGenerator +75 | from typing import Reversible +76 | from typing import Generator + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ UP035 +77 | from typing import Callable +78 | from typing import cast + | + = help: Import from `collections.abc` + +ℹ Unsafe fix +73 73 | from typing import Collection +74 74 | from typing import AsyncGenerator +75 75 | from typing import Reversible +76 |-from typing import Generator + 76 |+from collections.abc import Generator +77 77 | from typing import Callable +78 78 | from typing import cast +79 79 | + +UP035_0.py:77:1: UP035 [*] Import from `collections.abc` instead: `Callable` + | +75 | from typing import Reversible +76 | from typing import Generator +77 | from typing import Callable + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ UP035 +78 | from typing import cast + | + = help: Import from `collections.abc` + +ℹ Unsafe fix +74 74 | from typing import AsyncGenerator +75 75 | from typing import Reversible +76 76 | from typing import Generator +77 |-from typing import Callable + 77 |+from collections.abc import Callable +78 78 | from typing import cast +79 79 | +80 80 | # OK + +UP035_0.py:87:1: UP035 [*] Import from `typing` instead: `NamedTuple` + | +86 | # OK: `typing_extensions` contains backported improvements. +87 | from typing_extensions import NamedTuple + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ UP035 +88 | +89 | # OK: `typing_extensions` supports `frozen_default` (backported from 3.12). + | + = help: Import from `typing` + +ℹ Unsafe fix +84 84 | from typing_extensions import SupportsIndex +85 85 | +86 86 | # OK: `typing_extensions` contains backported improvements. +87 |-from typing_extensions import NamedTuple + 87 |+from typing import NamedTuple +88 88 | +89 89 | # OK: `typing_extensions` supports `frozen_default` (backported from 3.12). +90 90 | from typing_extensions import dataclass_transform + +UP035_0.py:90:1: UP035 [*] Import from `typing` instead: `dataclass_transform` + | +89 | # OK: `typing_extensions` supports `frozen_default` (backported from 3.12). +90 | from typing_extensions import dataclass_transform + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ UP035 +91 | +92 | # UP035 + | + = help: Import from `typing` + +ℹ Safe fix +87 87 | from typing_extensions import NamedTuple +88 88 | +89 89 | # OK: `typing_extensions` supports `frozen_default` (backported from 3.12). +90 |-from typing_extensions import dataclass_transform + 90 |+from typing import dataclass_transform +91 91 | +92 92 | # UP035 +93 93 | from backports.strenum import StrEnum + +UP035_0.py:93:1: UP035 [*] Import from `enum` instead: `StrEnum` + | +92 | # UP035 +93 | from backports.strenum import StrEnum + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ UP035 + | + = help: Import from `enum` + +ℹ Unsafe fix +90 90 | from typing_extensions import dataclass_transform +91 91 | +92 92 | # UP035 +93 |-from backports.strenum import StrEnum + 93 |+from enum import StrEnum + + diff --git a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP035_1.py.snap b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP035_1.py.snap new file mode 100644 index 0000000000000..fcbaca371cfcf --- /dev/null +++ b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP035_1.py.snap @@ -0,0 +1,71 @@ +--- +source: crates/ruff_linter/src/rules/pyupgrade/mod.rs +--- +UP035_1.py:3:1: UP035 [*] Import from `collections.abc` instead: `AsyncGenerator`, `AsyncIterable`, `AsyncIterator`, `Awaitable`, `ByteString`, `Callable`, `Collection`, `Container`, `Coroutine`, `Generator`, `Hashable`, `ItemsView`, `Iterable`, `Iterator`, `KeysView`, `Mapping`, `MappingView`, `MutableMapping`, `MutableSequence`, `MutableSet`, `Reversible`, `Sequence`, `Set`, `Sized`, `ValuesView` + | + 1 | """Things that were moved from `collections` to `collections.abc`.""" + 2 | + 3 | / from collections import ( + 4 | | AsyncGenerator, + 5 | | AsyncIterable, + 6 | | AsyncIterator, + 7 | | Awaitable, + 8 | | ByteString, + 9 | | Callable, +10 | | Collection, +11 | | Container, +12 | | Coroutine, +13 | | Generator, +14 | | Hashable, +15 | | ItemsView, +16 | | Iterable, +17 | | Iterator, +18 | | KeysView, +19 | | Mapping, +20 | | MappingView, +21 | | MutableMapping, +22 | | MutableSequence, +23 | | MutableSet, +24 | | Reversible, +25 | | Sequence, +26 | | Set, +27 | | Sized, +28 | | ValuesView, +29 | | ) + | |_^ UP035 + | + = help: Import from `collections.abc` + +ℹ Safe fix +1 1 | """Things that were moved from `collections` to `collections.abc`.""" +2 2 | +3 |-from collections import ( +4 |- AsyncGenerator, +5 |- AsyncIterable, +6 |- AsyncIterator, +7 |- Awaitable, +8 |- ByteString, +9 |- Callable, +10 |- Collection, +11 |- Container, +12 |- Coroutine, +13 |- Generator, +14 |- Hashable, +15 |- ItemsView, +16 |- Iterable, +17 |- Iterator, +18 |- KeysView, +19 |- Mapping, +20 |- MappingView, +21 |- MutableMapping, +22 |- MutableSequence, +23 |- MutableSet, +24 |- Reversible, +25 |- Sequence, +26 |- Set, +27 |- Sized, +28 |- ValuesView, +29 |-) + 3 |+from collections.abc import AsyncGenerator, AsyncIterable, AsyncIterator, Awaitable, ByteString, Callable, Collection, Container, Coroutine, Generator, Hashable, ItemsView, Iterable, Iterator, KeysView, Mapping, MappingView, MutableMapping, MutableSequence, MutableSet, Reversible, Sequence, Set, Sized, ValuesView + + diff --git a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP035_2.py.snap b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP035_2.py.snap new file mode 100644 index 0000000000000..ae6eaf454e18e --- /dev/null +++ b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP035_2.py.snap @@ -0,0 +1,1890 @@ +--- +source: crates/ruff_linter/src/rules/pyupgrade/mod.rs +--- +UP035_2.py:2:1: UP035 [*] Import from `typing` instead: `AbstractSet` + | +1 | """Things that were moved from `typing_extensions` to `typing`.""" +2 | from typing_extensions import AbstractSet + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ UP035 +3 | from typing_extensions import AnyStr +4 | from typing_extensions import AsyncIterable + | + = help: Import from `typing` + +ℹ Safe fix +1 1 | """Things that were moved from `typing_extensions` to `typing`.""" +2 |-from typing_extensions import AbstractSet + 2 |+from typing import AbstractSet +3 3 | from typing_extensions import AnyStr +4 4 | from typing_extensions import AsyncIterable +5 5 | from typing_extensions import AsyncIterator + +UP035_2.py:3:1: UP035 [*] Import from `typing` instead: `AnyStr` + | +1 | """Things that were moved from `typing_extensions` to `typing`.""" +2 | from typing_extensions import AbstractSet +3 | from typing_extensions import AnyStr + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ UP035 +4 | from typing_extensions import AsyncIterable +5 | from typing_extensions import AsyncIterator + | + = help: Import from `typing` + +ℹ Safe fix +1 1 | """Things that were moved from `typing_extensions` to `typing`.""" +2 2 | from typing_extensions import AbstractSet +3 |-from typing_extensions import AnyStr + 3 |+from typing import AnyStr +4 4 | from typing_extensions import AsyncIterable +5 5 | from typing_extensions import AsyncIterator +6 6 | from typing_extensions import Awaitable + +UP035_2.py:4:1: UP035 [*] Import from `typing` instead: `AsyncIterable` + | +2 | from typing_extensions import AbstractSet +3 | from typing_extensions import AnyStr +4 | from typing_extensions import AsyncIterable + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ UP035 +5 | from typing_extensions import AsyncIterator +6 | from typing_extensions import Awaitable + | + = help: Import from `typing` + +ℹ Safe fix +1 1 | """Things that were moved from `typing_extensions` to `typing`.""" +2 2 | from typing_extensions import AbstractSet +3 3 | from typing_extensions import AnyStr +4 |-from typing_extensions import AsyncIterable + 4 |+from typing import AsyncIterable +5 5 | from typing_extensions import AsyncIterator +6 6 | from typing_extensions import Awaitable +7 7 | from typing_extensions import BinaryIO + +UP035_2.py:5:1: UP035 [*] Import from `typing` instead: `AsyncIterator` + | +3 | from typing_extensions import AnyStr +4 | from typing_extensions import AsyncIterable +5 | from typing_extensions import AsyncIterator + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ UP035 +6 | from typing_extensions import Awaitable +7 | from typing_extensions import BinaryIO + | + = help: Import from `typing` + +ℹ Safe fix +2 2 | from typing_extensions import AbstractSet +3 3 | from typing_extensions import AnyStr +4 4 | from typing_extensions import AsyncIterable +5 |-from typing_extensions import AsyncIterator + 5 |+from typing import AsyncIterator +6 6 | from typing_extensions import Awaitable +7 7 | from typing_extensions import BinaryIO +8 8 | from typing_extensions import Callable + +UP035_2.py:6:1: UP035 [*] Import from `typing` instead: `Awaitable` + | +4 | from typing_extensions import AsyncIterable +5 | from typing_extensions import AsyncIterator +6 | from typing_extensions import Awaitable + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ UP035 +7 | from typing_extensions import BinaryIO +8 | from typing_extensions import Callable + | + = help: Import from `typing` + +ℹ Safe fix +3 3 | from typing_extensions import AnyStr +4 4 | from typing_extensions import AsyncIterable +5 5 | from typing_extensions import AsyncIterator +6 |-from typing_extensions import Awaitable + 6 |+from typing import Awaitable +7 7 | from typing_extensions import BinaryIO +8 8 | from typing_extensions import Callable +9 9 | from typing_extensions import ClassVar + +UP035_2.py:7:1: UP035 [*] Import from `typing` instead: `BinaryIO` + | +5 | from typing_extensions import AsyncIterator +6 | from typing_extensions import Awaitable +7 | from typing_extensions import BinaryIO + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ UP035 +8 | from typing_extensions import Callable +9 | from typing_extensions import ClassVar + | + = help: Import from `typing` + +ℹ Safe fix +4 4 | from typing_extensions import AsyncIterable +5 5 | from typing_extensions import AsyncIterator +6 6 | from typing_extensions import Awaitable +7 |-from typing_extensions import BinaryIO + 7 |+from typing import BinaryIO +8 8 | from typing_extensions import Callable +9 9 | from typing_extensions import ClassVar +10 10 | from typing_extensions import Collection + +UP035_2.py:8:1: UP035 [*] Import from `typing` instead: `Callable` + | + 6 | from typing_extensions import Awaitable + 7 | from typing_extensions import BinaryIO + 8 | from typing_extensions import Callable + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ UP035 + 9 | from typing_extensions import ClassVar +10 | from typing_extensions import Collection + | + = help: Import from `typing` + +ℹ Safe fix +5 5 | from typing_extensions import AsyncIterator +6 6 | from typing_extensions import Awaitable +7 7 | from typing_extensions import BinaryIO +8 |-from typing_extensions import Callable + 8 |+from typing import Callable +9 9 | from typing_extensions import ClassVar +10 10 | from typing_extensions import Collection +11 11 | from typing_extensions import Container + +UP035_2.py:9:1: UP035 [*] Import from `typing` instead: `ClassVar` + | + 7 | from typing_extensions import BinaryIO + 8 | from typing_extensions import Callable + 9 | from typing_extensions import ClassVar + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ UP035 +10 | from typing_extensions import Collection +11 | from typing_extensions import Container + | + = help: Import from `typing` + +ℹ Safe fix +6 6 | from typing_extensions import Awaitable +7 7 | from typing_extensions import BinaryIO +8 8 | from typing_extensions import Callable +9 |-from typing_extensions import ClassVar + 9 |+from typing import ClassVar +10 10 | from typing_extensions import Collection +11 11 | from typing_extensions import Container +12 12 | from typing_extensions import ContextManager + +UP035_2.py:10:1: UP035 [*] Import from `typing` instead: `Collection` + | + 8 | from typing_extensions import Callable + 9 | from typing_extensions import ClassVar +10 | from typing_extensions import Collection + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ UP035 +11 | from typing_extensions import Container +12 | from typing_extensions import ContextManager + | + = help: Import from `typing` + +ℹ Safe fix +7 7 | from typing_extensions import BinaryIO +8 8 | from typing_extensions import Callable +9 9 | from typing_extensions import ClassVar +10 |-from typing_extensions import Collection + 10 |+from typing import Collection +11 11 | from typing_extensions import Container +12 12 | from typing_extensions import ContextManager +13 13 | from typing_extensions import Coroutine + +UP035_2.py:11:1: UP035 [*] Import from `typing` instead: `Container` + | + 9 | from typing_extensions import ClassVar +10 | from typing_extensions import Collection +11 | from typing_extensions import Container + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ UP035 +12 | from typing_extensions import ContextManager +13 | from typing_extensions import Coroutine + | + = help: Import from `typing` + +ℹ Safe fix +8 8 | from typing_extensions import Callable +9 9 | from typing_extensions import ClassVar +10 10 | from typing_extensions import Collection +11 |-from typing_extensions import Container + 11 |+from typing import Container +12 12 | from typing_extensions import ContextManager +13 13 | from typing_extensions import Coroutine +14 14 | from typing_extensions import DefaultDict + +UP035_2.py:12:1: UP035 [*] Import from `typing` instead: `ContextManager` + | +10 | from typing_extensions import Collection +11 | from typing_extensions import Container +12 | from typing_extensions import ContextManager + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ UP035 +13 | from typing_extensions import Coroutine +14 | from typing_extensions import DefaultDict + | + = help: Import from `typing` + +ℹ Safe fix +9 9 | from typing_extensions import ClassVar +10 10 | from typing_extensions import Collection +11 11 | from typing_extensions import Container +12 |-from typing_extensions import ContextManager + 12 |+from typing import ContextManager +13 13 | from typing_extensions import Coroutine +14 14 | from typing_extensions import DefaultDict +15 15 | from typing_extensions import Dict + +UP035_2.py:13:1: UP035 [*] Import from `typing` instead: `Coroutine` + | +11 | from typing_extensions import Container +12 | from typing_extensions import ContextManager +13 | from typing_extensions import Coroutine + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ UP035 +14 | from typing_extensions import DefaultDict +15 | from typing_extensions import Dict + | + = help: Import from `typing` + +ℹ Safe fix +10 10 | from typing_extensions import Collection +11 11 | from typing_extensions import Container +12 12 | from typing_extensions import ContextManager +13 |-from typing_extensions import Coroutine + 13 |+from typing import Coroutine +14 14 | from typing_extensions import DefaultDict +15 15 | from typing_extensions import Dict +16 16 | from typing_extensions import FrozenSet + +UP035_2.py:14:1: UP035 [*] Import from `typing` instead: `DefaultDict` + | +12 | from typing_extensions import ContextManager +13 | from typing_extensions import Coroutine +14 | from typing_extensions import DefaultDict + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ UP035 +15 | from typing_extensions import Dict +16 | from typing_extensions import FrozenSet + | + = help: Import from `typing` + +ℹ Safe fix +11 11 | from typing_extensions import Container +12 12 | from typing_extensions import ContextManager +13 13 | from typing_extensions import Coroutine +14 |-from typing_extensions import DefaultDict + 14 |+from typing import DefaultDict +15 15 | from typing_extensions import Dict +16 16 | from typing_extensions import FrozenSet +17 17 | from typing_extensions import Generator + +UP035_2.py:15:1: UP035 [*] Import from `typing` instead: `Dict` + | +13 | from typing_extensions import Coroutine +14 | from typing_extensions import DefaultDict +15 | from typing_extensions import Dict + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ UP035 +16 | from typing_extensions import FrozenSet +17 | from typing_extensions import Generator + | + = help: Import from `typing` + +ℹ Safe fix +12 12 | from typing_extensions import ContextManager +13 13 | from typing_extensions import Coroutine +14 14 | from typing_extensions import DefaultDict +15 |-from typing_extensions import Dict + 15 |+from typing import Dict +16 16 | from typing_extensions import FrozenSet +17 17 | from typing_extensions import Generator +18 18 | from typing_extensions import Generic + +UP035_2.py:16:1: UP035 [*] Import from `typing` instead: `FrozenSet` + | +14 | from typing_extensions import DefaultDict +15 | from typing_extensions import Dict +16 | from typing_extensions import FrozenSet + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ UP035 +17 | from typing_extensions import Generator +18 | from typing_extensions import Generic + | + = help: Import from `typing` + +ℹ Safe fix +13 13 | from typing_extensions import Coroutine +14 14 | from typing_extensions import DefaultDict +15 15 | from typing_extensions import Dict +16 |-from typing_extensions import FrozenSet + 16 |+from typing import FrozenSet +17 17 | from typing_extensions import Generator +18 18 | from typing_extensions import Generic +19 19 | from typing_extensions import Hashable + +UP035_2.py:17:1: UP035 [*] Import from `typing` instead: `Generator` + | +15 | from typing_extensions import Dict +16 | from typing_extensions import FrozenSet +17 | from typing_extensions import Generator + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ UP035 +18 | from typing_extensions import Generic +19 | from typing_extensions import Hashable + | + = help: Import from `typing` + +ℹ Safe fix +14 14 | from typing_extensions import DefaultDict +15 15 | from typing_extensions import Dict +16 16 | from typing_extensions import FrozenSet +17 |-from typing_extensions import Generator + 17 |+from typing import Generator +18 18 | from typing_extensions import Generic +19 19 | from typing_extensions import Hashable +20 20 | from typing_extensions import IO + +UP035_2.py:18:1: UP035 [*] Import from `typing` instead: `Generic` + | +16 | from typing_extensions import FrozenSet +17 | from typing_extensions import Generator +18 | from typing_extensions import Generic + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ UP035 +19 | from typing_extensions import Hashable +20 | from typing_extensions import IO + | + = help: Import from `typing` + +ℹ Safe fix +15 15 | from typing_extensions import Dict +16 16 | from typing_extensions import FrozenSet +17 17 | from typing_extensions import Generator +18 |-from typing_extensions import Generic + 18 |+from typing import Generic +19 19 | from typing_extensions import Hashable +20 20 | from typing_extensions import IO +21 21 | from typing_extensions import ItemsView + +UP035_2.py:19:1: UP035 [*] Import from `typing` instead: `Hashable` + | +17 | from typing_extensions import Generator +18 | from typing_extensions import Generic +19 | from typing_extensions import Hashable + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ UP035 +20 | from typing_extensions import IO +21 | from typing_extensions import ItemsView + | + = help: Import from `typing` + +ℹ Safe fix +16 16 | from typing_extensions import FrozenSet +17 17 | from typing_extensions import Generator +18 18 | from typing_extensions import Generic +19 |-from typing_extensions import Hashable + 19 |+from typing import Hashable +20 20 | from typing_extensions import IO +21 21 | from typing_extensions import ItemsView +22 22 | from typing_extensions import Iterable + +UP035_2.py:20:1: UP035 [*] Import from `typing` instead: `IO` + | +18 | from typing_extensions import Generic +19 | from typing_extensions import Hashable +20 | from typing_extensions import IO + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ UP035 +21 | from typing_extensions import ItemsView +22 | from typing_extensions import Iterable + | + = help: Import from `typing` + +ℹ Safe fix +17 17 | from typing_extensions import Generator +18 18 | from typing_extensions import Generic +19 19 | from typing_extensions import Hashable +20 |-from typing_extensions import IO + 20 |+from typing import IO +21 21 | from typing_extensions import ItemsView +22 22 | from typing_extensions import Iterable +23 23 | from typing_extensions import KeysView + +UP035_2.py:21:1: UP035 [*] Import from `typing` instead: `ItemsView` + | +19 | from typing_extensions import Hashable +20 | from typing_extensions import IO +21 | from typing_extensions import ItemsView + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ UP035 +22 | from typing_extensions import Iterable +23 | from typing_extensions import KeysView + | + = help: Import from `typing` + +ℹ Safe fix +18 18 | from typing_extensions import Generic +19 19 | from typing_extensions import Hashable +20 20 | from typing_extensions import IO +21 |-from typing_extensions import ItemsView + 21 |+from typing import ItemsView +22 22 | from typing_extensions import Iterable +23 23 | from typing_extensions import KeysView +24 24 | from typing_extensions import List + +UP035_2.py:22:1: UP035 [*] Import from `typing` instead: `Iterable` + | +20 | from typing_extensions import IO +21 | from typing_extensions import ItemsView +22 | from typing_extensions import Iterable + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ UP035 +23 | from typing_extensions import KeysView +24 | from typing_extensions import List + | + = help: Import from `typing` + +ℹ Safe fix +19 19 | from typing_extensions import Hashable +20 20 | from typing_extensions import IO +21 21 | from typing_extensions import ItemsView +22 |-from typing_extensions import Iterable + 22 |+from typing import Iterable +23 23 | from typing_extensions import KeysView +24 24 | from typing_extensions import List +25 25 | from typing_extensions import Mapping + +UP035_2.py:23:1: UP035 [*] Import from `typing` instead: `KeysView` + | +21 | from typing_extensions import ItemsView +22 | from typing_extensions import Iterable +23 | from typing_extensions import KeysView + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ UP035 +24 | from typing_extensions import List +25 | from typing_extensions import Mapping + | + = help: Import from `typing` + +ℹ Safe fix +20 20 | from typing_extensions import IO +21 21 | from typing_extensions import ItemsView +22 22 | from typing_extensions import Iterable +23 |-from typing_extensions import KeysView + 23 |+from typing import KeysView +24 24 | from typing_extensions import List +25 25 | from typing_extensions import Mapping +26 26 | from typing_extensions import MappingView + +UP035_2.py:24:1: UP035 [*] Import from `typing` instead: `List` + | +22 | from typing_extensions import Iterable +23 | from typing_extensions import KeysView +24 | from typing_extensions import List + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ UP035 +25 | from typing_extensions import Mapping +26 | from typing_extensions import MappingView + | + = help: Import from `typing` + +ℹ Safe fix +21 21 | from typing_extensions import ItemsView +22 22 | from typing_extensions import Iterable +23 23 | from typing_extensions import KeysView +24 |-from typing_extensions import List + 24 |+from typing import List +25 25 | from typing_extensions import Mapping +26 26 | from typing_extensions import MappingView +27 27 | from typing_extensions import Match + +UP035_2.py:25:1: UP035 [*] Import from `typing` instead: `Mapping` + | +23 | from typing_extensions import KeysView +24 | from typing_extensions import List +25 | from typing_extensions import Mapping + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ UP035 +26 | from typing_extensions import MappingView +27 | from typing_extensions import Match + | + = help: Import from `typing` + +ℹ Safe fix +22 22 | from typing_extensions import Iterable +23 23 | from typing_extensions import KeysView +24 24 | from typing_extensions import List +25 |-from typing_extensions import Mapping + 25 |+from typing import Mapping +26 26 | from typing_extensions import MappingView +27 27 | from typing_extensions import Match +28 28 | from typing_extensions import MutableMapping + +UP035_2.py:26:1: UP035 [*] Import from `typing` instead: `MappingView` + | +24 | from typing_extensions import List +25 | from typing_extensions import Mapping +26 | from typing_extensions import MappingView + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ UP035 +27 | from typing_extensions import Match +28 | from typing_extensions import MutableMapping + | + = help: Import from `typing` + +ℹ Safe fix +23 23 | from typing_extensions import KeysView +24 24 | from typing_extensions import List +25 25 | from typing_extensions import Mapping +26 |-from typing_extensions import MappingView + 26 |+from typing import MappingView +27 27 | from typing_extensions import Match +28 28 | from typing_extensions import MutableMapping +29 29 | from typing_extensions import MutableSequence + +UP035_2.py:27:1: UP035 [*] Import from `typing` instead: `Match` + | +25 | from typing_extensions import Mapping +26 | from typing_extensions import MappingView +27 | from typing_extensions import Match + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ UP035 +28 | from typing_extensions import MutableMapping +29 | from typing_extensions import MutableSequence + | + = help: Import from `typing` + +ℹ Safe fix +24 24 | from typing_extensions import List +25 25 | from typing_extensions import Mapping +26 26 | from typing_extensions import MappingView +27 |-from typing_extensions import Match + 27 |+from typing import Match +28 28 | from typing_extensions import MutableMapping +29 29 | from typing_extensions import MutableSequence +30 30 | from typing_extensions import MutableSet + +UP035_2.py:28:1: UP035 [*] Import from `typing` instead: `MutableMapping` + | +26 | from typing_extensions import MappingView +27 | from typing_extensions import Match +28 | from typing_extensions import MutableMapping + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ UP035 +29 | from typing_extensions import MutableSequence +30 | from typing_extensions import MutableSet + | + = help: Import from `typing` + +ℹ Safe fix +25 25 | from typing_extensions import Mapping +26 26 | from typing_extensions import MappingView +27 27 | from typing_extensions import Match +28 |-from typing_extensions import MutableMapping + 28 |+from typing import MutableMapping +29 29 | from typing_extensions import MutableSequence +30 30 | from typing_extensions import MutableSet +31 31 | from typing_extensions import Optional + +UP035_2.py:29:1: UP035 [*] Import from `typing` instead: `MutableSequence` + | +27 | from typing_extensions import Match +28 | from typing_extensions import MutableMapping +29 | from typing_extensions import MutableSequence + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ UP035 +30 | from typing_extensions import MutableSet +31 | from typing_extensions import Optional + | + = help: Import from `typing` + +ℹ Safe fix +26 26 | from typing_extensions import MappingView +27 27 | from typing_extensions import Match +28 28 | from typing_extensions import MutableMapping +29 |-from typing_extensions import MutableSequence + 29 |+from typing import MutableSequence +30 30 | from typing_extensions import MutableSet +31 31 | from typing_extensions import Optional +32 32 | from typing_extensions import Pattern + +UP035_2.py:30:1: UP035 [*] Import from `typing` instead: `MutableSet` + | +28 | from typing_extensions import MutableMapping +29 | from typing_extensions import MutableSequence +30 | from typing_extensions import MutableSet + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ UP035 +31 | from typing_extensions import Optional +32 | from typing_extensions import Pattern + | + = help: Import from `typing` + +ℹ Safe fix +27 27 | from typing_extensions import Match +28 28 | from typing_extensions import MutableMapping +29 29 | from typing_extensions import MutableSequence +30 |-from typing_extensions import MutableSet + 30 |+from typing import MutableSet +31 31 | from typing_extensions import Optional +32 32 | from typing_extensions import Pattern +33 33 | from typing_extensions import Reversible + +UP035_2.py:31:1: UP035 [*] Import from `typing` instead: `Optional` + | +29 | from typing_extensions import MutableSequence +30 | from typing_extensions import MutableSet +31 | from typing_extensions import Optional + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ UP035 +32 | from typing_extensions import Pattern +33 | from typing_extensions import Reversible + | + = help: Import from `typing` + +ℹ Safe fix +28 28 | from typing_extensions import MutableMapping +29 29 | from typing_extensions import MutableSequence +30 30 | from typing_extensions import MutableSet +31 |-from typing_extensions import Optional + 31 |+from typing import Optional +32 32 | from typing_extensions import Pattern +33 33 | from typing_extensions import Reversible +34 34 | from typing_extensions import Sequence + +UP035_2.py:32:1: UP035 [*] Import from `typing` instead: `Pattern` + | +30 | from typing_extensions import MutableSet +31 | from typing_extensions import Optional +32 | from typing_extensions import Pattern + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ UP035 +33 | from typing_extensions import Reversible +34 | from typing_extensions import Sequence + | + = help: Import from `typing` + +ℹ Safe fix +29 29 | from typing_extensions import MutableSequence +30 30 | from typing_extensions import MutableSet +31 31 | from typing_extensions import Optional +32 |-from typing_extensions import Pattern + 32 |+from typing import Pattern +33 33 | from typing_extensions import Reversible +34 34 | from typing_extensions import Sequence +35 35 | from typing_extensions import Set + +UP035_2.py:33:1: UP035 [*] Import from `typing` instead: `Reversible` + | +31 | from typing_extensions import Optional +32 | from typing_extensions import Pattern +33 | from typing_extensions import Reversible + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ UP035 +34 | from typing_extensions import Sequence +35 | from typing_extensions import Set + | + = help: Import from `typing` + +ℹ Safe fix +30 30 | from typing_extensions import MutableSet +31 31 | from typing_extensions import Optional +32 32 | from typing_extensions import Pattern +33 |-from typing_extensions import Reversible + 33 |+from typing import Reversible +34 34 | from typing_extensions import Sequence +35 35 | from typing_extensions import Set +36 36 | from typing_extensions import Sized + +UP035_2.py:34:1: UP035 [*] Import from `typing` instead: `Sequence` + | +32 | from typing_extensions import Pattern +33 | from typing_extensions import Reversible +34 | from typing_extensions import Sequence + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ UP035 +35 | from typing_extensions import Set +36 | from typing_extensions import Sized + | + = help: Import from `typing` + +ℹ Safe fix +31 31 | from typing_extensions import Optional +32 32 | from typing_extensions import Pattern +33 33 | from typing_extensions import Reversible +34 |-from typing_extensions import Sequence + 34 |+from typing import Sequence +35 35 | from typing_extensions import Set +36 36 | from typing_extensions import Sized +37 37 | from typing_extensions import TYPE_CHECKING + +UP035_2.py:35:1: UP035 [*] Import from `typing` instead: `Set` + | +33 | from typing_extensions import Reversible +34 | from typing_extensions import Sequence +35 | from typing_extensions import Set + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ UP035 +36 | from typing_extensions import Sized +37 | from typing_extensions import TYPE_CHECKING + | + = help: Import from `typing` + +ℹ Safe fix +32 32 | from typing_extensions import Pattern +33 33 | from typing_extensions import Reversible +34 34 | from typing_extensions import Sequence +35 |-from typing_extensions import Set + 35 |+from typing import Set +36 36 | from typing_extensions import Sized +37 37 | from typing_extensions import TYPE_CHECKING +38 38 | from typing_extensions import Text + +UP035_2.py:36:1: UP035 [*] Import from `typing` instead: `Sized` + | +34 | from typing_extensions import Sequence +35 | from typing_extensions import Set +36 | from typing_extensions import Sized + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ UP035 +37 | from typing_extensions import TYPE_CHECKING +38 | from typing_extensions import Text + | + = help: Import from `typing` + +ℹ Safe fix +33 33 | from typing_extensions import Reversible +34 34 | from typing_extensions import Sequence +35 35 | from typing_extensions import Set +36 |-from typing_extensions import Sized + 36 |+from typing import Sized +37 37 | from typing_extensions import TYPE_CHECKING +38 38 | from typing_extensions import Text +39 39 | from typing_extensions import TextIO + +UP035_2.py:37:1: UP035 [*] Import from `typing` instead: `TYPE_CHECKING` + | +35 | from typing_extensions import Set +36 | from typing_extensions import Sized +37 | from typing_extensions import TYPE_CHECKING + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ UP035 +38 | from typing_extensions import Text +39 | from typing_extensions import TextIO + | + = help: Import from `typing` + +ℹ Safe fix +34 34 | from typing_extensions import Sequence +35 35 | from typing_extensions import Set +36 36 | from typing_extensions import Sized +37 |-from typing_extensions import TYPE_CHECKING + 37 |+from typing import TYPE_CHECKING +38 38 | from typing_extensions import Text +39 39 | from typing_extensions import TextIO +40 40 | from typing_extensions import Tuple + +UP035_2.py:38:1: UP035 [*] Import from `typing` instead: `Text` + | +36 | from typing_extensions import Sized +37 | from typing_extensions import TYPE_CHECKING +38 | from typing_extensions import Text + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ UP035 +39 | from typing_extensions import TextIO +40 | from typing_extensions import Tuple + | + = help: Import from `typing` + +ℹ Safe fix +35 35 | from typing_extensions import Set +36 36 | from typing_extensions import Sized +37 37 | from typing_extensions import TYPE_CHECKING +38 |-from typing_extensions import Text + 38 |+from typing import Text +39 39 | from typing_extensions import TextIO +40 40 | from typing_extensions import Tuple +41 41 | from typing_extensions import Type + +UP035_2.py:39:1: UP035 [*] Import from `typing` instead: `TextIO` + | +37 | from typing_extensions import TYPE_CHECKING +38 | from typing_extensions import Text +39 | from typing_extensions import TextIO + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ UP035 +40 | from typing_extensions import Tuple +41 | from typing_extensions import Type + | + = help: Import from `typing` + +ℹ Safe fix +36 36 | from typing_extensions import Sized +37 37 | from typing_extensions import TYPE_CHECKING +38 38 | from typing_extensions import Text +39 |-from typing_extensions import TextIO + 39 |+from typing import TextIO +40 40 | from typing_extensions import Tuple +41 41 | from typing_extensions import Type +42 42 | from typing_extensions import Union + +UP035_2.py:40:1: UP035 [*] Import from `typing` instead: `Tuple` + | +38 | from typing_extensions import Text +39 | from typing_extensions import TextIO +40 | from typing_extensions import Tuple + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ UP035 +41 | from typing_extensions import Type +42 | from typing_extensions import Union + | + = help: Import from `typing` + +ℹ Safe fix +37 37 | from typing_extensions import TYPE_CHECKING +38 38 | from typing_extensions import Text +39 39 | from typing_extensions import TextIO +40 |-from typing_extensions import Tuple + 40 |+from typing import Tuple +41 41 | from typing_extensions import Type +42 42 | from typing_extensions import Union +43 43 | from typing_extensions import ValuesView + +UP035_2.py:41:1: UP035 [*] Import from `typing` instead: `Type` + | +39 | from typing_extensions import TextIO +40 | from typing_extensions import Tuple +41 | from typing_extensions import Type + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ UP035 +42 | from typing_extensions import Union +43 | from typing_extensions import ValuesView + | + = help: Import from `typing` + +ℹ Safe fix +38 38 | from typing_extensions import Text +39 39 | from typing_extensions import TextIO +40 40 | from typing_extensions import Tuple +41 |-from typing_extensions import Type + 41 |+from typing import Type +42 42 | from typing_extensions import Union +43 43 | from typing_extensions import ValuesView +44 44 | from typing_extensions import cast + +UP035_2.py:42:1: UP035 [*] Import from `typing` instead: `Union` + | +40 | from typing_extensions import Tuple +41 | from typing_extensions import Type +42 | from typing_extensions import Union + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ UP035 +43 | from typing_extensions import ValuesView +44 | from typing_extensions import cast + | + = help: Import from `typing` + +ℹ Safe fix +39 39 | from typing_extensions import TextIO +40 40 | from typing_extensions import Tuple +41 41 | from typing_extensions import Type +42 |-from typing_extensions import Union + 42 |+from typing import Union +43 43 | from typing_extensions import ValuesView +44 44 | from typing_extensions import cast +45 45 | from typing_extensions import no_type_check + +UP035_2.py:43:1: UP035 [*] Import from `typing` instead: `ValuesView` + | +41 | from typing_extensions import Type +42 | from typing_extensions import Union +43 | from typing_extensions import ValuesView + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ UP035 +44 | from typing_extensions import cast +45 | from typing_extensions import no_type_check + | + = help: Import from `typing` + +ℹ Safe fix +40 40 | from typing_extensions import Tuple +41 41 | from typing_extensions import Type +42 42 | from typing_extensions import Union +43 |-from typing_extensions import ValuesView + 43 |+from typing import ValuesView +44 44 | from typing_extensions import cast +45 45 | from typing_extensions import no_type_check +46 46 | from typing_extensions import no_type_check_decorator + +UP035_2.py:44:1: UP035 [*] Import from `typing` instead: `cast` + | +42 | from typing_extensions import Union +43 | from typing_extensions import ValuesView +44 | from typing_extensions import cast + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ UP035 +45 | from typing_extensions import no_type_check +46 | from typing_extensions import no_type_check_decorator + | + = help: Import from `typing` + +ℹ Safe fix +41 41 | from typing_extensions import Type +42 42 | from typing_extensions import Union +43 43 | from typing_extensions import ValuesView +44 |-from typing_extensions import cast + 44 |+from typing import cast +45 45 | from typing_extensions import no_type_check +46 46 | from typing_extensions import no_type_check_decorator +47 47 | + +UP035_2.py:45:1: UP035 [*] Import from `typing` instead: `no_type_check` + | +43 | from typing_extensions import ValuesView +44 | from typing_extensions import cast +45 | from typing_extensions import no_type_check + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ UP035 +46 | from typing_extensions import no_type_check_decorator + | + = help: Import from `typing` + +ℹ Safe fix +42 42 | from typing_extensions import Union +43 43 | from typing_extensions import ValuesView +44 44 | from typing_extensions import cast +45 |-from typing_extensions import no_type_check + 45 |+from typing import no_type_check +46 46 | from typing_extensions import no_type_check_decorator +47 47 | +48 48 | from typing_extensions import AsyncContextManager + +UP035_2.py:46:1: UP035 [*] Import from `typing` instead: `no_type_check_decorator` + | +44 | from typing_extensions import cast +45 | from typing_extensions import no_type_check +46 | from typing_extensions import no_type_check_decorator + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ UP035 +47 | +48 | from typing_extensions import AsyncContextManager + | + = help: Import from `typing` + +ℹ Safe fix +43 43 | from typing_extensions import ValuesView +44 44 | from typing_extensions import cast +45 45 | from typing_extensions import no_type_check +46 |-from typing_extensions import no_type_check_decorator + 46 |+from typing import no_type_check_decorator +47 47 | +48 48 | from typing_extensions import AsyncContextManager +49 49 | from typing_extensions import AsyncGenerator + +UP035_2.py:48:1: UP035 [*] Import from `typing` instead: `AsyncContextManager` + | +46 | from typing_extensions import no_type_check_decorator +47 | +48 | from typing_extensions import AsyncContextManager + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ UP035 +49 | from typing_extensions import AsyncGenerator +50 | from typing_extensions import ChainMap + | + = help: Import from `typing` + +ℹ Safe fix +45 45 | from typing_extensions import no_type_check +46 46 | from typing_extensions import no_type_check_decorator +47 47 | +48 |-from typing_extensions import AsyncContextManager + 48 |+from typing import AsyncContextManager +49 49 | from typing_extensions import AsyncGenerator +50 50 | from typing_extensions import ChainMap +51 51 | from typing_extensions import Counter + +UP035_2.py:49:1: UP035 [*] Import from `typing` instead: `AsyncGenerator` + | +48 | from typing_extensions import AsyncContextManager +49 | from typing_extensions import AsyncGenerator + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ UP035 +50 | from typing_extensions import ChainMap +51 | from typing_extensions import Counter + | + = help: Import from `typing` + +ℹ Safe fix +46 46 | from typing_extensions import no_type_check_decorator +47 47 | +48 48 | from typing_extensions import AsyncContextManager +49 |-from typing_extensions import AsyncGenerator + 49 |+from typing import AsyncGenerator +50 50 | from typing_extensions import ChainMap +51 51 | from typing_extensions import Counter +52 52 | from typing_extensions import Deque + +UP035_2.py:50:1: UP035 [*] Import from `typing` instead: `ChainMap` + | +48 | from typing_extensions import AsyncContextManager +49 | from typing_extensions import AsyncGenerator +50 | from typing_extensions import ChainMap + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ UP035 +51 | from typing_extensions import Counter +52 | from typing_extensions import Deque + | + = help: Import from `typing` + +ℹ Safe fix +47 47 | +48 48 | from typing_extensions import AsyncContextManager +49 49 | from typing_extensions import AsyncGenerator +50 |-from typing_extensions import ChainMap + 50 |+from typing import ChainMap +51 51 | from typing_extensions import Counter +52 52 | from typing_extensions import Deque +53 53 | from typing_extensions import ForwardRef + +UP035_2.py:51:1: UP035 [*] Import from `typing` instead: `Counter` + | +49 | from typing_extensions import AsyncGenerator +50 | from typing_extensions import ChainMap +51 | from typing_extensions import Counter + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ UP035 +52 | from typing_extensions import Deque +53 | from typing_extensions import ForwardRef + | + = help: Import from `typing` + +ℹ Safe fix +48 48 | from typing_extensions import AsyncContextManager +49 49 | from typing_extensions import AsyncGenerator +50 50 | from typing_extensions import ChainMap +51 |-from typing_extensions import Counter + 51 |+from typing import Counter +52 52 | from typing_extensions import Deque +53 53 | from typing_extensions import ForwardRef +54 54 | from typing_extensions import NoReturn + +UP035_2.py:52:1: UP035 [*] Import from `typing` instead: `Deque` + | +50 | from typing_extensions import ChainMap +51 | from typing_extensions import Counter +52 | from typing_extensions import Deque + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ UP035 +53 | from typing_extensions import ForwardRef +54 | from typing_extensions import NoReturn + | + = help: Import from `typing` + +ℹ Safe fix +49 49 | from typing_extensions import AsyncGenerator +50 50 | from typing_extensions import ChainMap +51 51 | from typing_extensions import Counter +52 |-from typing_extensions import Deque + 52 |+from typing import Deque +53 53 | from typing_extensions import ForwardRef +54 54 | from typing_extensions import NoReturn +55 55 | + +UP035_2.py:53:1: UP035 [*] Import from `typing` instead: `ForwardRef` + | +51 | from typing_extensions import Counter +52 | from typing_extensions import Deque +53 | from typing_extensions import ForwardRef + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ UP035 +54 | from typing_extensions import NoReturn + | + = help: Import from `typing` + +ℹ Safe fix +50 50 | from typing_extensions import ChainMap +51 51 | from typing_extensions import Counter +52 52 | from typing_extensions import Deque +53 |-from typing_extensions import ForwardRef + 53 |+from typing import ForwardRef +54 54 | from typing_extensions import NoReturn +55 55 | +56 56 | from typing_extensions import Final + +UP035_2.py:54:1: UP035 [*] Import from `typing` instead: `NoReturn` + | +52 | from typing_extensions import Deque +53 | from typing_extensions import ForwardRef +54 | from typing_extensions import NoReturn + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ UP035 +55 | +56 | from typing_extensions import Final + | + = help: Import from `typing` + +ℹ Safe fix +51 51 | from typing_extensions import Counter +52 52 | from typing_extensions import Deque +53 53 | from typing_extensions import ForwardRef +54 |-from typing_extensions import NoReturn + 54 |+from typing import NoReturn +55 55 | +56 56 | from typing_extensions import Final +57 57 | from typing_extensions import OrderedDict + +UP035_2.py:56:1: UP035 [*] Import from `typing` instead: `Final` + | +54 | from typing_extensions import NoReturn +55 | +56 | from typing_extensions import Final + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ UP035 +57 | from typing_extensions import OrderedDict +58 | from typing_extensions import runtime_checkable + | + = help: Import from `typing` + +ℹ Safe fix +53 53 | from typing_extensions import ForwardRef +54 54 | from typing_extensions import NoReturn +55 55 | +56 |-from typing_extensions import Final + 56 |+from typing import Final +57 57 | from typing_extensions import OrderedDict +58 58 | from typing_extensions import runtime_checkable +59 59 | + +UP035_2.py:57:1: UP035 [*] Import from `typing` instead: `OrderedDict` + | +56 | from typing_extensions import Final +57 | from typing_extensions import OrderedDict + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ UP035 +58 | from typing_extensions import runtime_checkable + | + = help: Import from `typing` + +ℹ Safe fix +54 54 | from typing_extensions import NoReturn +55 55 | +56 56 | from typing_extensions import Final +57 |-from typing_extensions import OrderedDict + 57 |+from typing import OrderedDict +58 58 | from typing_extensions import runtime_checkable +59 59 | +60 60 | from typing_extensions import Annotated + +UP035_2.py:58:1: UP035 [*] Import from `typing` instead: `runtime_checkable` + | +56 | from typing_extensions import Final +57 | from typing_extensions import OrderedDict +58 | from typing_extensions import runtime_checkable + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ UP035 +59 | +60 | from typing_extensions import Annotated + | + = help: Import from `typing` + +ℹ Safe fix +55 55 | +56 56 | from typing_extensions import Final +57 57 | from typing_extensions import OrderedDict +58 |-from typing_extensions import runtime_checkable + 58 |+from typing import runtime_checkable +59 59 | +60 60 | from typing_extensions import Annotated +61 61 | from typing_extensions import get_type_hints + +UP035_2.py:60:1: UP035 [*] Import from `typing` instead: `Annotated` + | +58 | from typing_extensions import runtime_checkable +59 | +60 | from typing_extensions import Annotated + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ UP035 +61 | from typing_extensions import get_type_hints + | + = help: Import from `typing` + +ℹ Safe fix +57 57 | from typing_extensions import OrderedDict +58 58 | from typing_extensions import runtime_checkable +59 59 | +60 |-from typing_extensions import Annotated + 60 |+from typing import Annotated +61 61 | from typing_extensions import get_type_hints +62 62 | +63 63 | from typing_extensions import Concatenate + +UP035_2.py:61:1: UP035 [*] Import from `typing` instead: `get_type_hints` + | +60 | from typing_extensions import Annotated +61 | from typing_extensions import get_type_hints + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ UP035 +62 | +63 | from typing_extensions import Concatenate + | + = help: Import from `typing` + +ℹ Unsafe fix +58 58 | from typing_extensions import runtime_checkable +59 59 | +60 60 | from typing_extensions import Annotated +61 |-from typing_extensions import get_type_hints + 61 |+from typing import get_type_hints +62 62 | +63 63 | from typing_extensions import Concatenate +64 64 | from typing_extensions import Literal + +UP035_2.py:63:1: UP035 [*] Import from `typing` instead: `Concatenate` + | +61 | from typing_extensions import get_type_hints +62 | +63 | from typing_extensions import Concatenate + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ UP035 +64 | from typing_extensions import Literal +65 | from typing_extensions import NewType + | + = help: Import from `typing` + +ℹ Safe fix +60 60 | from typing_extensions import Annotated +61 61 | from typing_extensions import get_type_hints +62 62 | +63 |-from typing_extensions import Concatenate + 63 |+from typing import Concatenate +64 64 | from typing_extensions import Literal +65 65 | from typing_extensions import NewType +66 66 | from typing_extensions import ParamSpecArgs + +UP035_2.py:64:1: UP035 [*] Import from `typing` instead: `Literal` + | +63 | from typing_extensions import Concatenate +64 | from typing_extensions import Literal + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ UP035 +65 | from typing_extensions import NewType +66 | from typing_extensions import ParamSpecArgs + | + = help: Import from `typing` + +ℹ Safe fix +61 61 | from typing_extensions import get_type_hints +62 62 | +63 63 | from typing_extensions import Concatenate +64 |-from typing_extensions import Literal + 64 |+from typing import Literal +65 65 | from typing_extensions import NewType +66 66 | from typing_extensions import ParamSpecArgs +67 67 | from typing_extensions import ParamSpecKwargs + +UP035_2.py:65:1: UP035 [*] Import from `typing` instead: `NewType` + | +63 | from typing_extensions import Concatenate +64 | from typing_extensions import Literal +65 | from typing_extensions import NewType + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ UP035 +66 | from typing_extensions import ParamSpecArgs +67 | from typing_extensions import ParamSpecKwargs + | + = help: Import from `typing` + +ℹ Safe fix +62 62 | +63 63 | from typing_extensions import Concatenate +64 64 | from typing_extensions import Literal +65 |-from typing_extensions import NewType + 65 |+from typing import NewType +66 66 | from typing_extensions import ParamSpecArgs +67 67 | from typing_extensions import ParamSpecKwargs +68 68 | from typing_extensions import TypeAlias + +UP035_2.py:66:1: UP035 [*] Import from `typing` instead: `ParamSpecArgs` + | +64 | from typing_extensions import Literal +65 | from typing_extensions import NewType +66 | from typing_extensions import ParamSpecArgs + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ UP035 +67 | from typing_extensions import ParamSpecKwargs +68 | from typing_extensions import TypeAlias + | + = help: Import from `typing` + +ℹ Safe fix +63 63 | from typing_extensions import Concatenate +64 64 | from typing_extensions import Literal +65 65 | from typing_extensions import NewType +66 |-from typing_extensions import ParamSpecArgs + 66 |+from typing import ParamSpecArgs +67 67 | from typing_extensions import ParamSpecKwargs +68 68 | from typing_extensions import TypeAlias +69 69 | from typing_extensions import TypeGuard + +UP035_2.py:67:1: UP035 [*] Import from `typing` instead: `ParamSpecKwargs` + | +65 | from typing_extensions import NewType +66 | from typing_extensions import ParamSpecArgs +67 | from typing_extensions import ParamSpecKwargs + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ UP035 +68 | from typing_extensions import TypeAlias +69 | from typing_extensions import TypeGuard + | + = help: Import from `typing` + +ℹ Safe fix +64 64 | from typing_extensions import Literal +65 65 | from typing_extensions import NewType +66 66 | from typing_extensions import ParamSpecArgs +67 |-from typing_extensions import ParamSpecKwargs + 67 |+from typing import ParamSpecKwargs +68 68 | from typing_extensions import TypeAlias +69 69 | from typing_extensions import TypeGuard +70 70 | from typing_extensions import get_args + +UP035_2.py:68:1: UP035 [*] Import from `typing` instead: `TypeAlias` + | +66 | from typing_extensions import ParamSpecArgs +67 | from typing_extensions import ParamSpecKwargs +68 | from typing_extensions import TypeAlias + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ UP035 +69 | from typing_extensions import TypeGuard +70 | from typing_extensions import get_args + | + = help: Import from `typing` + +ℹ Safe fix +65 65 | from typing_extensions import NewType +66 66 | from typing_extensions import ParamSpecArgs +67 67 | from typing_extensions import ParamSpecKwargs +68 |-from typing_extensions import TypeAlias + 68 |+from typing import TypeAlias +69 69 | from typing_extensions import TypeGuard +70 70 | from typing_extensions import get_args +71 71 | from typing_extensions import get_origin + +UP035_2.py:69:1: UP035 [*] Import from `typing` instead: `TypeGuard` + | +67 | from typing_extensions import ParamSpecKwargs +68 | from typing_extensions import TypeAlias +69 | from typing_extensions import TypeGuard + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ UP035 +70 | from typing_extensions import get_args +71 | from typing_extensions import get_origin + | + = help: Import from `typing` + +ℹ Safe fix +66 66 | from typing_extensions import ParamSpecArgs +67 67 | from typing_extensions import ParamSpecKwargs +68 68 | from typing_extensions import TypeAlias +69 |-from typing_extensions import TypeGuard + 69 |+from typing import TypeGuard +70 70 | from typing_extensions import get_args +71 71 | from typing_extensions import get_origin +72 72 | from typing_extensions import is_typeddict + +UP035_2.py:70:1: UP035 [*] Import from `typing` instead: `get_args` + | +68 | from typing_extensions import TypeAlias +69 | from typing_extensions import TypeGuard +70 | from typing_extensions import get_args + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ UP035 +71 | from typing_extensions import get_origin +72 | from typing_extensions import is_typeddict + | + = help: Import from `typing` + +ℹ Safe fix +67 67 | from typing_extensions import ParamSpecKwargs +68 68 | from typing_extensions import TypeAlias +69 69 | from typing_extensions import TypeGuard +70 |-from typing_extensions import get_args + 70 |+from typing import get_args +71 71 | from typing_extensions import get_origin +72 72 | from typing_extensions import is_typeddict +73 73 | + +UP035_2.py:71:1: UP035 [*] Import from `typing` instead: `get_origin` + | +69 | from typing_extensions import TypeGuard +70 | from typing_extensions import get_args +71 | from typing_extensions import get_origin + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ UP035 +72 | from typing_extensions import is_typeddict + | + = help: Import from `typing` + +ℹ Safe fix +68 68 | from typing_extensions import TypeAlias +69 69 | from typing_extensions import TypeGuard +70 70 | from typing_extensions import get_args +71 |-from typing_extensions import get_origin + 71 |+from typing import get_origin +72 72 | from typing_extensions import is_typeddict +73 73 | +74 74 | from typing_extensions import Any + +UP035_2.py:72:1: UP035 [*] Import from `typing` instead: `is_typeddict` + | +70 | from typing_extensions import get_args +71 | from typing_extensions import get_origin +72 | from typing_extensions import is_typeddict + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ UP035 +73 | +74 | from typing_extensions import Any + | + = help: Import from `typing` + +ℹ Unsafe fix +69 69 | from typing_extensions import TypeGuard +70 70 | from typing_extensions import get_args +71 71 | from typing_extensions import get_origin +72 |-from typing_extensions import is_typeddict + 72 |+from typing import is_typeddict +73 73 | +74 74 | from typing_extensions import Any +75 75 | from typing_extensions import LiteralString + +UP035_2.py:74:1: UP035 [*] Import from `typing` instead: `Any` + | +72 | from typing_extensions import is_typeddict +73 | +74 | from typing_extensions import Any + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ UP035 +75 | from typing_extensions import LiteralString +76 | from typing_extensions import Never + | + = help: Import from `typing` + +ℹ Safe fix +71 71 | from typing_extensions import get_origin +72 72 | from typing_extensions import is_typeddict +73 73 | +74 |-from typing_extensions import Any + 74 |+from typing import Any +75 75 | from typing_extensions import LiteralString +76 76 | from typing_extensions import Never +77 77 | from typing_extensions import NotRequired + +UP035_2.py:75:1: UP035 [*] Import from `typing` instead: `LiteralString` + | +74 | from typing_extensions import Any +75 | from typing_extensions import LiteralString + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ UP035 +76 | from typing_extensions import Never +77 | from typing_extensions import NotRequired + | + = help: Import from `typing` + +ℹ Safe fix +72 72 | from typing_extensions import is_typeddict +73 73 | +74 74 | from typing_extensions import Any +75 |-from typing_extensions import LiteralString + 75 |+from typing import LiteralString +76 76 | from typing_extensions import Never +77 77 | from typing_extensions import NotRequired +78 78 | from typing_extensions import Required + +UP035_2.py:76:1: UP035 [*] Import from `typing` instead: `Never` + | +74 | from typing_extensions import Any +75 | from typing_extensions import LiteralString +76 | from typing_extensions import Never + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ UP035 +77 | from typing_extensions import NotRequired +78 | from typing_extensions import Required + | + = help: Import from `typing` + +ℹ Safe fix +73 73 | +74 74 | from typing_extensions import Any +75 75 | from typing_extensions import LiteralString +76 |-from typing_extensions import Never + 76 |+from typing import Never +77 77 | from typing_extensions import NotRequired +78 78 | from typing_extensions import Required +79 79 | from typing_extensions import Self + +UP035_2.py:77:1: UP035 [*] Import from `typing` instead: `NotRequired` + | +75 | from typing_extensions import LiteralString +76 | from typing_extensions import Never +77 | from typing_extensions import NotRequired + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ UP035 +78 | from typing_extensions import Required +79 | from typing_extensions import Self + | + = help: Import from `typing` + +ℹ Safe fix +74 74 | from typing_extensions import Any +75 75 | from typing_extensions import LiteralString +76 76 | from typing_extensions import Never +77 |-from typing_extensions import NotRequired + 77 |+from typing import NotRequired +78 78 | from typing_extensions import Required +79 79 | from typing_extensions import Self +80 80 | from typing_extensions import assert_never + +UP035_2.py:78:1: UP035 [*] Import from `typing` instead: `Required` + | +76 | from typing_extensions import Never +77 | from typing_extensions import NotRequired +78 | from typing_extensions import Required + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ UP035 +79 | from typing_extensions import Self +80 | from typing_extensions import assert_never + | + = help: Import from `typing` + +ℹ Safe fix +75 75 | from typing_extensions import LiteralString +76 76 | from typing_extensions import Never +77 77 | from typing_extensions import NotRequired +78 |-from typing_extensions import Required + 78 |+from typing import Required +79 79 | from typing_extensions import Self +80 80 | from typing_extensions import assert_never +81 81 | from typing_extensions import assert_type + +UP035_2.py:79:1: UP035 [*] Import from `typing` instead: `Self` + | +77 | from typing_extensions import NotRequired +78 | from typing_extensions import Required +79 | from typing_extensions import Self + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ UP035 +80 | from typing_extensions import assert_never +81 | from typing_extensions import assert_type + | + = help: Import from `typing` + +ℹ Safe fix +76 76 | from typing_extensions import Never +77 77 | from typing_extensions import NotRequired +78 78 | from typing_extensions import Required +79 |-from typing_extensions import Self + 79 |+from typing import Self +80 80 | from typing_extensions import assert_never +81 81 | from typing_extensions import assert_type +82 82 | from typing_extensions import clear_overloads + +UP035_2.py:80:1: UP035 [*] Import from `typing` instead: `assert_never` + | +78 | from typing_extensions import Required +79 | from typing_extensions import Self +80 | from typing_extensions import assert_never + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ UP035 +81 | from typing_extensions import assert_type +82 | from typing_extensions import clear_overloads + | + = help: Import from `typing` + +ℹ Safe fix +77 77 | from typing_extensions import NotRequired +78 78 | from typing_extensions import Required +79 79 | from typing_extensions import Self +80 |-from typing_extensions import assert_never + 80 |+from typing import assert_never +81 81 | from typing_extensions import assert_type +82 82 | from typing_extensions import clear_overloads +83 83 | from typing_extensions import final + +UP035_2.py:81:1: UP035 [*] Import from `typing` instead: `assert_type` + | +79 | from typing_extensions import Self +80 | from typing_extensions import assert_never +81 | from typing_extensions import assert_type + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ UP035 +82 | from typing_extensions import clear_overloads +83 | from typing_extensions import final + | + = help: Import from `typing` + +ℹ Safe fix +78 78 | from typing_extensions import Required +79 79 | from typing_extensions import Self +80 80 | from typing_extensions import assert_never +81 |-from typing_extensions import assert_type + 81 |+from typing import assert_type +82 82 | from typing_extensions import clear_overloads +83 83 | from typing_extensions import final +84 84 | from typing_extensions import get_overloads + +UP035_2.py:82:1: UP035 [*] Import from `typing` instead: `clear_overloads` + | +80 | from typing_extensions import assert_never +81 | from typing_extensions import assert_type +82 | from typing_extensions import clear_overloads + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ UP035 +83 | from typing_extensions import final +84 | from typing_extensions import get_overloads + | + = help: Import from `typing` + +ℹ Safe fix +79 79 | from typing_extensions import Self +80 80 | from typing_extensions import assert_never +81 81 | from typing_extensions import assert_type +82 |-from typing_extensions import clear_overloads + 82 |+from typing import clear_overloads +83 83 | from typing_extensions import final +84 84 | from typing_extensions import get_overloads +85 85 | from typing_extensions import overload + +UP035_2.py:83:1: UP035 [*] Import from `typing` instead: `final` + | +81 | from typing_extensions import assert_type +82 | from typing_extensions import clear_overloads +83 | from typing_extensions import final + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ UP035 +84 | from typing_extensions import get_overloads +85 | from typing_extensions import overload + | + = help: Import from `typing` + +ℹ Safe fix +80 80 | from typing_extensions import assert_never +81 81 | from typing_extensions import assert_type +82 82 | from typing_extensions import clear_overloads +83 |-from typing_extensions import final + 83 |+from typing import final +84 84 | from typing_extensions import get_overloads +85 85 | from typing_extensions import overload +86 86 | from typing_extensions import reveal_type + +UP035_2.py:84:1: UP035 [*] Import from `typing` instead: `get_overloads` + | +82 | from typing_extensions import clear_overloads +83 | from typing_extensions import final +84 | from typing_extensions import get_overloads + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ UP035 +85 | from typing_extensions import overload +86 | from typing_extensions import reveal_type + | + = help: Import from `typing` + +ℹ Safe fix +81 81 | from typing_extensions import assert_type +82 82 | from typing_extensions import clear_overloads +83 83 | from typing_extensions import final +84 |-from typing_extensions import get_overloads + 84 |+from typing import get_overloads +85 85 | from typing_extensions import overload +86 86 | from typing_extensions import reveal_type +87 87 | + +UP035_2.py:85:1: UP035 [*] Import from `typing` instead: `overload` + | +83 | from typing_extensions import final +84 | from typing_extensions import get_overloads +85 | from typing_extensions import overload + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ UP035 +86 | from typing_extensions import reveal_type + | + = help: Import from `typing` + +ℹ Safe fix +82 82 | from typing_extensions import clear_overloads +83 83 | from typing_extensions import final +84 84 | from typing_extensions import get_overloads +85 |-from typing_extensions import overload + 85 |+from typing import overload +86 86 | from typing_extensions import reveal_type +87 87 | +88 88 | from typing_extensions import Protocol + +UP035_2.py:86:1: UP035 [*] Import from `typing` instead: `reveal_type` + | +84 | from typing_extensions import get_overloads +85 | from typing_extensions import overload +86 | from typing_extensions import reveal_type + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ UP035 +87 | +88 | from typing_extensions import Protocol + | + = help: Import from `typing` + +ℹ Safe fix +83 83 | from typing_extensions import final +84 84 | from typing_extensions import get_overloads +85 85 | from typing_extensions import overload +86 |-from typing_extensions import reveal_type + 86 |+from typing import reveal_type +87 87 | +88 88 | from typing_extensions import Protocol +89 89 | from typing_extensions import SupportsAbs + +UP035_2.py:88:1: UP035 [*] Import from `typing` instead: `Protocol` + | +86 | from typing_extensions import reveal_type +87 | +88 | from typing_extensions import Protocol + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ UP035 +89 | from typing_extensions import SupportsAbs +90 | from typing_extensions import SupportsBytes + | + = help: Import from `typing` + +ℹ Safe fix +85 85 | from typing_extensions import overload +86 86 | from typing_extensions import reveal_type +87 87 | +88 |-from typing_extensions import Protocol + 88 |+from typing import Protocol +89 89 | from typing_extensions import SupportsAbs +90 90 | from typing_extensions import SupportsBytes +91 91 | from typing_extensions import SupportsComplex + +UP035_2.py:89:1: UP035 [*] Import from `typing` instead: `SupportsAbs` + | +88 | from typing_extensions import Protocol +89 | from typing_extensions import SupportsAbs + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ UP035 +90 | from typing_extensions import SupportsBytes +91 | from typing_extensions import SupportsComplex + | + = help: Import from `typing` + +ℹ Safe fix +86 86 | from typing_extensions import reveal_type +87 87 | +88 88 | from typing_extensions import Protocol +89 |-from typing_extensions import SupportsAbs + 89 |+from typing import SupportsAbs +90 90 | from typing_extensions import SupportsBytes +91 91 | from typing_extensions import SupportsComplex +92 92 | from typing_extensions import SupportsFloat + +UP035_2.py:90:1: UP035 [*] Import from `typing` instead: `SupportsBytes` + | +88 | from typing_extensions import Protocol +89 | from typing_extensions import SupportsAbs +90 | from typing_extensions import SupportsBytes + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ UP035 +91 | from typing_extensions import SupportsComplex +92 | from typing_extensions import SupportsFloat + | + = help: Import from `typing` + +ℹ Safe fix +87 87 | +88 88 | from typing_extensions import Protocol +89 89 | from typing_extensions import SupportsAbs +90 |-from typing_extensions import SupportsBytes + 90 |+from typing import SupportsBytes +91 91 | from typing_extensions import SupportsComplex +92 92 | from typing_extensions import SupportsFloat +93 93 | from typing_extensions import SupportsInt + +UP035_2.py:91:1: UP035 [*] Import from `typing` instead: `SupportsComplex` + | +89 | from typing_extensions import SupportsAbs +90 | from typing_extensions import SupportsBytes +91 | from typing_extensions import SupportsComplex + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ UP035 +92 | from typing_extensions import SupportsFloat +93 | from typing_extensions import SupportsInt + | + = help: Import from `typing` + +ℹ Safe fix +88 88 | from typing_extensions import Protocol +89 89 | from typing_extensions import SupportsAbs +90 90 | from typing_extensions import SupportsBytes +91 |-from typing_extensions import SupportsComplex + 91 |+from typing import SupportsComplex +92 92 | from typing_extensions import SupportsFloat +93 93 | from typing_extensions import SupportsInt +94 94 | from typing_extensions import SupportsRound + +UP035_2.py:92:1: UP035 [*] Import from `typing` instead: `SupportsFloat` + | +90 | from typing_extensions import SupportsBytes +91 | from typing_extensions import SupportsComplex +92 | from typing_extensions import SupportsFloat + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ UP035 +93 | from typing_extensions import SupportsInt +94 | from typing_extensions import SupportsRound + | + = help: Import from `typing` + +ℹ Safe fix +89 89 | from typing_extensions import SupportsAbs +90 90 | from typing_extensions import SupportsBytes +91 91 | from typing_extensions import SupportsComplex +92 |-from typing_extensions import SupportsFloat + 92 |+from typing import SupportsFloat +93 93 | from typing_extensions import SupportsInt +94 94 | from typing_extensions import SupportsRound +95 95 | from typing_extensions import Unpack + +UP035_2.py:93:1: UP035 [*] Import from `typing` instead: `SupportsInt` + | +91 | from typing_extensions import SupportsComplex +92 | from typing_extensions import SupportsFloat +93 | from typing_extensions import SupportsInt + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ UP035 +94 | from typing_extensions import SupportsRound +95 | from typing_extensions import Unpack + | + = help: Import from `typing` + +ℹ Safe fix +90 90 | from typing_extensions import SupportsBytes +91 91 | from typing_extensions import SupportsComplex +92 92 | from typing_extensions import SupportsFloat +93 |-from typing_extensions import SupportsInt + 93 |+from typing import SupportsInt +94 94 | from typing_extensions import SupportsRound +95 95 | from typing_extensions import Unpack +96 96 | from typing_extensions import dataclass_transform + +UP035_2.py:94:1: UP035 [*] Import from `typing` instead: `SupportsRound` + | +92 | from typing_extensions import SupportsFloat +93 | from typing_extensions import SupportsInt +94 | from typing_extensions import SupportsRound + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ UP035 +95 | from typing_extensions import Unpack +96 | from typing_extensions import dataclass_transform + | + = help: Import from `typing` + +ℹ Safe fix +91 91 | from typing_extensions import SupportsComplex +92 92 | from typing_extensions import SupportsFloat +93 93 | from typing_extensions import SupportsInt +94 |-from typing_extensions import SupportsRound + 94 |+from typing import SupportsRound +95 95 | from typing_extensions import Unpack +96 96 | from typing_extensions import dataclass_transform +97 97 | from typing_extensions import NamedTuple + +UP035_2.py:95:1: UP035 [*] Import from `typing` instead: `Unpack` + | +93 | from typing_extensions import SupportsInt +94 | from typing_extensions import SupportsRound +95 | from typing_extensions import Unpack + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ UP035 +96 | from typing_extensions import dataclass_transform +97 | from typing_extensions import NamedTuple + | + = help: Import from `typing` + +ℹ Safe fix +92 92 | from typing_extensions import SupportsFloat +93 93 | from typing_extensions import SupportsInt +94 94 | from typing_extensions import SupportsRound +95 |-from typing_extensions import Unpack + 95 |+from typing import Unpack +96 96 | from typing_extensions import dataclass_transform +97 97 | from typing_extensions import NamedTuple +98 98 | from typing_extensions import TypedDict + +UP035_2.py:96:1: UP035 [*] Import from `typing` instead: `dataclass_transform` + | +94 | from typing_extensions import SupportsRound +95 | from typing_extensions import Unpack +96 | from typing_extensions import dataclass_transform + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ UP035 +97 | from typing_extensions import NamedTuple +98 | from typing_extensions import TypedDict + | + = help: Import from `typing` + +ℹ Safe fix +93 93 | from typing_extensions import SupportsInt +94 94 | from typing_extensions import SupportsRound +95 95 | from typing_extensions import Unpack +96 |-from typing_extensions import dataclass_transform + 96 |+from typing import dataclass_transform +97 97 | from typing_extensions import NamedTuple +98 98 | from typing_extensions import TypedDict + +UP035_2.py:97:1: UP035 [*] Import from `typing` instead: `NamedTuple` + | +95 | from typing_extensions import Unpack +96 | from typing_extensions import dataclass_transform +97 | from typing_extensions import NamedTuple + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ UP035 +98 | from typing_extensions import TypedDict + | + = help: Import from `typing` + +ℹ Unsafe fix +94 94 | from typing_extensions import SupportsRound +95 95 | from typing_extensions import Unpack +96 96 | from typing_extensions import dataclass_transform +97 |-from typing_extensions import NamedTuple + 97 |+from typing import NamedTuple +98 98 | from typing_extensions import TypedDict + +UP035_2.py:98:1: UP035 [*] Import from `typing` instead: `TypedDict` + | +96 | from typing_extensions import dataclass_transform +97 | from typing_extensions import NamedTuple +98 | from typing_extensions import TypedDict + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ UP035 + | + = help: Import from `typing` + +ℹ Unsafe fix +95 95 | from typing_extensions import Unpack +96 96 | from typing_extensions import dataclass_transform +97 97 | from typing_extensions import NamedTuple +98 |-from typing_extensions import TypedDict + 98 |+from typing import TypedDict + + diff --git a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP035_3.py.snap b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP035_3.py.snap new file mode 100644 index 0000000000000..2fac2ac858076 --- /dev/null +++ b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP035_3.py.snap @@ -0,0 +1,17 @@ +--- +source: crates/ruff_linter/src/rules/pyupgrade/mod.rs +--- +UP035_3.py:2:1: UP035 [*] Import from `shlex` instead: `quote` + | +1 | """Things moved from `pipes` to `shlex`.""" +2 | from pipes import quote + | ^^^^^^^^^^^^^^^^^^^^^^^ UP035 + | + = help: Import from `shlex` + +ℹ Safe fix +1 1 | """Things moved from `pipes` to `shlex`.""" +2 |-from pipes import quote + 2 |+from shlex import quote + + diff --git a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP035_4.py.snap b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP035_4.py.snap new file mode 100644 index 0000000000000..c18338a856533 --- /dev/null +++ b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP035_4.py.snap @@ -0,0 +1,37 @@ +--- +source: crates/ruff_linter/src/rules/pyupgrade/mod.rs +--- +UP035_4.py:2:1: UP035 [*] Import from `typing` instead: `NoReturn` + | +1 | """Things moved from `mypy_extensions` to `typing`.""" +2 | from mypy_extensions import NoReturn + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ UP035 +3 | +4 | from mypy_extensions import TypedDict + | + = help: Import from `typing` + +ℹ Unsafe fix +1 1 | """Things moved from `mypy_extensions` to `typing`.""" +2 |-from mypy_extensions import NoReturn + 2 |+from typing import NoReturn +3 3 | +4 4 | from mypy_extensions import TypedDict + +UP035_4.py:4:1: UP035 [*] Import from `typing` instead: `TypedDict` + | +2 | from mypy_extensions import NoReturn +3 | +4 | from mypy_extensions import TypedDict + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ UP035 + | + = help: Import from `typing` + +ℹ Unsafe fix +1 1 | """Things moved from `mypy_extensions` to `typing`.""" +2 2 | from mypy_extensions import NoReturn +3 3 | +4 |-from mypy_extensions import TypedDict + 4 |+from typing import TypedDict + + diff --git a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP035_5.py.snap b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP035_5.py.snap new file mode 100644 index 0000000000000..c525741300ec5 --- /dev/null +++ b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP035_5.py.snap @@ -0,0 +1,497 @@ +--- +source: crates/ruff_linter/src/rules/pyupgrade/mod.rs +--- +UP035_5.py:2:1: UP035 [*] Import from `collections.abc` instead: `AsyncGenerator` + | +1 | """Members of `typing` that were moved to `collections.abc`.""" +2 | from typing import AsyncGenerator + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ UP035 +3 | from typing import AsyncIterable +4 | from typing import AsyncIterator + | + = help: Import from `collections.abc` + +ℹ Unsafe fix +1 1 | """Members of `typing` that were moved to `collections.abc`.""" +2 |-from typing import AsyncGenerator + 2 |+from collections.abc import AsyncGenerator +3 3 | from typing import AsyncIterable +4 4 | from typing import AsyncIterator +5 5 | from typing import Awaitable + +UP035_5.py:3:1: UP035 [*] Import from `collections.abc` instead: `AsyncIterable` + | +1 | """Members of `typing` that were moved to `collections.abc`.""" +2 | from typing import AsyncGenerator +3 | from typing import AsyncIterable + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ UP035 +4 | from typing import AsyncIterator +5 | from typing import Awaitable + | + = help: Import from `collections.abc` + +ℹ Unsafe fix +1 1 | """Members of `typing` that were moved to `collections.abc`.""" +2 2 | from typing import AsyncGenerator +3 |-from typing import AsyncIterable + 3 |+from collections.abc import AsyncIterable +4 4 | from typing import AsyncIterator +5 5 | from typing import Awaitable +6 6 | from typing import ByteString + +UP035_5.py:4:1: UP035 [*] Import from `collections.abc` instead: `AsyncIterator` + | +2 | from typing import AsyncGenerator +3 | from typing import AsyncIterable +4 | from typing import AsyncIterator + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ UP035 +5 | from typing import Awaitable +6 | from typing import ByteString + | + = help: Import from `collections.abc` + +ℹ Unsafe fix +1 1 | """Members of `typing` that were moved to `collections.abc`.""" +2 2 | from typing import AsyncGenerator +3 3 | from typing import AsyncIterable +4 |-from typing import AsyncIterator + 4 |+from collections.abc import AsyncIterator +5 5 | from typing import Awaitable +6 6 | from typing import ByteString +7 7 | from typing import Collection + +UP035_5.py:5:1: UP035 [*] Import from `collections.abc` instead: `Awaitable` + | +3 | from typing import AsyncIterable +4 | from typing import AsyncIterator +5 | from typing import Awaitable + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ UP035 +6 | from typing import ByteString +7 | from typing import Collection + | + = help: Import from `collections.abc` + +ℹ Unsafe fix +2 2 | from typing import AsyncGenerator +3 3 | from typing import AsyncIterable +4 4 | from typing import AsyncIterator +5 |-from typing import Awaitable + 5 |+from collections.abc import Awaitable +6 6 | from typing import ByteString +7 7 | from typing import Collection +8 8 | from typing import Container + +UP035_5.py:6:1: UP035 [*] Import from `collections.abc` instead: `ByteString` + | +4 | from typing import AsyncIterator +5 | from typing import Awaitable +6 | from typing import ByteString + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ UP035 +7 | from typing import Collection +8 | from typing import Container + | + = help: Import from `collections.abc` + +ℹ Unsafe fix +3 3 | from typing import AsyncIterable +4 4 | from typing import AsyncIterator +5 5 | from typing import Awaitable +6 |-from typing import ByteString + 6 |+from collections.abc import ByteString +7 7 | from typing import Collection +8 8 | from typing import Container +9 9 | from typing import Coroutine + +UP035_5.py:7:1: UP035 [*] Import from `collections.abc` instead: `Collection` + | +5 | from typing import Awaitable +6 | from typing import ByteString +7 | from typing import Collection + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ UP035 +8 | from typing import Container +9 | from typing import Coroutine + | + = help: Import from `collections.abc` + +ℹ Unsafe fix +4 4 | from typing import AsyncIterator +5 5 | from typing import Awaitable +6 6 | from typing import ByteString +7 |-from typing import Collection + 7 |+from collections.abc import Collection +8 8 | from typing import Container +9 9 | from typing import Coroutine +10 10 | from typing import Generator + +UP035_5.py:8:1: UP035 [*] Import from `collections.abc` instead: `Container` + | + 6 | from typing import ByteString + 7 | from typing import Collection + 8 | from typing import Container + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ UP035 + 9 | from typing import Coroutine +10 | from typing import Generator + | + = help: Import from `collections.abc` + +ℹ Unsafe fix +5 5 | from typing import Awaitable +6 6 | from typing import ByteString +7 7 | from typing import Collection +8 |-from typing import Container + 8 |+from collections.abc import Container +9 9 | from typing import Coroutine +10 10 | from typing import Generator +11 11 | from typing import Hashable + +UP035_5.py:9:1: UP035 [*] Import from `collections.abc` instead: `Coroutine` + | + 7 | from typing import Collection + 8 | from typing import Container + 9 | from typing import Coroutine + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ UP035 +10 | from typing import Generator +11 | from typing import Hashable + | + = help: Import from `collections.abc` + +ℹ Unsafe fix +6 6 | from typing import ByteString +7 7 | from typing import Collection +8 8 | from typing import Container +9 |-from typing import Coroutine + 9 |+from collections.abc import Coroutine +10 10 | from typing import Generator +11 11 | from typing import Hashable +12 12 | from typing import ItemsView + +UP035_5.py:10:1: UP035 [*] Import from `collections.abc` instead: `Generator` + | + 8 | from typing import Container + 9 | from typing import Coroutine +10 | from typing import Generator + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ UP035 +11 | from typing import Hashable +12 | from typing import ItemsView + | + = help: Import from `collections.abc` + +ℹ Unsafe fix +7 7 | from typing import Collection +8 8 | from typing import Container +9 9 | from typing import Coroutine +10 |-from typing import Generator + 10 |+from collections.abc import Generator +11 11 | from typing import Hashable +12 12 | from typing import ItemsView +13 13 | from typing import Iterable + +UP035_5.py:11:1: UP035 [*] Import from `collections.abc` instead: `Hashable` + | + 9 | from typing import Coroutine +10 | from typing import Generator +11 | from typing import Hashable + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ UP035 +12 | from typing import ItemsView +13 | from typing import Iterable + | + = help: Import from `collections.abc` + +ℹ Unsafe fix +8 8 | from typing import Container +9 9 | from typing import Coroutine +10 10 | from typing import Generator +11 |-from typing import Hashable + 11 |+from collections.abc import Hashable +12 12 | from typing import ItemsView +13 13 | from typing import Iterable +14 14 | from typing import Iterator + +UP035_5.py:12:1: UP035 [*] Import from `collections.abc` instead: `ItemsView` + | +10 | from typing import Generator +11 | from typing import Hashable +12 | from typing import ItemsView + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ UP035 +13 | from typing import Iterable +14 | from typing import Iterator + | + = help: Import from `collections.abc` + +ℹ Unsafe fix +9 9 | from typing import Coroutine +10 10 | from typing import Generator +11 11 | from typing import Hashable +12 |-from typing import ItemsView + 12 |+from collections.abc import ItemsView +13 13 | from typing import Iterable +14 14 | from typing import Iterator +15 15 | from typing import KeysView + +UP035_5.py:13:1: UP035 [*] Import from `collections.abc` instead: `Iterable` + | +11 | from typing import Hashable +12 | from typing import ItemsView +13 | from typing import Iterable + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ UP035 +14 | from typing import Iterator +15 | from typing import KeysView + | + = help: Import from `collections.abc` + +ℹ Unsafe fix +10 10 | from typing import Generator +11 11 | from typing import Hashable +12 12 | from typing import ItemsView +13 |-from typing import Iterable + 13 |+from collections.abc import Iterable +14 14 | from typing import Iterator +15 15 | from typing import KeysView +16 16 | from typing import Mapping + +UP035_5.py:14:1: UP035 [*] Import from `collections.abc` instead: `Iterator` + | +12 | from typing import ItemsView +13 | from typing import Iterable +14 | from typing import Iterator + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ UP035 +15 | from typing import KeysView +16 | from typing import Mapping + | + = help: Import from `collections.abc` + +ℹ Unsafe fix +11 11 | from typing import Hashable +12 12 | from typing import ItemsView +13 13 | from typing import Iterable +14 |-from typing import Iterator + 14 |+from collections.abc import Iterator +15 15 | from typing import KeysView +16 16 | from typing import Mapping +17 17 | from typing import MappingView + +UP035_5.py:15:1: UP035 [*] Import from `collections.abc` instead: `KeysView` + | +13 | from typing import Iterable +14 | from typing import Iterator +15 | from typing import KeysView + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ UP035 +16 | from typing import Mapping +17 | from typing import MappingView + | + = help: Import from `collections.abc` + +ℹ Unsafe fix +12 12 | from typing import ItemsView +13 13 | from typing import Iterable +14 14 | from typing import Iterator +15 |-from typing import KeysView + 15 |+from collections.abc import KeysView +16 16 | from typing import Mapping +17 17 | from typing import MappingView +18 18 | from typing import MutableMapping + +UP035_5.py:16:1: UP035 [*] Import from `collections.abc` instead: `Mapping` + | +14 | from typing import Iterator +15 | from typing import KeysView +16 | from typing import Mapping + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ UP035 +17 | from typing import MappingView +18 | from typing import MutableMapping + | + = help: Import from `collections.abc` + +ℹ Unsafe fix +13 13 | from typing import Iterable +14 14 | from typing import Iterator +15 15 | from typing import KeysView +16 |-from typing import Mapping + 16 |+from collections.abc import Mapping +17 17 | from typing import MappingView +18 18 | from typing import MutableMapping +19 19 | from typing import MutableSequence + +UP035_5.py:17:1: UP035 [*] Import from `collections.abc` instead: `MappingView` + | +15 | from typing import KeysView +16 | from typing import Mapping +17 | from typing import MappingView + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ UP035 +18 | from typing import MutableMapping +19 | from typing import MutableSequence + | + = help: Import from `collections.abc` + +ℹ Unsafe fix +14 14 | from typing import Iterator +15 15 | from typing import KeysView +16 16 | from typing import Mapping +17 |-from typing import MappingView + 17 |+from collections.abc import MappingView +18 18 | from typing import MutableMapping +19 19 | from typing import MutableSequence +20 20 | from typing import MutableSet + +UP035_5.py:18:1: UP035 [*] Import from `collections.abc` instead: `MutableMapping` + | +16 | from typing import Mapping +17 | from typing import MappingView +18 | from typing import MutableMapping + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ UP035 +19 | from typing import MutableSequence +20 | from typing import MutableSet + | + = help: Import from `collections.abc` + +ℹ Unsafe fix +15 15 | from typing import KeysView +16 16 | from typing import Mapping +17 17 | from typing import MappingView +18 |-from typing import MutableMapping + 18 |+from collections.abc import MutableMapping +19 19 | from typing import MutableSequence +20 20 | from typing import MutableSet +21 21 | from typing import Reversible + +UP035_5.py:19:1: UP035 [*] Import from `collections.abc` instead: `MutableSequence` + | +17 | from typing import MappingView +18 | from typing import MutableMapping +19 | from typing import MutableSequence + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ UP035 +20 | from typing import MutableSet +21 | from typing import Reversible + | + = help: Import from `collections.abc` + +ℹ Unsafe fix +16 16 | from typing import Mapping +17 17 | from typing import MappingView +18 18 | from typing import MutableMapping +19 |-from typing import MutableSequence + 19 |+from collections.abc import MutableSequence +20 20 | from typing import MutableSet +21 21 | from typing import Reversible +22 22 | from typing import Sequence + +UP035_5.py:20:1: UP035 [*] Import from `collections.abc` instead: `MutableSet` + | +18 | from typing import MutableMapping +19 | from typing import MutableSequence +20 | from typing import MutableSet + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ UP035 +21 | from typing import Reversible +22 | from typing import Sequence + | + = help: Import from `collections.abc` + +ℹ Unsafe fix +17 17 | from typing import MappingView +18 18 | from typing import MutableMapping +19 19 | from typing import MutableSequence +20 |-from typing import MutableSet + 20 |+from collections.abc import MutableSet +21 21 | from typing import Reversible +22 22 | from typing import Sequence +23 23 | from typing import Sized + +UP035_5.py:21:1: UP035 [*] Import from `collections.abc` instead: `Reversible` + | +19 | from typing import MutableSequence +20 | from typing import MutableSet +21 | from typing import Reversible + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ UP035 +22 | from typing import Sequence +23 | from typing import Sized + | + = help: Import from `collections.abc` + +ℹ Unsafe fix +18 18 | from typing import MutableMapping +19 19 | from typing import MutableSequence +20 20 | from typing import MutableSet +21 |-from typing import Reversible + 21 |+from collections.abc import Reversible +22 22 | from typing import Sequence +23 23 | from typing import Sized +24 24 | from typing import ValuesView + +UP035_5.py:22:1: UP035 [*] Import from `collections.abc` instead: `Sequence` + | +20 | from typing import MutableSet +21 | from typing import Reversible +22 | from typing import Sequence + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ UP035 +23 | from typing import Sized +24 | from typing import ValuesView + | + = help: Import from `collections.abc` + +ℹ Unsafe fix +19 19 | from typing import MutableSequence +20 20 | from typing import MutableSet +21 21 | from typing import Reversible +22 |-from typing import Sequence + 22 |+from collections.abc import Sequence +23 23 | from typing import Sized +24 24 | from typing import ValuesView +25 25 | + +UP035_5.py:23:1: UP035 [*] Import from `collections.abc` instead: `Sized` + | +21 | from typing import Reversible +22 | from typing import Sequence +23 | from typing import Sized + | ^^^^^^^^^^^^^^^^^^^^^^^^ UP035 +24 | from typing import ValuesView + | + = help: Import from `collections.abc` + +ℹ Unsafe fix +20 20 | from typing import MutableSet +21 21 | from typing import Reversible +22 22 | from typing import Sequence +23 |-from typing import Sized + 23 |+from collections.abc import Sized +24 24 | from typing import ValuesView +25 25 | +26 26 | from typing import Callable + +UP035_5.py:24:1: UP035 [*] Import from `collections.abc` instead: `ValuesView` + | +22 | from typing import Sequence +23 | from typing import Sized +24 | from typing import ValuesView + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ UP035 +25 | +26 | from typing import Callable + | + = help: Import from `collections.abc` + +ℹ Unsafe fix +21 21 | from typing import Reversible +22 22 | from typing import Sequence +23 23 | from typing import Sized +24 |-from typing import ValuesView + 24 |+from collections.abc import ValuesView +25 25 | +26 26 | from typing import Callable + +UP035_5.py:26:1: UP035 [*] Import from `collections.abc` instead: `Callable` + | +24 | from typing import ValuesView +25 | +26 | from typing import Callable + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ UP035 + | + = help: Import from `collections.abc` + +ℹ Unsafe fix +23 23 | from typing import Sized +24 24 | from typing import ValuesView +25 25 | +26 |-from typing import Callable + 26 |+from collections.abc import Callable + + diff --git a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP035_6.py.snap b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP035_6.py.snap new file mode 100644 index 0000000000000..cf3ce31c40879 --- /dev/null +++ b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP035_6.py.snap @@ -0,0 +1,54 @@ +--- +source: crates/ruff_linter/src/rules/pyupgrade/mod.rs +--- +UP035_6.py:2:1: UP035 [*] Import from `collections` instead: `ChainMap` + | +1 | """Members of `typing` that were moved to `collections`.""" +2 | from typing import ChainMap + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ UP035 +3 | from typing import Counter +4 | from typing import OrderedDict + | + = help: Import from `collections` + +ℹ Unsafe fix +1 1 | """Members of `typing` that were moved to `collections`.""" +2 |-from typing import ChainMap + 2 |+from collections import ChainMap +3 3 | from typing import Counter +4 4 | from typing import OrderedDict + +UP035_6.py:3:1: UP035 [*] Import from `collections` instead: `Counter` + | +1 | """Members of `typing` that were moved to `collections`.""" +2 | from typing import ChainMap +3 | from typing import Counter + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ UP035 +4 | from typing import OrderedDict + | + = help: Import from `collections` + +ℹ Unsafe fix +1 1 | """Members of `typing` that were moved to `collections`.""" +2 2 | from typing import ChainMap +3 |-from typing import Counter + 3 |+from collections import Counter +4 4 | from typing import OrderedDict + +UP035_6.py:4:1: UP035 [*] Import from `collections` instead: `OrderedDict` + | +2 | from typing import ChainMap +3 | from typing import Counter +4 | from typing import OrderedDict + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ UP035 + | + = help: Import from `collections` + +ℹ Unsafe fix +1 1 | """Members of `typing` that were moved to `collections`.""" +2 2 | from typing import ChainMap +3 3 | from typing import Counter +4 |-from typing import OrderedDict + 4 |+from collections import OrderedDict + + diff --git a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP035_7.py.snap b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP035_7.py.snap new file mode 100644 index 0000000000000..e623cad07a9aa --- /dev/null +++ b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP035_7.py.snap @@ -0,0 +1,34 @@ +--- +source: crates/ruff_linter/src/rules/pyupgrade/mod.rs +--- +UP035_7.py:2:1: UP035 [*] Import from `re` instead: `Match` + | +1 | """Members of `typing` that were moved to `typing.re`.""" +2 | from typing import Match + | ^^^^^^^^^^^^^^^^^^^^^^^^ UP035 +3 | from typing import Pattern + | + = help: Import from `re` + +ℹ Safe fix +1 1 | """Members of `typing` that were moved to `typing.re`.""" +2 |-from typing import Match + 2 |+from re import Match +3 3 | from typing import Pattern + +UP035_7.py:3:1: UP035 [*] Import from `re` instead: `Pattern` + | +1 | """Members of `typing` that were moved to `typing.re`.""" +2 | from typing import Match +3 | from typing import Pattern + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ UP035 + | + = help: Import from `re` + +ℹ Safe fix +1 1 | """Members of `typing` that were moved to `typing.re`.""" +2 2 | from typing import Match +3 |-from typing import Pattern + 3 |+from re import Pattern + + diff --git a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP035_8.py.snap b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP035_8.py.snap new file mode 100644 index 0000000000000..afecb48f538cc --- /dev/null +++ b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP035_8.py.snap @@ -0,0 +1,34 @@ +--- +source: crates/ruff_linter/src/rules/pyupgrade/mod.rs +--- +UP035_8.py:2:1: UP035 [*] Import from `re` instead: `Match` + | +1 | """Members of `typing.re` that were moved to `re`.""" +2 | from typing.re import Match + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ UP035 +3 | from typing.re import Pattern + | + = help: Import from `re` + +ℹ Unsafe fix +1 1 | """Members of `typing.re` that were moved to `re`.""" +2 |-from typing.re import Match + 2 |+from re import Match +3 3 | from typing.re import Pattern + +UP035_8.py:3:1: UP035 [*] Import from `re` instead: `Pattern` + | +1 | """Members of `typing.re` that were moved to `re`.""" +2 | from typing.re import Match +3 | from typing.re import Pattern + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ UP035 + | + = help: Import from `re` + +ℹ Unsafe fix +1 1 | """Members of `typing.re` that were moved to `re`.""" +2 2 | from typing.re import Match +3 |-from typing.re import Pattern + 3 |+from re import Pattern + + diff --git a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP035_9.py.snap b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP035_9.py.snap new file mode 100644 index 0000000000000..a0833d88c1407 --- /dev/null +++ b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP035_9.py.snap @@ -0,0 +1,17 @@ +--- +source: crates/ruff_linter/src/rules/pyupgrade/mod.rs +--- +UP035_9.py:2:1: UP035 [*] Import from `enum` instead: `StrEnum` + | +1 | """Members of `backports.strenum` that were moved to `enum`.""" +2 | from backports.strenum import StrEnum + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ UP035 + | + = help: Import from `enum` + +ℹ Unsafe fix +1 1 | """Members of `backports.strenum` that were moved to `enum`.""" +2 |-from backports.strenum import StrEnum + 2 |+from enum import StrEnum + +