MCPcopy Index your code
hub / github.com/FSoft-AI4Code/HyperAgent / add_num_line

Function add_num_line

src/hyperagent/utils.py:203–221  ·  view source on GitHub ↗

Add line numbers to each line of the source code. Args: source (str): The source code as a string. start_line (int): The starting line number. Returns: str: The source code with line numbers added.

(source: str, start_line: int)

Source from the content-addressed store, hash-verified

201 return None
202
203def add_num_line(source: str, start_line: int):
204 """
205 Add line numbers to each line of the source code.
206
207 Args:
208 source (str): The source code as a string.
209 start_line (int): The starting line number.
210
211 Returns:
212 str: The source code with line numbers added.
213 """
214 if start_line is None:
215 start_line = 1
216 lines = source.split("\n")
217 results = []
218 for idx, _line in enumerate(lines):
219 _line = str(idx + start_line) + " " + _line
220 results.append(_line)
221 return "\n".join(results)
222
223def matching_symbols(symbols, object):
224 """

Callers 7

get_definitionMethod · 0.90
get_symbolsMethod · 0.90
get_symbol_per_fileFunction · 0.85
_runMethod · 0.85
_runMethod · 0.85
_runMethod · 0.85

Calls 1

appendMethod · 0.80

Tested by

no test coverage detected