---
source: crates/ruff_linter/src/rules/flake8_pyi/mod.rs
---
PYI019 [*] Use `Self` instead of custom TypeVar `_S`
 --> PYI019_0.py: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.py: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.py: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.py: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.py: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.py: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.py: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.py: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.py: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.py: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.py: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.py: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.py: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.py: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.py: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.py: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.py: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.py: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.py: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.py: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.py: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.py: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.py: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.py:118:10
    |
117 | class SelfNotUsedInReturnAnnotation:
118 |     def m[S](self: S, other: S) -> int: ...
    |          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
119 |     @classmethod
120 |     def n[S](cls: type[S], other: S) -> int: ...
    |
help: Replace TypeVar `S` with `Self`
    |
117 | class SelfNotUsedInReturnAnnotation:
    -     def m[S](self: S, other: S) -> int: ...
118 +     def m(self, other: Self) -> int: ...
119 |     @classmethod
    |

PYI019 [*] Use `Self` instead of custom TypeVar `S`
   --> PYI019_0.py:120:10
    |
118 |     def m[S](self: S, other: S) -> int: ...
119 |     @classmethod
120 |     def n[S](cls: type[S], other: S) -> int: ...
    |          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    |
help: Replace TypeVar `S` with `Self`
    |
119 |     @classmethod
    -     def n[S](cls: type[S], other: S) -> int: ...
120 +     def n(cls, other: Self) -> int: ...
121 |
    |

PYI019 [*] Use `Self` instead of custom TypeVar `S`
   --> PYI019_0.py:135:10
    |
134 | class NoReturnAnnotations:
135 |     def m[S](self: S, other: S): ...
    |          ^^^^^^^^^^^^^^^^^^^^^^
136 |     @classmethod
137 |     def n[S](cls: type[S], other: S): ...
    |
help: Replace TypeVar `S` with `Self`
    |
134 | class NoReturnAnnotations:
    -     def m[S](self: S, other: S): ...
135 +     def m(self, other: Self): ...
136 |     @classmethod
    |

PYI019 [*] Use `Self` instead of custom TypeVar `S`
   --> PYI019_0.py:137:10
    |
135 |     def m[S](self: S, other: S): ...
136 |     @classmethod
137 |     def n[S](cls: type[S], other: S): ...
    |          ^^^^^^^^^^^^^^^^^^^^^^^^^^^
138 |
139 | class MultipleBoundParameters:
    |
help: Replace TypeVar `S` with `Self`
    |
136 |     @classmethod
    -     def n[S](cls: type[S], other: S): ...
137 +     def n(cls, other: Self): ...
138 |
    |

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

PYI019 [*] Use `Self` instead of custom TypeVar `S`
   --> PYI019_0.py:141:10
    |
139 | class MultipleBoundParameters:
140 |     def m[S: int, T: int](self: S, other: T) -> S: ...
141 |     def n[T: (int, str), S: (int, str)](self: S, other: T) -> S: ...
    |          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
142 |
143 | class MethodsWithBody:
    |
help: Replace TypeVar `S` with `Self`
    |
140 |     def m[S: int, T: int](self: S, other: T) -> S: ...
    -     def n[T: (int, str), S: (int, str)](self: S, other: T) -> S: ...
141 +     def n[T: (int, str)](self, other: T) -> Self: ...
142 |
    |

PYI019 [*] Use `Self` instead of custom TypeVar `S`
   --> PYI019_0.py:144:10
    |
143 | class MethodsWithBody:
144 |     def m[S](self: S, other: S) -> S:
    |          ^^^^^^^^^^^^^^^^^^^^^^^^^^^
145 |         x: S = other
146 |         return x
    |
help: Replace TypeVar `S` with `Self`
    |
143 | class MethodsWithBody:
    -     def m[S](self: S, other: S) -> S:
    -         x: S = other
144 +     def m(self, other: Self) -> Self:
145 +         x: Self = other
146 |         return x
    |

PYI019 [*] Use `Self` instead of custom TypeVar `S`
   --> PYI019_0.py:149:10
    |
148 |     @classmethod
149 |     def n[S](cls: type[S], other: S) -> S:
    |          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
150 |         x: type[S] = type(other)
151 |         return x()
    |
help: Replace TypeVar `S` with `Self`
    |
148 |     @classmethod
    -     def n[S](cls: type[S], other: S) -> S:
    -         x: type[S] = type(other)
149 +     def n(cls, other: Self) -> Self:
150 +         x: type[Self] = type(other)
151 |         return x()
    |

PYI019 [*] Use `Self` instead of custom TypeVar `S`
   --> PYI019_0.py:154:10
    |
153 | class StringizedReferencesCanBeFixed:
154 |     def m[S](self: S) -> S:
    |          ^^^^^^^^^^^^^^^^^
155 |         x = cast("list[tuple[S, S]]", self)
156 |         return x
    |
help: Replace TypeVar `S` with `Self`
    |
153 | class StringizedReferencesCanBeFixed:
    -     def m[S](self: S) -> S:
    -         x = cast("list[tuple[S, S]]", self)
154 +     def m(self) -> Self:
155 +         x = cast("list[tuple[Self, Self]]", self)
156 |         return x
    |

PYI019 Use `Self` instead of custom TypeVar `_T`
   --> PYI019_0.py:159:10
    |
158 | class ButStrangeStringizedReferencesCannotBeFixed:
159 |     def m[_T](self: _T) -> _T:
    |          ^^^^^^^^^^^^^^^^^^^^
160 |         x = cast('list[_\x54]', self)
161 |         return x
    |
help: Replace TypeVar `_T` with `Self`

PYI019 [*] Use `Self` instead of custom TypeVar `S`
   --> PYI019_0.py:164:10
    |
163 | class DeletionsAreNotTouched:
164 |     def m[S](self: S) -> S:
    |          ^^^^^^^^^^^^^^^^^
165 |         # `S` is not a local variable here, and `del` can only be used with local variables,
166 |         # so `del S` here is not actually a reference to the type variable `S`.
    |
help: Replace TypeVar `S` with `Self`
    |
163 | class DeletionsAreNotTouched:
    -     def m[S](self: S) -> S:
164 +     def m(self) -> Self:
165 |         # `S` is not a local variable here, and `del` can only be used with local variables,
    |

PYI019 [*] Use `Self` instead of custom TypeVar `S`
   --> PYI019_0.py:173:10
    |
172 | class NamesShadowingTypeVarAreNotTouched:
173 |     def m[S](self: S) -> S:
    |          ^^^^^^^^^^^^^^^^^
174 |         type S = int
175 |         print(S)  # not a reference to the type variable, so not touched by the autofix
    |
help: Replace TypeVar `S` with `Self`
    |
172 | class NamesShadowingTypeVarAreNotTouched:
    -     def m[S](self: S) -> S:
173 +     def m(self) -> Self:
174 |         type S = int
    |

PYI019 [*] Use `Self` instead of custom TypeVar `_S`
   --> PYI019_0.py:189:52
    |
188 | class BadClassWithStringTypeHints:
189 |     def bad_instance_method_with_string_annotations(self: "_S", arg: str) -> "_S": ... # PYI019
    |                                                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
190 |
191 |     @classmethod
    |
help: Replace TypeVar `_S` with `Self`
    |
188 | class BadClassWithStringTypeHints:
    -     def bad_instance_method_with_string_annotations(self: "_S", arg: str) -> "_S": ... # PYI019
189 +     def bad_instance_method_with_string_annotations(self, arg: str) -> "Self": ... # PYI019
190 |
    |

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

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

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

PYI019 [*] Use `Self` instead of custom TypeVar `S`
   --> PYI019_0.py:205:10
    |
203 | class BadSubscriptReturnTypeWithStringTypeHints:
204 |     @classmethod
205 |     def m[S](cls: "type[S]") -> "type[S]": ...  # PYI019
    |          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    |
help: Replace TypeVar `S` with `Self`
    |
204 |     @classmethod
    -     def m[S](cls: "type[S]") -> "type[S]": ...  # PYI019
205 +     def m(cls) -> "type[Self]": ...  # PYI019
206 |
    |
