Adds a new method to a class. Deprecated, use add_method_to_class() instead.
(
ctx: ClassDefContext,
name: str,
args: list[Argument],
return_type: Type,
self_type: Type | None = None,
tvar_def: TypeVarType | None = None,
is_classmethod: bool = False,
is_staticmethod: bool = False,
)
| 187 | |
| 188 | |
| 189 | def add_method( |
| 190 | ctx: ClassDefContext, |
| 191 | name: str, |
| 192 | args: list[Argument], |
| 193 | return_type: Type, |
| 194 | self_type: Type | None = None, |
| 195 | tvar_def: TypeVarType | None = None, |
| 196 | is_classmethod: bool = False, |
| 197 | is_staticmethod: bool = False, |
| 198 | ) -> None: |
| 199 | """ |
| 200 | Adds a new method to a class. |
| 201 | Deprecated, use add_method_to_class() instead. |
| 202 | """ |
| 203 | add_method_to_class( |
| 204 | ctx.api, |
| 205 | ctx.cls, |
| 206 | name=name, |
| 207 | args=args, |
| 208 | return_type=return_type, |
| 209 | self_type=self_type, |
| 210 | tvar_def=tvar_def, |
| 211 | is_classmethod=is_classmethod, |
| 212 | is_staticmethod=is_staticmethod, |
| 213 | ) |
| 214 | |
| 215 | |
| 216 | class MethodSpec(NamedTuple): |
no test coverage detected
searching dependent graphs…