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

Function is_sys_attr

mypy/reachability.py:323–332  ·  view source on GitHub ↗
(expr: Expression, name: str)

Source from the content-addressed store, hash-verified

321
322
323def is_sys_attr(expr: Expression, name: str) -> bool:
324 # TODO: This currently doesn't work with code like this:
325 # - import sys as _sys
326 # - from sys import version_info
327 if isinstance(expr, MemberExpr) and expr.name == name:
328 if isinstance(expr.expr, NameExpr) and expr.expr.name == "sys":
329 # TODO: Guard against a local named sys, etc.
330 # (Though later passes will still do most checking.)
331 return True
332 return False
333
334
335def mark_block_unreachable(block: Block) -> None:

Callers 2

consider_sys_platformFunction · 0.85

Calls 1

isinstanceFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…