MCPcopy Index your code
hub / github.com/python/mypy / FunctionContext

Class FunctionContext

mypy/stubutil.py:342–371  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

340
341
342class FunctionContext:
343 def __init__(
344 self,
345 module_name: str,
346 name: str,
347 docstring: str | None = None,
348 is_abstract: bool = False,
349 class_info: ClassInfo | None = None,
350 ) -> None:
351 self.module_name = module_name
352 self.name = name
353 self.docstring = docstring
354 self.is_abstract = is_abstract
355 self.class_info = class_info
356 self._fullname: str | None = None
357
358 @property
359 def fullname(self) -> str:
360 if self._fullname is None:
361 if self.class_info:
362 parents = []
363 class_info: ClassInfo | None = self.class_info
364 while class_info is not None:
365 parents.append(class_info.name)
366 class_info = class_info.parent
367 namespace = ".".join(reversed(parents))
368 self._fullname = f"{self.module_name}.{namespace}.{self.name}"
369 else:
370 self._fullname = f"{self.module_name}.{self.name}"
371 return self._fullname
372
373
374def infer_method_ret_type(name: str) -> str | None:

Callers 4

visit_func_defMethod · 0.90

Calls

no outgoing calls

Tested by 1

Used in the wild real call sites across dependent graphs

searching dependent graphs…