Dataset Viewer
Auto-converted to Parquet Duplicate
path
stringlengths
15
77
type
stringclasses
1 value
project
stringclasses
1 value
commit_hash
stringlengths
40
40
commit_message
stringlengths
15
198
ground_truth
stringlengths
26
155
main_code
stringlengths
176
2.5k
context
stringlengths
91
9.37k
tests.coeditor.test_code_change/test_change_scope
Modified
temp-1
88a80dd462a4273154c266f5ef7d055f0b4fbfaf
Fix new scope headers. Fix unit tests.
<0>:<add> assert_str_equal(inner_class_code, indent(inner_attr1_expect, " " * 4))
# module: tests.coeditor.test_code_change def test_change_scope(): <s>code, indent(f1_expect, " " * 4)) - assert_str_equal(f1_code, f1_expect) f2_expect = dedent( """\ @annotated def f2(): return 1 """ ...
===========above chunk 0=========== # module: tests.coeditor.test_code_change def test_change_scope(): # offset: -1 code1 = dedent( """\ import os x = 1 y = x + 1 def f1(): global x ...
tests.coeditor.test_code_change/TestChangedSpan.test_comments_change
Modified
temp-1
88a80dd462a4273154c266f5ef7d055f0b4fbfaf
Fix new scope headers. Fix unit tests.
<0>:<add> (Modified, 1),
# module: tests.coeditor.test_code_change class TestChangedSpan: def test_comments_change(self): # have to update code as well for the changes to count code2 = dedent( """\ import os x = 1 ...
===========unchanged ref 0=========== at: tests.coeditor.test_code_change.TestChangedSpan code1 = dedent( """\ import os x = 1 y = x + 1 def f1(): global x x *= 5...
coeditor.code_change/ChangeScope.header_code
Modified
temp-1
88a80dd462a4273154c266f5ef7d055f0b4fbfaf
Fix new scope headers. Fix unit tests.
<0>:<add> return "".join(snippets)
# module: coeditor.code_change @dataclass class ChangeScope: @cached_property def header_code(self) -> str: if isinstance(self.tree, ptree.Module): return f"# module: {self.path.module}" # get the first non-empty line of self.tree +...
===========unchanged ref 0=========== at: coeditor._utils not_none(x: Optional[T1]) -> T1 at: coeditor.code_change.ChangeScope path: ProjectPath tree: ScopeTree spans: Sequence["StatementSpan"] subscopes: Mapping[ProjectPath, Self] at: functoo...
coeditor.code_change/ChangeScope.from_tree
Modified
temp-1
88a80dd462a4273154c266f5ef7d055f0b4fbfaf
Fix new scope headers. Fix unit tests.
<0>:<add> subscopes[spath] = subscope
# module: coeditor.code_change @dataclass class ChangeScope: @staticmethod def from_tree(path: ProjectPath, tree: ScopeTree) -> "ChangeScope": <s>as_any(s)): - current_stmts.append(s) - else: - if current_stm...
===========above chunk 0=========== # module: coeditor.code_change @dataclass class ChangeScope: @staticmethod def from_tree(path: ProjectPath, tree: ScopeTree) -> "ChangeScope": # offset: -1 spans = [] subscopes = dict() scope = ChangeScope(path, tree...
coeditor.ctx_change_encoder/TkCtxCodeChangeEncoder._encode_parent_scopes
Modified
temp-1
88a80dd462a4273154c266f5ef7d055f0b4fbfaf
Fix new scope headers. Fix unit tests.
<0>:<add> return scope_tks
# module: coeditor.ctx_change_encoder @dataclass class TkCtxCodeChangeEncoder: def _encode_parent_scopes( self, scope_changes: Sequence[Change[ChangeScope]], offset: int ) -> TokenSeq: scope_tks = join_list( (self._encode_scope_change(c...
===========unchanged ref 0=========== at: coeditor.common TokenSeq = list[Token] join_list(segs: Iterable[Iterable[T1]], sep: T1 | None=None) -> list[T1] at: coeditor.ctx_change_encoder.TkCtxCodeChangeEncoder VERSION = "0.0" max_ref_tks: int = 512 max_...
coeditor.ctx_change_encoder/CtxCodeChangeProblemGenerator.encode_change
Modified
temp-1
02aa6e2654a126be45b9b14e746d5bf2ad329e65
Fix static analysis.
<0>:<add> result.append((ProjectPath(used.full_name, ""), str(used)))
# module: coeditor.ctx_change_encoder class CtxCodeChangeProblemGenerator(ProjectChangeProcessor[CtxCodeChangeProblem]): def encode_change( self, pchange: JProjectChange, mod2usages: Mapping[ModuleName, LineUsageAnalysis], module_order: Seque...
===========above chunk 0=========== # module: coeditor.ctx_change_encoder class CtxCodeChangeProblemGenerator(ProjectChangeProcessor[CtxCodeChangeProblem]): def encode_change( self, pchange: JProjectChange, mod2usages: Mapping[ModuleName, LineUsageAnalysis], ...
coeditor.ctx_change_encoder/JediUsageAnalysis.get_module_usages
Modified
temp-1
02aa6e2654a126be45b9b14e746d5bf2ad329e65
Fix static analysis.
<0>:<add> errors[repr(e)] = errors.setdefault(str(e), 0) + 1
# module: coeditor.ctx_change_encoder @dataclass class JediUsageAnalysis: def get_module_usages( self, script: jedi.Script, proj_root: Path, silent: bool = False ): <s> all_names.sort(key=lambda x: x.start_pos) errors = self.error_counts + ...
===========above chunk 0=========== # module: coeditor.ctx_change_encoder @dataclass class JediUsageAnalysis: def get_module_usages( self, script: jedi.Script, proj_root: Path, silent: bool = False ): # offset: -1 jmod: tree.Module = script._module_node + ...
coeditor.code_change/_edits_from_commit_history
Modified
temp-1
3fc7535603679d696adc71d9db9ffc11f0ba700e
Analyzing only changed lines to speed up.
<0>:<add> checkout_commit(commit_next.hash)
# module: coeditor.code_change def _edits_from_commit_history( project: Path, history: Sequence[CommitInfo], change_encoder: ProjectChangeProcessor[TEnc], ignore_dirs: set[str], silent: bool, ) -> Iterable[TEnc]: <s>_path = RelPath(path.relative_...
===========above chunk 0=========== # module: coeditor.code_change def _edits_from_commit_history( project: Path, history: Sequence[CommitInfo], change_encoder: ProjectChangeProcessor[TEnc], ignore_dirs: set[str], silent: bool, ) -> Iterable[TEnc]: # offset: -1 ...
coeditor.ctx_change_encoder/PyDefinition.from_signatures
Modified
temp-1
3fc7535603679d696adc71d9db9ffc11f0ba700e
Analyzing only changed lines to speed up.
<0>:<add> yield PyDefinition(full_name, import_module, start_pos, end_pos)
# module: coeditor.ctx_change_encoder @dataclass(unsafe_hash=True) class PyDefinition: @staticmethod - def from_signatures( - name: classes.BaseName, project: Path | None = None - ) -> Iterable["PyDefinition"]: + def from_signatures(name: classes.BaseName)...
===========unchanged ref 0=========== at: coeditor.ctx_change_encoder PyFullName = NewType("PyPathStr", str) PyDefinition(full_name: PyFullName, import_module: ModuleName, start_pos: tuple[int, int], end_pos: tuple[int, int]) at: coeditor.ctx_change_encoder.PyDefinition full_na...
coeditor.ctx_change_encoder/CtxCodeChangeProblemGenerator.pre_edit_analysis
Modified
temp-1
3fc7535603679d696adc71d9db9ffc11f0ba700e
Analyzing only changed lines to speed up.
<0>:<add> result[mname] = line_usages
# module: coeditor.ctx_change_encoder class CtxCodeChangeProblemGenerator(ProjectChangeProcessor[CtxCodeChangeProblem]): def pre_edit_analysis( self, project: jedi.Project, modules: Mapping[RelPath, JModule], + changes: Mapping[ModuleName, JMod...
===========above chunk 0=========== # module: coeditor.ctx_change_encoder class CtxCodeChangeProblemGenerator(ProjectChangeProcessor[CtxCodeChangeProblem]): def pre_edit_analysis( self, project: jedi.Project, modules: Mapping[RelPath, JModule], + changes: Ma...
coeditor.code_change/ChangeScope.all_code
Modified
temp-1
b2f78bf15287dca9f1312cdd7720e6e9175fdeef
Fix line ranges. Improve analysis and add tests.
<0>:<add> return self.header_code + self.spans_code
# module: coeditor.code_change @dataclass class ChangeScope: @cached_property def all_code(self) -> str: - return f"{self.header_code}\n{self.spans_code}" <0>
===========changed ref 0=========== # module: coeditor.code_change + def _line_range(start: int, end: int, can_be_empty: bool = False) -> _LineRange: + if not can_be_empty and start >= end: + raise ValueError(f"Bad line range: {start=}, {end=}") + return _LineRange((start, end)) + =======...
coeditor.code_change/_edits_from_commit_history
Modified
temp-1
b2f78bf15287dca9f1312cdd7720e6e9175fdeef
Fix line ranges. Improve analysis and add tests.
<0>:<add> pchange = JProjectChange(changed, modules_mod, commit_next)
# module: coeditor.code_change def _edits_from_commit_history( project: Path, history: Sequence[CommitInfo], change_encoder: ProjectChangeProcessor[TEnc], ignore_dirs: set[str], silent: bool, ) -> Iterable[TEnc]: <s>change: ...
===========above chunk 0=========== # module: coeditor.code_change def _edits_from_commit_history( project: Path, history: Sequence[CommitInfo], change_encoder: ProjectChangeProcessor[TEnc], ignore_dirs: set[str], silent: bool, ) -> Iterable[TEnc]: # offset: -1 ...
coeditor.ctx_change_encoder/CtxCodeChangeProblemGenerator.__init__
Modified
temp-1
b2f78bf15287dca9f1312cdd7720e6e9175fdeef
Fix line ranges. Improve analysis and add tests.
<0>:<add> analysis = JediUsageAnalyzer()
# module: coeditor.ctx_change_encoder class CtxCodeChangeProblemGenerator(ProjectChangeProcessor[CtxCodeChangeProblem]): + def __init__(self, analysis: "JediUsageAnalyzer | None"): - def __init__(self, analysis: "JediUsageAnalysis | None"): if analysis is None: - ...
===========unchanged ref 0=========== at: coeditor.ctx_change_encoder CtxCodeChangeProblem(span: ChangedSpan, relevant_changes: list[ChangedSpan], relevant_unchanged: list[tuple[ProjectPath, str]]) JediUsageAnalyzer(follow_imports: bool=True) ===========changed ref 0=========== # ...
coeditor.ctx_change_encoder/CtxCodeChangeProblemGenerator.pre_edit_analysis
Modified
temp-1
b2f78bf15287dca9f1312cdd7720e6e9175fdeef
Fix line ranges. Improve analysis and add tests.
<0>:<add> lines_to_analyze.update(range(*span.header_line_range))
# module: coeditor.ctx_change_encoder class CtxCodeChangeProblemGenerator(ProjectChangeProcessor[CtxCodeChangeProblem]): def pre_edit_analysis( self, project: jedi.Project, modules: Mapping[RelPath, JModule], changes: Mapping[ModuleName, JMod...
===========unchanged ref 0=========== at: coeditor.common RelPath = NewType("RelPath", Path) at: coeditor.ctx_change_encoder LineUsageAnalysis(line2usages: Mapping[int, set[PyDefinition]]) at: coeditor.ctx_change_encoder.CtxCodeChangeProblemGenerator.__init__ analysis = Jed...
coeditor.encoding/change_to_line_diffs
Modified
temp-1
d0fe36e93da8ca33161e524783335898bd47ebbc
- More analysis bug fix. - Encode unchanged using CSpan.
<0>:<add> diffs = compute_line_diffs(splitlines(before), splitlines(after))
# module: coeditor.encoding def change_to_line_diffs(change: Change[str]) -> list[str]: "Encode a change as a token sequence." match change: case Modified(before, after): + if change.unchanged: + diffs = [] + else: - ...
===========unchanged ref 0=========== at: coeditor._utils compute_line_diffs(before: Sequence[str], after: Sequence[str], keep_explain_lines: bool=False) at: coeditor.common splitlines(text: str) -> list[str]
tests.coeditor.test_code_change/test_change_scope
Modified
temp-1
d0fe36e93da8ca33161e524783335898bd47ebbc
- More analysis bug fix. - Encode unchanged using CSpan.
<0>:<add> inner_class_code = scope.subscopes["A"].subscopes["B"].all_code
# module: tests.coeditor.test_code_change def test_change_scope(): <s> assert_str_equal(f1_code, indent(f1_expect, " " * 4)) f2_expect = dedent( """\ @annotated def f2(): return 1 """ ) +...
===========above chunk 0=========== # module: tests.coeditor.test_code_change def test_change_scope(): # offset: -1 code1 = dedent( """\ import os x = 1 y = x + 1 def f1(): global x ...
coeditor.code_change/ChangeScope.from_tree
Modified
temp-1
d0fe36e93da8ca33161e524783335898bd47ebbc
- More analysis bug fix. - Encode unchanged using CSpan.
<0>:<add> subscopes[name] = subscope
# module: coeditor.code_change @dataclass class ChangeScope: @staticmethod def from_tree(path: ProjectPath, tree: ScopeTree) -> "ChangeScope": spans = [] subscopes = dict() + scope = ChangeScope(path, tree, spans, subscopes, None) - ...
===========unchanged ref 0=========== at: coeditor._utils not_none(x: Optional[T1]) -> T1 assert_eq(x: T1, y: T1, message: Callable[[], str]=lambda: "") -> None at: coeditor.code_change _LineRange = NewType("LineRange", tuple[int, int]) _line_range(start: int, end:...
coeditor.code_change/JModuleChange.from_modules
Modified
temp-1
d0fe36e93da8ca33161e524783335898bd47ebbc
- More analysis bug fix. - Encode unchanged using CSpan.
<0>:<add> module_change.map(lambda m: m.as_scope), tuple()
# module: coeditor.code_change @dataclass class JModuleChange: @staticmethod def from_modules(module_change: Change[JModule]): "Compute the change spans from two versions of the same module." with _tlogger.timed("JModuleChange.from_modules"): ...
===========unchanged ref 0=========== at: coeditor.code_change.ChangedSpan change: Change[str] parent_scopes: Sequence[Change[ChangeScope]] line_range: _LineRange at: dataclasses dataclass(_cls: Type[_T]) -> Type[_T] dataclass(*, init: bool=..., repr: bool=...
coeditor.ctx_change_encoder/CtxCodeChangeProblemGenerator.encode_change
Modified
temp-1
d0fe36e93da8ca33161e524783335898bd47ebbc
- More analysis bug fix. - Encode unchanged using CSpan.
<0>:<add> result.append(cspan)
# module: coeditor.ctx_change_encoder class CtxCodeChangeProblemGenerator(ProjectChangeProcessor[CtxCodeChangeProblem]): def encode_change( self, pchange: JProjectChange, mod2usages: Mapping[ModuleName, LineUsageAnalysis], module_order: Seque...
===========above chunk 0=========== # module: coeditor.ctx_change_encoder class CtxCodeChangeProblemGenerator(ProjectChangeProcessor[CtxCodeChangeProblem]): def encode_change( self, pchange: JProjectChange, mod2usages: Mapping[ModuleName, LineUsageAnalysis], ...
coeditor.ctx_change_encoder/JediUsageAnalyzer.get_line_usages
Modified
temp-1
d0fe36e93da8ca33161e524783335898bd47ebbc
- More analysis bug fix. - Encode unchanged using CSpan.
<0>:<add> usages.update(PyDefinition.from_name(d))
# module: coeditor.ctx_change_encoder @dataclass class JediUsageAnalyzer: def get_line_usages( self, script: jedi.Script, proj_root: Path, lines_to_analyze: Collection[int], silent: bool = False, ): ...
===========unchanged ref 0=========== at: coeditor._utils TimeLogger(times: dict[str, list[float]]=field(default_factory=dict)) at: coeditor.ctx_change_encoder PyDefinition(full_name: PyFullName, import_module: ModuleName, start_pos: tuple[int, int], end_pos: tuple[int, int]) _...
coeditor.code_change/ChangeScope.__post_init__
Modified
temp-1
d58fffa6f57746cb134bd98b5de3a8e668c4311d
Finish unchanged ref encoding.
<0>:<add> self.header_line_range: LineRange = header_line_range
# module: coeditor.code_change @dataclass class ChangeScope: def __post_init__(self): <s> = f"# module: {self.path.module}" + header_line_range = line_range(0, 0, can_be_empty=True) - header_line_range = _line_range(0, 0, can_be_empty=True) ...
===========above chunk 0=========== # module: coeditor.code_change @dataclass class ChangeScope: def __post_init__(self): # offset: -1 # compute header if isinstance(self.tree, ptree.Module): header_code = f"# module: {self.path.module}" + he...
coeditor.code_change/ChangeScope.from_tree
Modified
temp-1
d58fffa6f57746cb134bd98b5de3a8e668c4311d
Finish unchanged ref encoding.
<0>:<add> spans.append(StatementSpan(len(spans), current_stmts, scope))
# module: coeditor.code_change @dataclass class ChangeScope: @staticmethod def from_tree(path: ProjectPath, tree: ScopeTree) -> "ChangeScope": spans = [] subscopes = dict() scope = ChangeScope(path, tree, spans, subscopes, None) ...
===========unchanged ref 0=========== at: coeditor._utils as_any(x) -> Any at: coeditor.code_change ScopeTree = ptree.Function | ptree.Class | ptree.Module ChangeScope(path: ProjectPath, tree: ScopeTree, spans: Sequence["StatementSpan"], subscopes: Mapping[str, Self], parent_sc...
coeditor.code_change/StatementSpan.__post_init__
Modified
temp-1
d58fffa6f57746cb134bd98b5de3a8e668c4311d
Finish unchanged ref encoding.
<0>:<add> self.line_range: LineRange = line_range(start, end)
# module: coeditor.code_change @dataclass class StatementSpan: def __post_init__(self): assert self.statements + # remove leading newlines + n_leading_newlines = 0 + stmts = self.statements + for s in stmts: + if s...
===========unchanged ref 0=========== at: coeditor.code_change.StatementSpan nth_in_parent: int statements: Sequence[PyNode] scope: ChangeScope at: parso.python.tree Newline() at: parso.python.tree.Newline __slots__ = () type = 'newlin...
coeditor.ctx_change_encoder/PyDefinition.from_name
Modified
temp-1
d58fffa6f57746cb134bd98b5de3a8e668c4311d
Finish unchanged ref encoding.
<0>:<add> raise ValueError(f"Inconsistent module: {full_name=}, {import_module=}")
# module: coeditor.ctx_change_encoder @dataclass(unsafe_hash=True) class PyDefinition: @staticmethod def from_name(name: classes.BaseName) -> Iterable["PyDefinition"]: - cast(classes.Name, name).is_definition() if ( not name.in_builtin_mo...
===========unchanged ref 0=========== at: coeditor.ctx_change_encoder PyFullName = NewType("PyFullName", str) at: coeditor.ctx_change_encoder.PyDefinition full_name: PyFullName import_module: ModuleName start_pos: tuple[int, int] end_pos: tuple[int, in...
End of preview. Expand in Data Studio

Dataset Card for "Coeditor-processed-demo"

More Information needed

Downloads last month
11