MCPcopy Create free account
hub / github.com/getsentry/sentry / _name_of

Function _name_of

tools/flake8_plugin.py:398–406  ·  view source on GitHub ↗

Render `Foo`, `mod.Foo`, `Foo[T]` as a stable string for equality.

(node: ast.expr)

Source from the content-addressed store, hash-verified

396
397
398def _name_of(node: ast.expr) -> str:
399 """Render `Foo`, `mod.Foo`, `Foo[T]` as a stable string for equality."""
400 if isinstance(node, ast.Name):
401 return node.id
402 if isinstance(node, ast.Attribute):
403 return f"{_name_of(node.value)}.{node.attr}"
404 if isinstance(node, ast.Subscript):
405 return f"{_name_of(node.value)}[{_name_of(node.slice)}]"
406 return ast.unparse(node)
407
408
409def _is_response_subscript(node: ast.expr) -> ast.expr | None:

Callers 5

_looks_like_a_classFunction · 0.85
_declared_namesFunction · 0.85
_check_S021Method · 0.85
_record_input_callMethod · 0.85
_record_validatorMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected