MCPcopy
hub / github.com/python/mypy / verify_decorator

Function verify_decorator

mypy/stubtest.py:1655–1683  ·  view source on GitHub ↗
(
    stub: nodes.Decorator, runtime: MaybeMissing[Any], object_path: list[str]
)

Source from the content-addressed store, hash-verified

1653
1654@verify.register(nodes.Decorator)
1655def verify_decorator(
1656 stub: nodes.Decorator, runtime: MaybeMissing[Any], object_path: list[str]
1657) -> Iterator[Error]:
1658 if stub.func.is_type_check_only:
1659 # This function only exists in stubs, we only check that the runtime part
1660 # is missing. Other checks are not required.
1661 if not isinstance(runtime, Missing):
1662 yield Error(
1663 object_path,
1664 'is marked as "@type_check_only", but also exists at runtime',
1665 stub,
1666 runtime,
1667 stub_desc=repr(stub),
1668 )
1669 return
1670
1671 if isinstance(runtime, Missing):
1672 yield Error(object_path, "is not present at runtime", stub, runtime)
1673 return
1674 if stub.func.is_property:
1675 for message in _verify_readonly_property(stub, runtime):
1676 yield Error(object_path, message, stub, runtime)
1677 for message in _verify_abstract_status(stub.func, runtime):
1678 yield Error(object_path, message, stub, runtime)
1679 return
1680
1681 func = _resolve_funcitem_from_decorator(stub)
1682 if func is not None:
1683 yield from verify(func, runtime, object_path)
1684
1685
1686@verify.register(nodes.TypeAlias)

Callers

nothing calls this directly

Calls 7

isinstanceFunction · 0.85
ErrorClass · 0.85
reprFunction · 0.85
_verify_abstract_statusFunction · 0.85
verifyFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…