MCPcopy Index your code
hub / github.com/ipython/ipython / format_code_name

Method format_code_name

IPython/core/compilerop.py:119–132  ·  view source on GitHub ↗

Return a user-friendly label and name for a code block. Parameters ---------- name : str The name for the code block returned from get_code_name Returns ------- A (label, name) pair that can be used in tracebacks, or None if the default f

(self, name)

Source from the content-addressed store, hash-verified

117 return code_name(transformed_code, number)
118
119 def format_code_name(self, name) -> str:
120 """Return a user-friendly label and name for a code block.
121
122 Parameters
123 ----------
124 name : str
125 The name for the code block returned from get_code_name
126
127 Returns
128 -------
129 A (label, name) pair that can be used in tracebacks, or None if the default formatting should be used.
130 """
131 if name in self._filename_map:
132 return "Cell", "In[%s]" % self._filename_map[name]
133
134 def cache(self, transformed_code, number=0, raw_code=None):
135 """Make a name for a block of code, and cache the code.

Callers 1

_tokens_filenameFunction · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected