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

Method add_dependency

mypy/server/deps.py:871–886  ·  view source on GitHub ↗

Add dependency from trigger to a target. If the target is not given explicitly, use the current target.

(self, trigger: str, target: str | None = None)

Source from the content-addressed store, hash-verified

869 self.add_dependency(make_trigger(alias))
870
871 def add_dependency(self, trigger: str, target: str | None = None) -> None:
872 """Add dependency from trigger to a target.
873
874 If the target is not given explicitly, use the current target.
875 """
876 if trigger.startswith(
877 ("<builtins.", "<typing.", "<mypy_extensions.", "<typing_extensions.")
878 ):
879 # Don't track dependencies to certain library modules to keep the size of
880 # the dependencies manageable. These dependencies should only
881 # change on mypy version updates, which will require a full rebuild
882 # anyway.
883 return
884 if target is None:
885 target = self.scope.current_target()
886 self.map.setdefault(trigger, set()).add(target)
887
888 def add_type_dependencies(self, typ: Type, target: str | None = None) -> None:
889 """Add dependencies to all components of a type.

Callers 15

visit_func_defMethod · 0.95
visit_decoratorMethod · 0.95
visit_class_defMethod · 0.95
process_type_infoMethod · 0.95
visit_importMethod · 0.95
visit_import_fromMethod · 0.95
visit_import_allMethod · 0.95
visit_assignment_stmtMethod · 0.95
process_lvalueMethod · 0.95
visit_member_exprMethod · 0.95
visit_super_exprMethod · 0.95

Calls 5

setClass · 0.85
setdefaultMethod · 0.80
startswithMethod · 0.45
current_targetMethod · 0.45
addMethod · 0.45

Tested by

no test coverage detected