---
source: crates/ruff_linter/src/rules/flake8_pyi/mod.rs
---
PYI025_1.pyi:8:33: PYI025 [*] Use `from collections.abc import Set as AbstractSet` to avoid confusion with the `set` builtin
   |
 7 | def f():
 8 |     from collections.abc import Set  # PYI025
   |                                 ^^^ PYI025
 9 | 
10 | def f():
   |
   = help: Alias `Set` to `AbstractSet`

ℹ Safe fix
5 5 |     from collections.abc import Container, Sized, Set as AbstractSet, ValuesView  # Ok
6 6 | 
7 7 | def f():
8   |-    from collections.abc import Set  # PYI025
  8 |+    from collections.abc import Set as AbstractSet  # PYI025
9 9 | 
10 10 | def f():
11 11 |     from collections.abc import Container, Sized, Set, ValuesView  # PYI025

PYI025_1.pyi:11:51: PYI025 [*] Use `from collections.abc import Set as AbstractSet` to avoid confusion with the `set` builtin
   |
10 | def f():
11 |     from collections.abc import Container, Sized, Set, ValuesView  # PYI025
   |                                                   ^^^ PYI025
12 | 
13 | def f():
   |
   = help: Alias `Set` to `AbstractSet`

ℹ Safe fix
8  8  |     from collections.abc import Set  # PYI025
9  9  | 
10 10 | def f():
11    |-    from collections.abc import Container, Sized, Set, ValuesView  # PYI025
   11 |+    from collections.abc import Container, Sized, Set as AbstractSet, ValuesView  # PYI025
12 12 | 
13 13 | def f():
14 14 |     """Test: local symbol renaming."""

PYI025_1.pyi:16:37: PYI025 [*] Use `from collections.abc import Set as AbstractSet` to avoid confusion with the `set` builtin
   |
14 |     """Test: local symbol renaming."""
15 |     if True:
16 |         from collections.abc import Set
   |                                     ^^^ PYI025
17 |     else:
18 |         Set = 1
   |
   = help: Alias `Set` to `AbstractSet`

ℹ Safe fix
13 13 | def f():
14 14 |     """Test: local symbol renaming."""
15 15 |     if True:
16    |-        from collections.abc import Set
   16 |+        from collections.abc import Set as AbstractSet
17 17 |     else:
18    |-        Set = 1
   18 |+        AbstractSet = 1
19 19 | 
20 20 |     x: Set = set()
21 21 | 
22 22 |     x: Set
23 23 | 
24    |-    del Set
   24 |+    del AbstractSet
25 25 | 
26 26 |     def f():
27    |-        print(Set)
   27 |+        print(AbstractSet)
28 28 | 
29 29 |         def Set():
30 30 |             pass

PYI025_1.pyi:33:29: PYI025 [*] Use `from collections.abc import Set as AbstractSet` to avoid confusion with the `set` builtin
   |
31 |         print(Set)
32 | 
33 | from collections.abc import Set
   |                             ^^^ PYI025
34 | 
35 | def f():
   |
   = help: Alias `Set` to `AbstractSet`

ℹ Safe fix
17 17 |     else:
18 18 |         Set = 1
19 19 | 
20    |-    x: Set = set()
   20 |+    x: AbstractSet = set()
21 21 | 
22    |-    x: Set
   22 |+    x: AbstractSet
23 23 | 
24 24 |     del Set
25 25 | 
--------------------------------------------------------------------------------
30 30 |             pass
31 31 |         print(Set)
32 32 | 
33    |-from collections.abc import Set
   33 |+from collections.abc import Set as AbstractSet
34 34 | 
35 35 | def f():
36 36 |     """Test: global symbol renaming."""
37    |-    global Set
   37 |+    global AbstractSet
38 38 | 
39    |-    Set = 1
40    |-    print(Set)
   39 |+    AbstractSet = 1
   40 |+    print(AbstractSet)
41 41 | 
42 42 | def f():
43 43 |     """Test: nonlocal symbol renaming."""

PYI025_1.pyi:44:33: PYI025 [*] Use `from collections.abc import Set as AbstractSet` to avoid confusion with the `set` builtin
   |
42 | def f():
43 |     """Test: nonlocal symbol renaming."""
44 |     from collections.abc import Set
   |                                 ^^^ PYI025
45 | 
46 |     def g():
   |
   = help: Alias `Set` to `AbstractSet`

ℹ Safe fix
41 41 | 
42 42 | def f():
43 43 |     """Test: nonlocal symbol renaming."""
44    |-    from collections.abc import Set
   44 |+    from collections.abc import Set as AbstractSet
45 45 | 
46 46 |     def g():
47    |-        nonlocal Set
   47 |+        nonlocal AbstractSet
48 48 | 
49    |-        Set = 1
50    |-        print(Set)
   49 |+        AbstractSet = 1
   50 |+        print(AbstractSet)
