MCPcopy Create free account
hub / github.com/PaddlePaddle/Paddle / format_code_block_with_suggestions

Function format_code_block_with_suggestions

tools/check_code_block_format.py:138–150  ·  view source on GitHub ↗
(
    code_block: CodeBlock, suggestions: list[CodeBlockModifySuggestion]
)

Source from the content-addressed store, hash-verified

136
137
138def format_code_block_with_suggestions(
139 code_block: CodeBlock, suggestions: list[CodeBlockModifySuggestion]
140) -> str:
141 formatted_lines = []
142 for line_offset, line in enumerate(code_block.lines):
143 lineno_str = with_cyan(f"{code_block.start_lineno + line_offset:>5}|")
144 formatted_lines.append(f"{lineno_str} {line}")
145 for suggestion in suggestions:
146 if suggestion.lineno == line_offset:
147 formatted_lines.append(
148 f" | {with_red('^')} {with_blue(suggestion.message)}\n"
149 )
150 return ''.join(formatted_lines)
151
152
153def extract_code_blocks(

Callers 2

__init__Method · 0.85
__init__Method · 0.85

Calls 5

with_cyanFunction · 0.85
with_redFunction · 0.85
with_blueFunction · 0.85
appendMethod · 0.45
joinMethod · 0.45

Tested by

no test coverage detected