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)
| 201 | return None |
| 202 | |
| 203 | def 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 | |
| 223 | def matching_symbols(symbols, object): |
| 224 | """ |
no test coverage detected