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

Function get_id_from_name

mypyc/common.py:124–134  ·  view source on GitHub ↗

Create a unique id for a function. This creates an id that is unique for any given function definition, so that it can be used as a dictionary key. This is usually the fullname of the function, but this is different in that it handles the case where the function is named '_', in which c

(name: str, fullname: str, line: int)

Source from the content-addressed store, hash-verified

122
123
124def get_id_from_name(name: str, fullname: str, line: int) -> str:
125 """Create a unique id for a function.
126
127 This creates an id that is unique for any given function definition, so that it can be used as
128 a dictionary key. This is usually the fullname of the function, but this is different in that
129 it handles the case where the function is named '_', in which case multiple different functions
130 could have the same name."""
131 if unnamed_function(name):
132 return f"{fullname}.{line}"
133 else:
134 return fullname
135
136
137def short_id_from_name(func_name: str, shortname: str, line: int | None) -> str:

Callers 3

load_type_mapFunction · 0.90
idMethod · 0.90
get_id_from_jsonMethod · 0.90

Calls 1

unnamed_functionFunction · 0.90

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…