MCPcopy
hub / github.com/microsoft/RD-Agent / get

Method get

rdagent/app/CI/run.py:126–157  ·  view source on GitHub ↗

Retrieves a portion of the code lines. line number starts from 1, return codes in [start, end]. Args: start (int): The starting line number (inclusive). Defaults to 1. end (int | None): The ending line number (inclusive). Defaults to None, which mean

(
        self,
        start: int = 1,
        end: int | None = None,
        *,
        add_line_number: bool = False,
        return_list: bool = False,
    )

Source from the content-addressed store, hash-verified

124 self.code_lines_with_lineno = self.add_line_number(self.code_lines)
125
126 def get(
127 self,
128 start: int = 1,
129 end: int | None = None,
130 *,
131 add_line_number: bool = False,
132 return_list: bool = False,
133 ) -> list[str] | str:
134 """
135 Retrieves a portion of the code lines.
136 line number starts from 1, return codes in [start, end].
137
138 Args:
139 start (int): The starting line number (inclusive). Defaults to 1.
140 end (int | None): The ending line number (inclusive). Defaults to None, which means the last line.
141 add_line_number (bool): Whether to include line numbers in the result. Defaults to False.
142 return_list (bool): Whether to return the result as a list of lines
143 or as a single string. Defaults to False.
144
145 Returns:
146 list[str] | str: The code lines as a list of strings or as a
147 single string, depending on the value of `return_list`.
148 """
149 start -= 1
150 if start < 0:
151 start = 0
152 end = self.lineno if end is None else end
153 if end <= start:
154 res = []
155 res = self.code_lines_with_lineno[start:end] if add_line_number else self.code_lines[start:end]
156
157 return res if return_list else "\n".join(res)
158
159 def apply_changes(self, changes: list[tuple[int, int, str]]) -> None:
160 """

Callers 15

print_edaFunction · 0.80
print_edaFunction · 0.80
print_edaFunction · 0.80
test_model_filteringFunction · 0.80
test_factor_filteringFunction · 0.80
test_code_inspectionFunction · 0.80
recordMethod · 0.80
sample.pyFile · 0.80
genMethod · 0.80
__init__Method · 0.80
add_ideaMethod · 0.80

Calls

no outgoing calls

Tested by 3

test_model_filteringFunction · 0.64
test_factor_filteringFunction · 0.64
test_code_inspectionFunction · 0.64