---
source: crates/ruff_linter/src/rules/flake8_pyi/mod.rs
---
PYI019 [*] Use `Self` instead of custom TypeVar `_S`
 --> PYI019_0.pyi:7:16
  |
6 | class BadClass:
7 |     def __new__(cls: type[_S], *args: str, **kwargs: int) -> _S: ...  # PYI019
  |                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  |
help: Replace TypeVar `_S` with `Self`
  |
6 | class BadClass:
  -     def __new__(cls: type[_S], *args: str, **kwargs: int) -> _S: ...  # PYI019
7 +     def __new__(cls, *args: str, **kwargs: int) -> Self: ...  # PYI019
8 |
  |

PYI019 [*] Use `Self` instead of custom TypeVar `_S`
  --> PYI019_0.pyi:10:28
   |
10 |     def bad_instance_method(self: _S, arg: bytes) -> _S: ...  # PYI019
   |                            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   |
help: Replace TypeVar `_S` with `Self`
   |
9  |
   -     def bad_instance_method(self: _S, arg: bytes) -> _S: ...  # PYI019
10 +     def bad_instance_method(self, arg: bytes) -> Self: ...  # PYI019
11 |
   |

PYI019 [*] Use `Self` instead of custom TypeVar `_S`
  --> PYI019_0.pyi:14:25
   |
13 |     @classmethod
14 |     def bad_class_method(cls: type[_S], arg: int) -> _S: ...  # PYI019
   |                         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   |
help: Replace TypeVar `_S` with `Self`
   |
13 |     @classmethod
   -     def bad_class_method(cls: type[_S], arg: int) -> _S: ...  # PYI019
14 +     def bad_class_method(cls, arg: int) -> Self: ...  # PYI019
15 |
   |

PYI019 [*] Use `Self` instead of custom TypeVar `_S`
  --> PYI019_0.pyi:18:33
   |
17 |     @classmethod
18 |     def bad_posonly_class_method(cls: type[_S], /) -> _S: ...  # PYI019
   |                                 ^^^^^^^^^^^^^^^^^^^^^^^^
   |
help: Replace TypeVar `_S` with `Self`
   |
17 |     @classmethod
   -     def bad_posonly_class_method(cls: type[_S], /) -> _S: ...  # PYI019
18 +     def bad_posonly_class_method(cls, /) -> Self: ...  # PYI019
19 |
   |

PYI019 [*] Use `Self` instead of custom TypeVar `S`
  --> PYI019_0.pyi:39:14
   |
37 | # Python > 3.12
38 | class PEP695BadDunderNew[T]:
39 |   def __new__[S](cls: type[S], *args: Any, ** kwargs: Any) -> S: ...  # PYI019
   |              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   |
help: Replace TypeVar `S` with `Self`
   |
38 | class PEP695BadDunderNew[T]:
   -   def __new__[S](cls: type[S], *args: Any, ** kwargs: Any) -> S: ...  # PYI019
39 +   def __new__(cls, *args: Any, ** kwargs: Any) -> Self: ...  # PYI019
40 |
   |

PYI019 [*] Use `Self` instead of custom TypeVar `S`
  --> PYI019_0.pyi:42:30
   |
42 |   def generic_instance_method[S](self: S) -> S: ...  # PYI019
   |                              ^^^^^^^^^^^^^^^^^
   |
help: Replace TypeVar `S` with `Self`
   |
41 |
   -   def generic_instance_method[S](self: S) -> S: ...  # PYI019
42 +   def generic_instance_method(self) -> Self: ...  # PYI019
43 |
   |

PYI019 [*] Use `Self` instead of custom TypeVar `S`
  --> PYI019_0.pyi:54:11
   |
52 |    # in the settings for this test:
53 |    @foo_classmethod
54 |    def foo[S](cls: type[S]) -> S: ...  # PYI019
   |           ^^^^^^^^^^^^^^^^^^^^^^
   |
help: Replace TypeVar `S` with `Self`
   |
53 |    @foo_classmethod
   -    def foo[S](cls: type[S]) -> S: ...  # PYI019
54 +    def foo(cls) -> Self: ...  # PYI019
55 |
   |

PYI019 [*] Use `Self` instead of custom TypeVar `S`
  --> PYI019_0.pyi:61:16
   |
60 | class PEP695Fix:
61 |     def __new__[S: PEP695Fix](cls: type[S]) -> S: ...
   |                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
62 |
63 |     def __init_subclass__[S](cls: type[S]) -> S: ...
   |
help: Replace TypeVar `S` with `Self`
   |
60 | class PEP695Fix:
   -     def __new__[S: PEP695Fix](cls: type[S]) -> S: ...
61 +     def __new__(cls) -> Self: ...
62 |
   |

PYI019 [*] Use `Self` instead of custom TypeVar `S`
  --> PYI019_0.pyi:63:26
   |
61 |     def __new__[S: PEP695Fix](cls: type[S]) -> S: ...
62 |
63 |     def __init_subclass__[S](cls: type[S]) -> S: ...
   |                          ^^^^^^^^^^^^^^^^^^^^^^
64 |
65 |     def __neg__[S: PEP695Fix](self: S) -> S: ...
   |
help: Replace TypeVar `S` with `Self`
   |
62 |
   -     def __init_subclass__[S](cls: type[S]) -> S: ...
63 +     def __init_subclass__(cls) -> Self: ...
64 |
   |

PYI019 [*] Use `Self` instead of custom TypeVar `S`
  --> PYI019_0.pyi:65:16
   |
63 |     def __init_subclass__[S](cls: type[S]) -> S: ...
64 |
65 |     def __neg__[S: PEP695Fix](self: S) -> S: ...
   |                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
66 |
67 |     def __pos__[S](self: S) -> S: ...
   |
help: Replace TypeVar `S` with `Self`
   |
64 |
   -     def __neg__[S: PEP695Fix](self: S) -> S: ...
65 +     def __neg__(self) -> Self: ...
66 |
   |

PYI019 [*] Use `Self` instead of custom TypeVar `S`
  --> PYI019_0.pyi:67:16
   |
65 |     def __neg__[S: PEP695Fix](self: S) -> S: ...
66 |
67 |     def __pos__[S](self: S) -> S: ...
   |                ^^^^^^^^^^^^^^^^^
68 |
69 |     def __add__[S: PEP695Fix](self: S, other: S) -> S: ...
   |
help: Replace TypeVar `S` with `Self`
   |
66 |
   -     def __pos__[S](self: S) -> S: ...
67 +     def __pos__(self) -> Self: ...
68 |
   |

PYI019 [*] Use `Self` instead of custom TypeVar `S`
  --> PYI019_0.pyi:69:16
   |
67 |     def __pos__[S](self: S) -> S: ...
68 |
69 |     def __add__[S: PEP695Fix](self: S, other: S) -> S: ...
   |                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
70 |
71 |     def __sub__[S](self: S, other: S) -> S: ...
   |
help: Replace TypeVar `S` with `Self`
   |
68 |
   -     def __add__[S: PEP695Fix](self: S, other: S) -> S: ...
69 +     def __add__(self, other: Self) -> Self: ...
70 |
   |

PYI019 [*] Use `Self` instead of custom TypeVar `S`
  --> PYI019_0.pyi:71:16
   |
69 |     def __add__[S: PEP695Fix](self: S, other: S) -> S: ...
70 |
71 |     def __sub__[S](self: S, other: S) -> S: ...
   |                ^^^^^^^^^^^^^^^^^^^^^^^^^^^
72 |
73 |     @classmethod
   |
help: Replace TypeVar `S` with `Self`
   |
70 |
   -     def __sub__[S](self: S, other: S) -> S: ...
71 +     def __sub__(self, other: Self) -> Self: ...
72 |
   |

PYI019 [*] Use `Self` instead of custom TypeVar `S`
  --> PYI019_0.pyi:74:27
   |
73 |     @classmethod
74 |     def class_method_bound[S: PEP695Fix](cls: type[S]) -> S: ...
   |                           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
75 |
76 |     @classmethod
   |
help: Replace TypeVar `S` with `Self`
   |
73 |     @classmethod
   -     def class_method_bound[S: PEP695Fix](cls: type[S]) -> S: ...
74 +     def class_method_bound(cls) -> Self: ...
75 |
   |

PYI019 [*] Use `Self` instead of custom TypeVar `S`
  --> PYI019_0.pyi:77:29
   |
76 |     @classmethod
77 |     def class_method_unbound[S](cls: type[S]) -> S: ...
   |                             ^^^^^^^^^^^^^^^^^^^^^^
78 |
79 |     def instance_method_bound[S: PEP695Fix](self: S) -> S: ...
   |
help: Replace TypeVar `S` with `Self`
   |
76 |     @classmethod
   -     def class_method_unbound[S](cls: type[S]) -> S: ...
77 +     def class_method_unbound(cls) -> Self: ...
78 |
   |

PYI019 [*] Use `Self` instead of custom TypeVar `S`
  --> PYI019_0.pyi:79:30
   |
77 |     def class_method_unbound[S](cls: type[S]) -> S: ...
78 |
79 |     def instance_method_bound[S: PEP695Fix](self: S) -> S: ...
   |                              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
80 |
81 |     def instance_method_unbound[S](self: S) -> S: ...
   |
help: Replace TypeVar `S` with `Self`
   |
78 |
   -     def instance_method_bound[S: PEP695Fix](self: S) -> S: ...
79 +     def instance_method_bound(self) -> Self: ...
80 |
   |

PYI019 [*] Use `Self` instead of custom TypeVar `S`
  --> PYI019_0.pyi:81:32
   |
79 |     def instance_method_bound[S: PEP695Fix](self: S) -> S: ...
80 |
81 |     def instance_method_unbound[S](self: S) -> S: ...
   |                                ^^^^^^^^^^^^^^^^^
82 |
83 |     def instance_method_bound_with_another_parameter[S: PEP695Fix](self: S, other: S) -> S: ...
   |
help: Replace TypeVar `S` with `Self`
   |
80 |
   -     def instance_method_unbound[S](self: S) -> S: ...
81 +     def instance_method_unbound(self) -> Self: ...
82 |
   |

PYI019 [*] Use `Self` instead of custom TypeVar `S`
  --> PYI019_0.pyi:83:53
   |
81 |     def instance_method_unbound[S](self: S) -> S: ...
82 |
83 |     def instance_method_bound_with_another_parameter[S: PEP695Fix](self: S, other: S) -> S: ...
   |                                                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
84 |
85 |     def instance_method_unbound_with_another_parameter[S](self: S, other: S) -> S: ...
   |
help: Replace TypeVar `S` with `Self`
   |
82 |
   -     def instance_method_bound_with_another_parameter[S: PEP695Fix](self: S, other: S) -> S: ...
83 +     def instance_method_bound_with_another_parameter(self, other: Self) -> Self: ...
84 |
   |

PYI019 [*] Use `Self` instead of custom TypeVar `S`
  --> PYI019_0.pyi:85:55
   |
83 |     def instance_method_bound_with_another_parameter[S: PEP695Fix](self: S, other: S) -> S: ...
84 |
85 |     def instance_method_unbound_with_another_parameter[S](self: S, other: S) -> S: ...
   |                                                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^
86 |
87 |     def multiple_type_vars[S, *Ts, T](self: S, other: S, /, *args: *Ts, a: T, b: list[T]) -> S: ...
   |
help: Replace TypeVar `S` with `Self`
   |
84 |
   -     def instance_method_unbound_with_another_parameter[S](self: S, other: S) -> S: ...
85 +     def instance_method_unbound_with_another_parameter(self, other: Self) -> Self: ...
86 |
   |

PYI019 [*] Use `Self` instead of custom TypeVar `S`
  --> PYI019_0.pyi:87:27
   |
85 |     def instance_method_unbound_with_another_parameter[S](self: S, other: S) -> S: ...
86 |
87 |     def multiple_type_vars[S, *Ts, T](self: S, other: S, /, *args: *Ts, a: T, b: list[T]) -> S: ...
   |                           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
88 |
89 |     def mixing_old_and_new_style_type_vars[T](self: _S695, a: T, b: T) -> _S695: ...
   |
help: Replace TypeVar `S` with `Self`
   |
86 |
   -     def multiple_type_vars[S, *Ts, T](self: S, other: S, /, *args: *Ts, a: T, b: list[T]) -> S: ...
87 +     def multiple_type_vars[*Ts, T](self, other: Self, /, *args: *Ts, a: T, b: list[T]) -> Self: ...
88 |
   |

PYI019 [*] Use `Self` instead of custom TypeVar `_S695`
  --> PYI019_0.pyi:89:43
   |
87 |     def multiple_type_vars[S, *Ts, T](self: S, other: S, /, *args: *Ts, a: T, b: list[T]) -> S: ...
88 |
89 |     def mixing_old_and_new_style_type_vars[T](self: _S695, a: T, b: T) -> _S695: ...
   |                                           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   |
help: Replace TypeVar `_S695` with `Self`
   |
88 |
   -     def mixing_old_and_new_style_type_vars[T](self: _S695, a: T, b: T) -> _S695: ...
89 +     def mixing_old_and_new_style_type_vars[T](self, a: T, b: T) -> Self: ...
90 |
   |

PYI019 [*] Use `Self` instead of custom TypeVar `S`
  --> PYI019_0.pyi:94:10
   |
92 | class InvalidButWeDoNotPanic:
93 |     @classmethod
94 |     def m[S](cls: type[S], /) -> S[int]: ...
   |          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
95 |     def n(self: S) -> S[int]: ...
   |
help: Replace TypeVar `S` with `Self`
   |
93 |     @classmethod
   -     def m[S](cls: type[S], /) -> S[int]: ...
94 +     def m(cls, /) -> Self[int]: ...
95 |     def n(self: S) -> S[int]: ...
   |

PYI019 [*] Use `Self` instead of custom TypeVar `S`
   --> PYI019_0.pyi:114:10
    |
112 | class SubscriptReturnType:
113 |     @classmethod
114 |     def m[S](cls: type[S]) -> type[S]: ...  # PYI019
    |          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    |
help: Replace TypeVar `S` with `Self`
    |
113 |     @classmethod
    -     def m[S](cls: type[S]) -> type[S]: ...  # PYI019
114 +     def m(cls) -> type[Self]: ...  # PYI019
115 |
    |

PYI019 [*] Use `Self` instead of custom TypeVar `S`
   --> PYI019_0.pyi:118:10
    |
117 | class PEP695TypeParameterAtTheVeryEndOfTheList:
118 |     def f[T, S](self: S) -> S: ...
    |          ^^^^^^^^^^^^^^^^^^^^
    |
help: Replace TypeVar `S` with `Self`
    |
117 | class PEP695TypeParameterAtTheVeryEndOfTheList:
    -     def f[T, S](self: S) -> S: ...
118 +     def f[T](self) -> Self: ...
119 |
    |

PYI019 [*] Use `Self` instead of custom TypeVar `_S695`
   --> PYI019_0.pyi:122:26
    |
121 | class PEP695Again:
122 |     def mixing_and_nested[T](self: _S695, a: list[_S695], b: dict[_S695, str | T | set[_S695]]) -> _S695: ...
    |                          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
123 |     def also_uses_s695_but_should_not_be_edited(self, v: set[tuple[_S695]]) -> _S695: ...
    |
help: Replace TypeVar `_S695` with `Self`
    |
121 | class PEP695Again:
    -     def mixing_and_nested[T](self: _S695, a: list[_S695], b: dict[_S695, str | T | set[_S695]]) -> _S695: ...
122 +     def mixing_and_nested[T](self, a: list[Self], b: dict[Self, str | T | set[Self]]) -> Self: ...
123 |     def also_uses_s695_but_should_not_be_edited(self, v: set[tuple[_S695]]) -> _S695: ...
    |

PYI019 [*] Use `Self` instead of custom TypeVar `S`
   --> PYI019_0.pyi:126:29
    |
125 |       @classmethod
126 |       def comment_in_fix_range[T, S](
    |  _____________________________^
127 | |         cls: type[  # Lorem ipsum
128 | |             S
129 | |         ],
130 | |         a: T,
131 | |         b: tuple[S, T]
132 | |     ) -> S: ...
    | |__________^
133 |
134 |       def comment_outside_fix_range[T, S](
    |
help: Replace TypeVar `S` with `Self`
    |
125 |     @classmethod
    -     def comment_in_fix_range[T, S](
    -         cls: type[  # Lorem ipsum
    -             S
    -         ],
126 +     def comment_in_fix_range[T](
127 +         cls,
128 |         a: T,
    -         b: tuple[S, T]
    -     ) -> S: ...
129 +         b: tuple[Self, T]
130 +     ) -> Self: ...
131 |
    |
note: This is an unsafe fix and may change runtime behavior

PYI019 [*] Use `Self` instead of custom TypeVar `S`
   --> PYI019_0.pyi:134:34
    |
132 |       ) -> S: ...
133 |
134 |       def comment_outside_fix_range[T, S](
    |  __________________________________^
135 | |         self: S,
136 | |         a: T,
137 | |         b: tuple[
138 | |             # Lorem ipsum
139 | |             S, T
140 | |         ]
141 | |     ) -> S: ...
    | |__________^
    |
help: Replace TypeVar `S` with `Self`
    |
133 |
    -     def comment_outside_fix_range[T, S](
    -         self: S,
134 +     def comment_outside_fix_range[T](
135 +         self,
136 |         a: T,
137 |         b: tuple[
138 |             # Lorem ipsum
    -             S, T
139 +             Self, T
140 |         ]
    -     ) -> S: ...
141 +     ) -> Self: ...
142 |
    |

PYI019 [*] Use `Self` instead of custom TypeVar `S`
   --> PYI019_0.pyi:145:10
    |
144 | class SelfNotUsedInReturnAnnotation:
145 |     def m[S](self: S, other: S) -> int: ...
    |          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
146 |     @classmethod
147 |     def n[S](cls: type[S], other: S) -> int: ...
    |
help: Replace TypeVar `S` with `Self`
    |
144 | class SelfNotUsedInReturnAnnotation:
    -     def m[S](self: S, other: S) -> int: ...
145 +     def m(self, other: Self) -> int: ...
146 |     @classmethod
    |

PYI019 [*] Use `Self` instead of custom TypeVar `S`
   --> PYI019_0.pyi:147:10
    |
145 |     def m[S](self: S, other: S) -> int: ...
146 |     @classmethod
147 |     def n[S](cls: type[S], other: S) -> int: ...
    |          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    |
help: Replace TypeVar `S` with `Self`
    |
146 |     @classmethod
    -     def n[S](cls: type[S], other: S) -> int: ...
147 +     def n(cls, other: Self) -> int: ...
148 |
    |

PYI019 [*] Use `Self` instead of custom TypeVar `S`
   --> PYI019_0.pyi:161:10
    |
160 | class NoReturnAnnotations:
161 |     def m[S](self: S, other: S): ...
    |          ^^^^^^^^^^^^^^^^^^^^^^
162 |     @classmethod
163 |     def n[S](cls: type[S], other: S): ...
    |
help: Replace TypeVar `S` with `Self`
    |
160 | class NoReturnAnnotations:
    -     def m[S](self: S, other: S): ...
161 +     def m(self, other: Self): ...
162 |     @classmethod
    |

PYI019 [*] Use `Self` instead of custom TypeVar `S`
   --> PYI019_0.pyi:163:10
    |
161 |     def m[S](self: S, other: S): ...
162 |     @classmethod
163 |     def n[S](cls: type[S], other: S): ...
    |          ^^^^^^^^^^^^^^^^^^^^^^^^^^^
164 |
165 | class MultipleBoundParameters:
    |
help: Replace TypeVar `S` with `Self`
    |
162 |     @classmethod
    -     def n[S](cls: type[S], other: S): ...
163 +     def n(cls, other: Self): ...
164 |
    |

PYI019 [*] Use `Self` instead of custom TypeVar `S`
   --> PYI019_0.pyi:166:10
    |
165 | class MultipleBoundParameters:
166 |     def m[S: int, T: int](self: S, other: T) -> S: ...
    |          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
167 |     def n[T: (int, str), S: (int, str)](self: S, other: T) -> S: ...
    |
help: Replace TypeVar `S` with `Self`
    |
165 | class MultipleBoundParameters:
    -     def m[S: int, T: int](self: S, other: T) -> S: ...
166 +     def m[T: int](self, other: T) -> Self: ...
167 |     def n[T: (int, str), S: (int, str)](self: S, other: T) -> S: ...
    |

PYI019 [*] Use `Self` instead of custom TypeVar `S`
   --> PYI019_0.pyi:167:10
    |
165 | class MultipleBoundParameters:
166 |     def m[S: int, T: int](self: S, other: T) -> S: ...
167 |     def n[T: (int, str), S: (int, str)](self: S, other: T) -> S: ...
    |          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    |
help: Replace TypeVar `S` with `Self`
    |
166 |     def m[S: int, T: int](self: S, other: T) -> S: ...
    -     def n[T: (int, str), S: (int, str)](self: S, other: T) -> S: ...
167 +     def n[T: (int, str)](self, other: T) -> Self: ...
168 |
    |

PYI019 [*] Use `Self` instead of custom TypeVar `_S`
   --> PYI019_0.pyi:181:52
    |
180 | class BadClassWithStringTypeHints:
181 |     def bad_instance_method_with_string_annotations(self: "_S", arg: str) -> "_S": ... # PYI019
    |                                                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
182 |
183 |     @classmethod
    |
help: Replace TypeVar `_S` with `Self`
    |
180 | class BadClassWithStringTypeHints:
    -     def bad_instance_method_with_string_annotations(self: "_S", arg: str) -> "_S": ... # PYI019
181 +     def bad_instance_method_with_string_annotations(self, arg: str) -> "Self": ... # PYI019
182 |
    |

PYI019 [*] Use `Self` instead of custom TypeVar `_S`
   --> PYI019_0.pyi:184:49
    |
183 |     @classmethod
184 |     def bad_class_method_with_string_annotations(cls: "type[_S]") -> "_S": ... # PYI019
    |                                                 ^^^^^^^^^^^^^^^^^^^^^^^^^
    |
help: Replace TypeVar `_S` with `Self`
    |
183 |     @classmethod
    -     def bad_class_method_with_string_annotations(cls: "type[_S]") -> "_S": ... # PYI019
184 +     def bad_class_method_with_string_annotations(cls) -> "Self": ... # PYI019
185 |
    |

PYI019 [*] Use `Self` instead of custom TypeVar `_S`
   --> PYI019_0.pyi:188:50
    |
187 |     @classmethod
188 |     def bad_class_method_with_mixed_annotations_1(cls: "type[_S]") -> _S: ... # PYI019
    |                                                  ^^^^^^^^^^^^^^^^^^^^^^^
    |
help: Replace TypeVar `_S` with `Self`
    |
187 |     @classmethod
    -     def bad_class_method_with_mixed_annotations_1(cls: "type[_S]") -> _S: ... # PYI019
188 +     def bad_class_method_with_mixed_annotations_1(cls) -> Self: ... # PYI019
189 |
    |

PYI019 [*] Use `Self` instead of custom TypeVar `_S`
   --> PYI019_0.pyi:192:50
    |
191 |     @classmethod
192 |     def bad_class_method_with_mixed_annotations_1(cls: type[_S]) -> "_S": ... # PYI019
    |                                                  ^^^^^^^^^^^^^^^^^^^^^^^
    |
help: Replace TypeVar `_S` with `Self`
    |
191 |     @classmethod
    -     def bad_class_method_with_mixed_annotations_1(cls: type[_S]) -> "_S": ... # PYI019
192 +     def bad_class_method_with_mixed_annotations_1(cls) -> "Self": ... # PYI019
193 |
    |

PYI019 [*] Use `Self` instead of custom TypeVar `S`
   --> PYI019_0.pyi:197:10
    |
195 | class BadSubscriptReturnTypeWithStringTypeHints:
196 |     @classmethod
197 |     def m[S](cls: "type[S]") -> "type[S]": ...  # PYI019
    |          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    |
help: Replace TypeVar `S` with `Self`
    |
196 |     @classmethod
    -     def m[S](cls: "type[S]") -> "type[S]": ...  # PYI019
197 +     def m(cls) -> "type[Self]": ...  # PYI019
198 |
    |
