Is there a class *directly* enclosing this function?
(self, func: FuncItem | None = None)
| 319 | return None |
| 320 | |
| 321 | def enclosing_class(self, func: FuncItem | None = None) -> TypeInfo | None: |
| 322 | """Is there a class *directly* enclosing this function?""" |
| 323 | func = func or self.current_function() |
| 324 | assert func, "This method must be called from inside a function" |
| 325 | index = self.stack.index(func) |
| 326 | assert index, "CheckerScope stack must always start with a module" |
| 327 | enclosing = self.stack[index - 1] |
| 328 | if isinstance(enclosing, TypeInfo): |
| 329 | return enclosing |
| 330 | return None |
| 331 | |
| 332 | def active_self_type(self) -> Instance | TupleType | None: |
| 333 | """An instance or tuple type representing the current class. |
no test coverage detected