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...
coeditor.ctx_change_encoder/TkCtxCodeChangeEncoder.encode_problem
Modified
temp-1
d58fffa6f57746cb134bd98b5de3a8e668c4311d
Finish unchanged ref encoding.
<0>:<add> named_references.append((f"changed ref {i}", chunk))
# module: coeditor.ctx_change_encoder @dataclass class TkCtxCodeChangeEncoder: def encode_problem( self, problem: CtxCodeChangeProblem, ) -> Iterable[TkCtxCodeChangeProblem]: span = problem.span named_references = list[tuple[s...
===========below chunk 0=========== # module: coeditor.ctx_change_encoder @dataclass class TkCtxCodeChangeEncoder: def encode_problem( self, problem: CtxCodeChangeProblem, ) -> Iterable[TkCtxCodeChangeProblem]: # offset: 1 <s>l:], Newline_id) c...
coeditor.ctx_change_encoder/JediUsageAnalyzer.get_line_usages
Modified
temp-1
d58fffa6f57746cb134bd98b5de3a8e668c4311d
Finish unchanged ref encoding.
<0>:<add> follow_imports=True,
# 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 groupby(iterable: Iterable[T1], keyfunc: Callable[[T1], T2]) -> dict[T2, list[T1]] at: coeditor.code_change ChangedSpan(change: Change[str], parent_scopes: Sequence[Change[ChangeScope]], line_range: _LineRange) at: coeditor....
coeditor.code_change/get_python_files
Modified
temp-1
c5644c5542948a30b4d5a99c74d50454fb62315a
Speed up parsing with on-demand deepcopying.
<0>:<add> files.append(to_rel_path(Path(f.path).relative_to(project)))
# module: coeditor.code_change + def get_python_files(project: RelPath) -> list[RelPath]: - def get_python_files(project: Path): + files = list[RelPath]() - files = list[Path]() for f in recurse_find_python_files(FolderIO(str(project))): f: FileIO - file...
===========unchanged ref 0=========== at: coeditor.common RelPath = NewType("RelPath", Path) to_rel_path(path: os.PathLike | str) -> RelPath at: jedi.file_io FolderIO(path) FileIO(path: Union[os.PathLike, str]) at: jedi.inference.references recurse...
coeditor.code_change/edits_from_commit_history
Modified
temp-1
c5644c5542948a30b4d5a99c74d50454fb62315a
Speed up parsing with on-demand deepcopying.
<0>:<add> tempdir, history, change_processor, edit_encoder, ignore_dirs, silent
<s>_from_commit_history( project_dir: Path, history: Sequence[CommitInfo], tempdir: Path, + change_processor: ProjectChangeProcessor[TProb] = NoProcessing(), - change_encoder: ProjectChangeProcessor[TEnc] = NoProcessing(), + edit_encoder: Callable[[TProb], Ite...
===========unchanged ref 0=========== at: coeditor.code_change DefaultIgnoreDirs = {".venv", ".mypy_cache", ".git", "venv", "build"} TProb = TypeVar("TProb", covariant=True) ProjectChangeProcessor() NoProcessing() _edits_from_commit_history(project: Path, ...
coeditor.ctx_change_encoder/CtxCodeChangeProblemGenerator.pre_edit_analysis
Modified
temp-1
65a052117c316099d5beea02c38dd4ed3cd1b187
Speed up analyses using script caching.
<0>:<add> script = pstate.scripts[mod_path]
# module: coeditor.ctx_change_encoder class CtxCodeChangeProblemGenerator(ProjectChangeProcessor[CtxCodeChangeProblem]): def pre_edit_analysis( self, + pstate: ProjectState, - project: jedi.Project, modules: Mapping[RelPath, JModule], ...
===========unchanged ref 0=========== at: coeditor.code_change.ChangedSpan change: Change[str] parent_scopes: Sequence[Change[ChangeScope]] line_range: LineRange at: coeditor.code_change.JModule mname: ModuleName tree: ptree.Module at: coedito...
coeditor.code_change/ChangeScope.__post_init__
Modified
temp-1
74b3e2333e9961157b553323ce501210bcaaebda
Fix span ranges.
<0>:<add> h_start = not_none(visited[0].get_start_pos_of_prefix())[0] + e_left
# module: coeditor.code_change @dataclass class ChangeScope: def __post_init__(self): # compute header if isinstance(self.tree, ptree.Module): header_code = f"# module: {self.path.module}" header_line_range = line_range(0, 0, ca...
===========unchanged ref 0=========== at: coeditor.code_change.ChangeScope path: ProjectPath tree: ScopeTree spans: Sequence["StatementSpan"] subscopes: Mapping[str, Self] parent_scope: "ChangeScope | None" _search_span(line: int) -> "Statemen...
coeditor.code_change/ChangeScope.from_tree
Modified
temp-1
74b3e2333e9961157b553323ce501210bcaaebda
Fix span ranges.
<0>:<add> raise ValueError(f"Function with no spans: {path=}, {tree.get_code()=}")
# module: coeditor.code_change @dataclass class ChangeScope: @staticmethod def from_tree(path: ProjectPath, tree: ScopeTree) -> "ChangeScope": <s>tree, ptree.Function) + + def mk_span(stmts): + # remove leading newlines + n_lea...
===========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.code_change/StatementSpan.__post_init__
Modified
temp-1
74b3e2333e9961157b553323ce501210bcaaebda
Fix span ranges.
<0>:<add> print_err(s)
# 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._utils not_none(x: Optional[T1]) -> T1 at: coeditor.code_change PyNode = ptree.PythonBaseNode | ptree.PythonNode _strip_empty_lines(s: str) ChangeScope(path: ProjectPath, tree: ScopeTree, spans: Sequence["Statement...
coeditor.code_change/_edits_from_commit_history
Modified
temp-1
74b3e2333e9961157b553323ce501210bcaaebda
Fix span ranges.
<0>:<add> results = list[TEnc]()
# module: coeditor.code_change def _edits_from_commit_history( project: Path, history: Sequence[CommitInfo], change_processor: ProjectChangeProcessor[TProb], + edit_encoder: Callable[[TProb], Iterable[TEnc]], - edit_encoder: Callable[[TProb], Iterable[T1]], ...
===========above chunk 0=========== # module: coeditor.code_change def _edits_from_commit_history( project: Path, history: Sequence[CommitInfo], change_processor: ProjectChangeProcessor[TProb], + edit_encoder: Callable[[TProb], Iterable[TEnc]], - edit_encoder: Callable[[TProb...
coeditor.ctx_change_encoder/PyDefinition.from_name
Modified
temp-1
74b3e2333e9961157b553323ce501210bcaaebda
Fix span ranges.
<0>:<add> yield PyDefinition(full_name, start_pos, end_pos)
# module: coeditor.ctx_change_encoder @dataclass(unsafe_hash=True) class PyDefinition: @staticmethod def from_name(name: classes.BaseName) -> Iterable["PyDefinition"]: if ( not name.in_builtin_module() and (full_name := name.full_na...
===========unchanged ref 0=========== at: coeditor.ctx_change_encoder PyFullName = NewType("PyFullName", str) PyDefinition(full_name: PyFullName, start_pos: tuple[int, int], end_pos: tuple[int, int]) at: coeditor.ctx_change_encoder.PyDefinition full_name: PyFullName ...
coeditor.ctx_change_encoder/CtxCodeChangeProblemGenerator.process_change
Modified
temp-1
bfd57146137ab2ed5c1a9cd99939b8c49797f0e4
Record src_info in edits.
<0>:<add> processed_cspans.append(span)
# module: coeditor.ctx_change_encoder class CtxCodeChangeProblemGenerator(ProjectChangeProcessor[CtxCodeChangeProblem]): def process_change( self, pchange: JProjectChange, mod2usages: Mapping[ModuleName, LineUsageAnalysis], module_order: Sequ...
===========above chunk 0=========== # module: coeditor.ctx_change_encoder class CtxCodeChangeProblemGenerator(ProjectChangeProcessor[CtxCodeChangeProblem]): def process_change( self, pchange: JProjectChange, mod2usages: Mapping[ModuleName, LineUsageAnalysis], ...
coeditor.ctx_change_encoder/TkCtxCodeChangeProblem.meta_data_lines
Modified
temp-1
bfd57146137ab2ed5c1a9cd99939b8c49797f0e4
Record src_info in edits.
<0>:<add> f"src_info: {self.src_info}",
# module: coeditor.ctx_change_encoder @dataclass class TkCtxCodeChangeProblem(TokenizedEdit): def meta_data_lines(self) -> list[str]: return [ f"path: {self.path}", f"n_references: {len(self.references)}", f"total_reference_...
===========unchanged ref 0=========== at: coeditor.common TokenSeq = list[Token] at: coeditor.ctx_change_encoder.TkCtxCodeChangeProblem input_tks: TokenSeq output_tks: TokenSeq path: ProjectPath change_type: Change[None] named_references: ...
coeditor.ctx_change_encoder/TkCtxCodeChangeEncoder.encode_problem
Modified
temp-1
bfd57146137ab2ed5c1a9cd99939b8c49797f0e4
Record src_info in edits.
<0>:<add> src_info=problem.src_info,
# module: coeditor.ctx_change_encoder @dataclass class TkCtxCodeChangeEncoder: def encode_problem( self, problem: CtxCodeChangeProblem, ) -> Iterable[TkCtxCodeChangeProblem]: <s> else: below_chunks = break_in...
===========above chunk 0=========== # module: coeditor.ctx_change_encoder @dataclass class TkCtxCodeChangeEncoder: def encode_problem( self, problem: CtxCodeChangeProblem, ) -> Iterable[TkCtxCodeChangeProblem]: # offset: -1 <s>to_tk_delta() chunk_i...
coeditor.ctx_change_encoder/CtxCodeChangeProblemGenerator.process_change
Modified
temp-1
265b47b3f37487794989decf11d99183abf08228
Add parent scopes as relevant unchanged refs.
<0>:<add> relevant_changes = list(reversed(processed_cspans))
# module: coeditor.ctx_change_encoder class CtxCodeChangeProblemGenerator(ProjectChangeProcessor[CtxCodeChangeProblem]): def process_change( self, pchange: JProjectChange, mod2usages: Mapping[ModuleName, LineUsageAnalysis], module_order: Sequ...
===========above chunk 0=========== # module: coeditor.ctx_change_encoder class CtxCodeChangeProblemGenerator(ProjectChangeProcessor[CtxCodeChangeProblem]): def process_change( self, pchange: JProjectChange, mod2usages: Mapping[ModuleName, LineUsageAnalysis], ...
coeditor.ctx_change_encoder/TkCtxCodeChangeEncoder._group_encode_changed_refs
Modified
temp-1
265b47b3f37487794989decf11d99183abf08228
Add parent scopes as relevant unchanged refs.
<0>:<add> file_tks.append(Newline_id)
# module: coeditor.ctx_change_encoder @dataclass class TkCtxCodeChangeEncoder: def _group_encode_changed_refs( self, changes: Sequence[ChangedSpan] ) -> Sequence[TokenSeq]: module2changes = groupby(changes, lambda c: c.path.module) all_chun...
===========unchanged ref 0=========== at: coeditor._utils groupby(iterable: Iterable[T1], keyfunc: Callable[[T1], T2]) -> dict[T2, list[T1]] at: coeditor.code_change ChangedSpan(change: Change[str], parent_scopes: Sequence[Change[ChangeScope]], line_range: LineRange) at: coeditor.c...
coeditor.ctx_change_encoder/CtxCodeChangeProblemGenerator.process_change
Modified
temp-1
f9c5006c3d426a199c472d33cc31b910793b0357
- Fix header trailing newline encoding. - Fix change hiding.
<0>:<add> for cspan in (this_change, *other_changes):
# module: coeditor.ctx_change_encoder class CtxCodeChangeProblemGenerator(ProjectChangeProcessor[CtxCodeChangeProblem]): def process_change( self, pchange: JProjectChange, mod2usages: Mapping[ModuleName, LineUsageAnalysis], module_order: Sequ...
===========above chunk 0=========== # module: coeditor.ctx_change_encoder class CtxCodeChangeProblemGenerator(ProjectChangeProcessor[CtxCodeChangeProblem]): def process_change( self, pchange: JProjectChange, mod2usages: Mapping[ModuleName, LineUsageAnalysis], ...
coeditor.ctx_change_encoder/TkCtxCodeChangeEncoder._encode_scope_change
Modified
temp-1
f9c5006c3d426a199c472d33cc31b910793b0357
- Fix header trailing newline encoding. - Fix change hiding.
<0>:<add> hchange = c.map(lambda s: s.header_code.strip("\n"))
# module: coeditor.ctx_change_encoder @dataclass class TkCtxCodeChangeEncoder: def _encode_scope_change(self, c: Change[ChangeScope]) -> TokenSeq: if (key := _ObjId(id(c))) in self._scope_cache: return self._scope_cache[key] - hchange = c.map(lambd...
===========unchanged ref 0=========== at: coeditor.code_change ChangeScope(path: ProjectPath, tree: ScopeTree, spans: Sequence["StatementSpan"], subscopes: Mapping[str, Self], parent_scope: "ChangeScope | None") at: coeditor.common TokenSeq = list[Token] at: coeditor.ctx_change_enc...
coeditor.ctx_change_encoder/TkCtxCodeChangeEncoder._encode_parent_scopes
Modified
temp-1
f9c5006c3d426a199c472d33cc31b910793b0357
- Fix header trailing newline encoding. - Fix change hiding.
<0>:<add> scope_tks.append(Newline_id)
# 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.code_change ChangeScope(path: ProjectPath, tree: ScopeTree, spans: Sequence["StatementSpan"], subscopes: Mapping[str, Self], parent_scope: "ChangeScope | None") at: coeditor.common TokenSeq = list[Token] join_list(segs: Iterabl...
coeditor.ctx_change_encoder/TkCtxCodeChangeEncoder._encode_change
Modified
temp-1
f9c5006c3d426a199c472d33cc31b910793b0357
- Fix header trailing newline encoding. - Fix change hiding.
<0>:<add> change = change.map(lambda s: s.strip("\n"))
# module: coeditor.ctx_change_encoder @dataclass class TkCtxCodeChangeEncoder: def _encode_change(self, change: Change[str]) -> TokenSeq: if (key := _ObjId(id(change))) in self._id_cache: return self._id_cache[key] <0> change_tks = change_to_tokens(c...
===========unchanged ref 0=========== at: coeditor.common TokenSeq = list[Token] at: coeditor.ctx_change_encoder _ObjId = NewType("_ObjId", int) at: coeditor.ctx_change_encoder.TkCtxCodeChangeEncoder.__post_init__ self._id_cache = FIFOCache[_ObjId, TokenSeq](maxsize=1000) ...
coeditor.dataset/_process_commits
Modified
temp-1
f9e7d3bbf0646c97dce2c651fb83fba9c8cfcca8
Switch data preparation to new format.
<0>:<add> jedi.settings.cache_directory = old_cache
# module: coeditor.dataset def _process_commits( root: Path, + workdir: Path, commits: Sequence[CommitInfo], - training: bool, + encoder: C3EditEncoder, - encoder: EditEncoder[T1], - drop_comments: bool, - ) -> list[T1]: + ) -> Sequence[TkC...
===========unchanged ref 0=========== at: _warnings warn(message: str, category: Optional[Type[Warning]]=..., stacklevel: int=..., source: Optional[Any]=...) -> None warn(message: Warning, category: Any=..., stacklevel: int=..., source: Optional[Any]=...) -> None at: coeditor._utils ...
coeditor.code_change/NoProcessing.process_change
Modified
temp-1
f9e7d3bbf0646c97dce2c651fb83fba9c8cfcca8
Switch data preparation to new format.
<0>:<add> return [pchange]
# module: coeditor.code_change class NoProcessing(ProjectChangeProcessor[JProjectChange]): def process_change( self, pchange: JProjectChange, pre_analysis, post_analysis, + ) -> Sequence[JProjectChange]: - ) -> Iterable[JProje...
===========unchanged ref 0=========== at: coeditor.code_change JProjectChange(changed: Mapping[ModuleName, JModuleChange], all_modules: Modified[Collection[JModule]], commit_info: "CommitInfo | None") ProjectChangeProcessor() at: coeditor.code_change.ProjectChangeProcessor VERS...
coeditor.code_change/edits_from_commit_history
Modified
temp-1
f9e7d3bbf0646c97dce2c651fb83fba9c8cfcca8
Switch data preparation to new format.
<0>:<add> shutil.rmtree(tempdir)
# module: coeditor.code_change def edits_from_commit_history( project_dir: Path, history: Sequence[CommitInfo], tempdir: Path, change_processor: ProjectChangeProcessor[TProb] = NoProcessing(), edit_encoder: Callable[[TProb], Iterable[TEnc]] = lambda x: [x], ...
===========unchanged ref 0=========== at: coeditor.code_change DefaultIgnoreDirs = {".venv", ".mypy_cache", ".git", "venv", "build"} JProjectChange(changed: Mapping[ModuleName, JModuleChange], all_modules: Modified[Collection[JModule]], commit_info: "CommitInfo | None") TProb = Typ...
coeditor.code_change/_edits_from_commit_history
Modified
temp-1
f9e7d3bbf0646c97dce2c651fb83fba9c8cfcca8
Switch data preparation to new format.
<0>:<add> pchange, pre_analysis, post_analysis
# module: coeditor.code_change def _edits_from_commit_history( project: Path, history: Sequence[CommitInfo], change_processor: ProjectChangeProcessor[TProb], edit_encoder: Callable[[TProb], Iterable[TEnc]], ignore_dirs: set[str], silent: bool, ...
===========above chunk 0=========== # module: coeditor.code_change def _edits_from_commit_history( project: Path, history: Sequence[CommitInfo], change_processor: ProjectChangeProcessor[TProb], edit_encoder: Callable[[TProb], Iterable[TEnc]], ignore_dirs: set[str], ...
scripts.coeditor.train_retrieval_model/train_model
Modified
temp-1
f9e7d3bbf0646c97dce2c651fb83fba9c8cfcca8
Switch data preparation to new format.
<0>:<add> datasets = make_or_load_datasets(dataset_name, encoder, recreate_data=recreate_data)
<s>model( dataset_name="medium", model_variant="-sig-analysis-post_usees", + encoder: C3EditEncoder = C3EditEncoder(), - encoder: QueryRefEditEncoder = QueryRefEditEncoder(), - drop_comments: bool = True, batch_args=BatchArgs.train_default(), test_ba...
===========below chunk 0=========== <s>_name="medium", model_variant="-sig-analysis-post_usees", + encoder: C3EditEncoder = C3EditEncoder(), - encoder: QueryRefEditEncoder = QueryRefEditEncoder(), - drop_comments: bool = True, batch_args=BatchArgs.train_default(), test_batc...
coeditor.dataset/dataset_from_projects
Modified
temp-1
c2672194b1a2abfcf00b08e9e73e6851407c3d95
Fix jedi cache error. Print processor errors.
<0>:<add> pretty_print_dict(error_counts)
# module: coeditor.dataset def dataset_from_projects( project_roots: Sequence[Path], encoder: C3EditEncoder, repo_training: Sequence[bool], max_history_per_repo: int = 1000, workers: int = DefaultWorkers, ) -> "TokenizedEditDataset[TkC3Problem]": ...
===========above chunk 0=========== # module: coeditor.dataset def dataset_from_projects( project_roots: Sequence[Path], encoder: C3EditEncoder, repo_training: Sequence[bool], max_history_per_repo: int = 1000, workers: int = DefaultWorkers, ) -> "TokenizedEditDataset[...
coeditor.ctx_change_encoder/C3ProblemGenerator.__init__
Modified
temp-1
c2672194b1a2abfcf00b08e9e73e6851407c3d95
Fix jedi cache error. Print processor errors.
<0>:<add> self.analyzer = analyzer
# module: coeditor.ctx_change_encoder class C3ProblemGenerator(ProjectChangeProcessor[C3Problem]): + def __init__(self, analyzer: "JediUsageAnalyzer | None" = None): - def __init__(self, analysis: "JediUsageAnalyzer | None" = None): + if analyzer is None: - if analysi...
===========unchanged ref 0=========== at: coeditor.ctx_change_encoder JediUsageAnalyzer() at: coeditor.ctx_change_encoder.C3ProblemGenerator VERSION = "1.0" ===========changed ref 0=========== # module: coeditor.code_change @dataclass class ProjectChangeProcessor(Gener...
coeditor.ctx_change_encoder/C3ProblemGenerator.pre_edit_analysis
Modified
temp-1
c2672194b1a2abfcf00b08e9e73e6851407c3d95
Fix jedi cache error. Print processor errors.
<0>:<add> line_usages = self.analyzer.get_line_usages(
# module: coeditor.ctx_change_encoder class C3ProblemGenerator(ProjectChangeProcessor[C3Problem]): def pre_edit_analysis( self, pstate: ProjectState, modules: Mapping[RelPath, JModule], changes: Mapping[ModuleName, JModuleChange], )...
===========unchanged ref 0=========== at: coeditor.code_change.ChangedSpan change: Change[str] parent_scopes: Sequence[Change[ChangeScope]] line_range: LineRange at: coeditor.code_change.JModule mname: ModuleName tree: ptree.Module at: coedito...
coeditor.ctx_change_encoder/C3ProblemGenerator.post_edit_analysis
Modified
temp-1
c2672194b1a2abfcf00b08e9e73e6851407c3d95
Fix jedi cache error. Print processor errors.
<0>:<add> for source in _fast_goto(
# module: coeditor.ctx_change_encoder class C3ProblemGenerator(ProjectChangeProcessor[C3Problem]): def post_edit_analysis( self, pstate: ProjectState, modules: Mapping[RelPath, JModule], changes: Mapping[ModuleName, JModuleChange], ...
===========unchanged ref 0=========== at: coeditor.code_change.JModule mname: ModuleName at: coeditor.common RelPath = NewType("RelPath", Path) at: coeditor.ctx_change_encoder.C3ProblemGenerator.__init__ analyzer = JediUsageAnalyzer() self.analyzer = analyzer ...
coeditor.ctx_change_encoder/JediUsageAnalyzer.get_line_usages
Modified
temp-1
c2672194b1a2abfcf00b08e9e73e6851407c3d95
Fix jedi cache error. Print processor errors.
<0>:<add> errors[err_text] = errors.get(err_text, 0) + 1
# 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, ): <s>name...
===========above chunk 0=========== # 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, ...
coeditor.encoding/TkDelta.to_change_tks
Modified
temp-1
ba5ac8335a7bc3fa47400469334a769b1be553e4
Fix TkDelta for empty inputs.
<0>:<add> f"Input is longer than delta: {len(lines)=} > {len(self.deltas)=}"
# module: coeditor.encoding @dataclass class TkDelta: def to_change_tks(self, input: TokenSeq) -> TokenSeq: + lines = split_list(input, Newline_id) if input else [] - lines = split_list(input, Newline_id) if len(lines) > len(self.deltas): + ...
===========unchanged ref 0=========== at: coeditor.common TokenSeq = list[Token] split_list(lst: list[T1], sep: T1) -> list[list[T1]] join_list(segs: Iterable[Iterable[T1]], sep: T1 | None=None) -> list[T1] print_err(*, sep: Optional[str]=..., end: Optional[str]=..., f...
spot.static_analysis/ProjectPath.pop
Modified
temp-1
2282c6c0bcb9fea8d0b3c73335181e13605c6c00
Optimize `split_dots`.
<0>:<add> p1 = ".".join(split_dots(self.path)[:-1])
# module: spot.static_analysis class ProjectPath(NamedTuple): def pop(self) -> "ProjectPath": - p1 = ".".join(self.path.split(".")[:-1]) <0> return ProjectPath(self.module, p1)
===========unchanged ref 0=========== at: spot.static_analysis ProjectPath(typename: str, fields: Iterable[Tuple[str, Any]]=..., **kwargs: Any) at: spot.static_analysis.ProjectPath module: ModuleName path: ElemPath at: spot.utils _lru_cache_wrapper(*args: Hasha...
spot.static_analysis/PythonFunction.is_test_func
Modified
temp-1
2282c6c0bcb9fea8d0b3c73335181e13605c6c00
Optimize `split_dots`.
<0>:<add> (file := split_dots(self.path.module)[-1]).startswith("test_")
# module: spot.static_analysis @dataclass class PythonFunction: @cached_property def is_test_func(self) -> bool: # follow the pytest rules (but ignore the method requirements): # https://docs.pytest.org/en/7.1.x/explanation/goodpractices.html#conventions...
===========unchanged ref 0=========== at: functools cached_property(func: Callable[[Any], _T]) at: spot.static_analysis.ProjectPath module: ModuleName at: spot.static_analysis.PythonFunction name: str path: ProjectPath parent_class: ProjectPath | N...
spot.static_analysis/to_abs_import_path
Modified
temp-1
2282c6c0bcb9fea8d0b3c73335181e13605c6c00
Optimize `split_dots`.
<0>:<add> result_segs = list(mod_segs[:-dots])
# module: spot.static_analysis def to_abs_import_path( current_mod: ModuleName, path: str, allow_implicit: bool = True, ) -> Generator[ModuleName, None, None]: """Given the current module and an import path, return the list of modules (in absolute path...
===========unchanged ref 0=========== at: spot.static_analysis ModuleName = str _lru_cache_wrapper(*args: Hashable, **kwargs: Hashable) -> _T _lru_cache_wrapper(*args: Hashable, **kwargs: Hashable) -> _T at: spot.utils _lru_cache_wrapper(*args: Hashable, **kwargs: ...
spot.static_analysis/path_up
Modified
temp-1
2282c6c0bcb9fea8d0b3c73335181e13605c6c00
Optimize `split_dots`.
<0>:<add> segs = split_dots(path)
# module: spot.static_analysis @cache def path_up(path: str) -> str: - segs = split_import_path(path) <0> return ".".join(segs[:-1])
===========unchanged ref 0=========== at: functools cache(user_function: Callable[..., _T], /) -> _lru_cache_wrapper[_T] ===========changed ref 0=========== # module: spot.static_analysis - @cache - def split_import_path(path: str): - return path.split(".") - ===========changed re...
spot.static_analysis/ModuleHierarchy.from_modules
Modified
temp-1
2282c6c0bcb9fea8d0b3c73335181e13605c6c00
Optimize `split_dots`.
<0>:<add> root.add_module(split_dots(m))
# module: spot.static_analysis class ModuleHierarchy: @staticmethod def from_modules(modules: Iterable[str]) -> "ModuleHierarchy": root = ModuleHierarchy() for m in modules: - root.add_module(split_import_path(m)) <0> return root ...
===========unchanged ref 0=========== at: spot.static_analysis ModuleName = str at: spot.static_analysis.ModuleHierarchy.from_modules root = ModuleHierarchy() at: typing Mapping = _alias(collections.abc.Mapping, 2) ===========changed ref 0=========== # module:...
spot.static_analysis/UsageAnalysis.find_class
Modified
temp-1
2282c6c0bcb9fea8d0b3c73335181e13605c6c00
Optimize `split_dots`.
<0>:<add> segs = split_dots(abs_p)
# module: spot.static_analysis class UsageAnalysis: def find_class(self, mname: ModuleName, qname: QualifiedName) -> PythonClass | None: cls_path = None match qname.source: case QualifiedNameSource.IMPORT: for abs_p in to_abs_impo...
===========unchanged ref 0=========== at: spot.static_analysis ModuleName = str ProjectPath(typename: str, fields: Iterable[Tuple[str, Any]]=..., **kwargs: Any) at: spot.static_analysis.ModuleHierarchy resolve_path(segs: Sequence[str]) -> ProjectPath | None at: spot.st...
spot.static_analysis/UsageAnalysis.generate_usages
Modified
temp-1
2282c6c0bcb9fea8d0b3c73335181e13605c6c00
Optimize `split_dots`.
<0>:<add> segs = split_dots(abs_p)
# module: spot.static_analysis class UsageAnalysis: def generate_usages( self, mname: ModuleName, caller: ProjectPath, qname: QualifiedName, parent_call: cst.Call | None, ) -> Iterable[ProjectUsage]: <s>fixture>"...
===========above chunk 0=========== # module: spot.static_analysis class UsageAnalysis: def generate_usages( self, mname: ModuleName, caller: ProjectPath, qname: QualifiedName, parent_call: cst.Call | None, ) -> Iterable[ProjectUsage]: ...
coeditor.history/_select_ast_calls
Modified
temp-1
2282c6c0bcb9fea8d0b3c73335181e13605c6c00
Optimize `split_dots`.
<0>:<add> segs = split_dots(path.path)
# module: coeditor.history def _select_ast_calls( node: ast.AST, path: ProjectPath ) -> Generator[ast.Call, None, None]: """Return all call nodes with the mathcing function name in the AST.""" - segs = path.path.split(".") <0> if segs[-1] == "__init__": ...
===========unchanged ref 0=========== at: _ast AST(*args: Any, **kwargs: Any) Call(*args: Any, **kwargs: Any) Name(*args: Any, **kwargs: Any) at: ast walk(node: AST) -> Iterator[AST] at: coeditor._utils _lru_cache_wrapper(*args: Hashable, **kwargs:...
coeditor.code_change/ChangeScope._search_scope
Modified
temp-1
2282c6c0bcb9fea8d0b3c73335181e13605c6c00
Optimize `split_dots`.
<0>:<add> segs = split_dots(path)
# module: coeditor.code_change @dataclass class ChangeScope: def _search_scope(self, path: ElemPath) -> Self: """Find the scope that can potentially contain the given path. Follow the path segments until no more subscopes are found.""" - segs = path.sp...
===========unchanged ref 0=========== at: coeditor._utils _lru_cache_wrapper(*args: Hashable, **kwargs: Hashable) -> _T at: coeditor.code_change.ChangeScope path: ProjectPath tree: ScopeTree spans: Sequence["StatementSpan"] subscopes: Mapping[str, Self...
spot.utils/get_pushover_config
Modified
temp-1
6d7e1f96fce615c099ceff3e3fc430818d70a407
Switch to frozen classes.
<0>:<add> warnings.warn(
# module: spot.utils def get_pushover_config() -> dict[str, str] | None: config_file = proj_root() / "config/pushover.json" if config_file.exists(): match json.loads(config_file.read_text()): case {"user": user, "token": token}: retur...
===========unchanged ref 0=========== at: _warnings warn(message: str, category: Optional[Type[Warning]]=..., stacklevel: int=..., source: Optional[Any]=...) -> None warn(message: Warning, category: Any=..., stacklevel: int=..., source: Optional[Any]=...) -> None at: json loads(s: U...
spot.utils/PickleCache.remove
Modified
temp-1
6d7e1f96fce615c099ceff3e3fc430818d70a407
Switch to frozen classes.
<0>:<add> warnings.warn(f"[PickleCache] File not found: '{path}'")
# module: spot.utils class PickleCache: def remove(self, rel_path: Path | str): path = self.cache_dir / rel_path if path.exists(): path.unlink() else: - logging.warning(f"[PickleCache] File not found: '{path}'") <0> ...
===========unchanged ref 0=========== at: pathlib Path() at: pathlib.Path unlink(missing_ok: bool=...) -> None exists() -> bool at: spot.utils.PickleCache.__init__ self.cache_dir = cache_dir ===========changed ref 0=========== # module: spot.utils...
spot.utils/PickleCache.clear
Modified
temp-1
6d7e1f96fce615c099ceff3e3fc430818d70a407
Switch to frozen classes.
<0>:<add> warnings.warn(f"No cache found at: {self.cache_dir}, skip clearing.")
# module: spot.utils class PickleCache: def clear(self): if self.cache_dir.exists(): logging.info(f"Clearing cache: at: {self.cache_dir}") shutil.rmtree(self.cache_dir) else: - logging.warning(f"No cache found at: {sel...
===========unchanged ref 0=========== at: logging info(msg: Any, *args: Any, exc_info: _ExcInfoType=..., stack_info: bool=..., extra: Optional[Dict[str, Any]]=..., **kwargs: Any) -> None at: pathlib.Path exists() -> bool at: shutil rmtree(path: Union[bytes, StrPath], ignore...
coeditor.retrieval_model/RetrievalEditorModel._reorder_cache
Modified
temp-1
6d7e1f96fce615c099ceff3e3fc430818d70a407
Switch to frozen classes.
<0>:<add> warnings.warn(
# module: coeditor.retrieval_model class RetrievalEditorModel(T5PreTrainedModel): def _reorder_cache(self, past, beam_idx): if past is None: - logging.warning( <0> "You might want to consider setting `use_cache=True` to speed up decoding" ...
===========unchanged ref 0=========== at: _warnings warn(message: str, category: Optional[Type[Warning]]=..., stacklevel: int=..., source: Optional[Any]=...) -> None warn(message: Warning, category: Any=..., stacklevel: int=..., source: Optional[Any]=...) -> None at: transformers.generation...
coeditor.common/normalize_code_by_ast
Modified
temp-1
c7532373c41c6d26f05afc40e4d1377108596556
Remove module docstrings when normalizing code.
<0>:<add> node = as_any(self.generic_visit(node))
# module: coeditor.common def normalize_code_by_ast( code: str, sort_keyargs: bool = True, remove_doc_string: bool = True ) -> str: """Normalize the code by parsing and unparsing it using the AST module. If parsing fails, return the original code.""" clas...
===========unchanged ref 0=========== at: _ast Module(*args: Any, **kwargs: Any) FunctionDef(*args: Any, **kwargs: Any) ClassDef(*args: Any, **kwargs: Any) Expr(*args: Any, **kwargs: Any) Call(*args: Any, **kwargs: Any) Constant(*args: Any, **...
coeditor.code_change/_deep_copy_subset_
Modified
temp-1
68df1a188774d0da509adfb2b256212eec6e146e
Fix dataset creation.
<0>:<add> keys = {k for k in keys if k in dict}
# module: coeditor.code_change def _deep_copy_subset_(dict: dict[T1, T2], keys: Collection[T1]) -> dict[T1, T2]: "This is more efficient than deepcopying each value individually if they share common data." <0> to_copy = {k: dict[k] for k in keys} copies = copy.deepcopy(to_copy) ...
===========unchanged ref 0=========== at: coeditor.common T1 = TypeVar("T1") T2 = TypeVar("T2") at: copy deepcopy(x: _T, memo: Optional[Dict[int, Any]]=..., _nil: Any=...) -> _T at: typing Collection = _alias(collections.abc.Collection, 1) ===========...
coeditor.ctx_change_encoder/C3ProblemGenerator.post_edit_analysis
Modified
temp-1
68df1a188774d0da509adfb2b256212eec6e146e
Fix dataset creation.
<0>:<add> for source in srcs:
# module: coeditor.ctx_change_encoder class C3ProblemGenerator(ProjectChangeProcessor[C3Problem]): def post_edit_analysis( self, pstate: ProjectState, modules: Mapping[RelPath, JModule], changes: Mapping[ModuleName, JModuleChange], ...
===========unchanged ref 0=========== at: coeditor.ctx_change_encoder _fast_goto(script: jedi.Script, tree_name: tree.Name, *, follow_imports=False, follow_builtin_imports=False, only_stubs=False, prefer_stubs=False) -> set[classes.Name] at: coeditor.ctx_change_encoder.C3ProblemGenerator.__init__ ...
coeditor.ctx_change_encoder/JediUsageAnalyzer.get_line_usages
Modified
temp-1
68df1a188774d0da509adfb2b256212eec6e146e
Fix dataset creation.
<0>:<add> self.add_error(err_text)
# 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, ): <s> une...
===========above chunk 0=========== # 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, ...
spot.utils/compute_line_diffs
Modified
temp-1
ab374914700355dc76b7f09d9c8121b7a6855e67
- Only editing non-function spans during training. - Add time limit to data creation. - Fix fast diff. - Handle value error in `normalize_code_by_ast`. - Add max_total_ref_tks to C3ProblemTokenizer.
<0>:<add> return compute_line_diffs_fast(before, after)
# module: spot.utils def compute_line_diffs( before: Sequence[str], after: Sequence[str], keep_explain_lines: bool = False ): SizeLimit = 8000 if ( sum(len(x) for x in before) > SizeLimit or sum(len(x) for x in after) > SizeLimit ): ...
===========unchanged ref 0=========== at: difflib Differ(linejunk: Optional[_JunkCallback]=..., charjunk: Optional[_JunkCallback]=...) at: difflib.Differ compare(a: Sequence[_StrType], b: Sequence[_StrType]) -> Iterator[_StrType] at: spot.utils compute_line_diffs_fast(befor...
coeditor.common/normalize_code_by_ast
Modified
temp-1
ab374914700355dc76b7f09d9c8121b7a6855e67
- Only editing non-function spans during training. - Add time limit to data creation. - Fix fast diff. - Handle value error in `normalize_code_by_ast`. - Add max_total_ref_tks to C3ProblemTokenizer.
<0>:<add> except (SyntaxError, ValueError):
# module: coeditor.common def normalize_code_by_ast( code: str, sort_keyargs: bool = True, remove_doc_string: bool = True ) -> str: """Normalize the code by parsing and unparsing it using the AST module. If parsing fails, return the original code.""" clas...
===========unchanged ref 0=========== at: _ast Module(*args: Any, **kwargs: Any) FunctionDef(*args: Any, **kwargs: Any) ClassDef(*args: Any, **kwargs: Any) Expr(*args: Any, **kwargs: Any) Call(*args: Any, **kwargs: Any) Constant(*args: Any, **...
coeditor.dataset/_process_commits
Modified
temp-1
ab374914700355dc76b7f09d9c8121b7a6855e67
- Only editing non-function spans during training. - Add time limit to data creation. - Fix fast diff. - Handle value error in `normalize_code_by_ast`. - Add max_total_ref_tks to C3ProblemTokenizer.
<0>:<add> warnings.warn(f"Failed to process project: {root}\nError: {e}")
# module: coeditor.dataset def _process_commits( root: Path, workdir: Path, commits: Sequence[CommitInfo], + is_training: bool, encoder: C3EditEncoder, ) -> _ProcessingResult: # use process-specific parso cache _fix_jedi_cache(workdir...
===========unchanged ref 0=========== at: coeditor.dataset C3EditEncoder(change_processor: ProjectChangeProcessor[C3Problem]=field( default_factory=C3ProblemGenerator ), edit_tokenizer: C3ProblemTokenizer=field(default_factory=C3ProblemTokenizer)) _ProcessingResult(e...
coeditor.dataset/dataset_from_projects
Modified
temp-1
ab374914700355dc76b7f09d9c8121b7a6855e67
- Only editing non-function spans during training. - Add time limit to data creation. - Fix fast diff. - Handle value error in `normalize_code_by_ast`. - Add max_total_ref_tks to C3ProblemTokenizer.
<0>:<add> for k in sorted(errors.keys(), key=lambda k: errors[k], reverse=True):
# module: coeditor.dataset def dataset_from_projects( project_roots: Sequence[Path], encoder: C3EditEncoder, repo_training: Sequence[bool], max_history_per_repo: int = 1000, workers: int = DefaultWorkers, ) -> "TokenizedEditDataset[TkC3Problem]": ...
===========above chunk 0=========== # module: coeditor.dataset def dataset_from_projects( project_roots: Sequence[Path], encoder: C3EditEncoder, repo_training: Sequence[bool], max_history_per_repo: int = 1000, workers: int = DefaultWorkers, ) -> "TokenizedEditDataset[...
coeditor.code_change/edits_from_commit_history
Modified
temp-1
ab374914700355dc76b7f09d9c8121b7a6855e67
- Only editing non-function spans during training. - Add time limit to data creation. - Fix fast diff. - Handle value error in `normalize_code_by_ast`. - Add max_total_ref_tks to C3ProblemTokenizer.
<0>:<add> time_limit=time_limit,
# module: coeditor.code_change def edits_from_commit_history( project_dir: Path, history: Sequence[CommitInfo], tempdir: Path, change_processor: ProjectChangeProcessor[TProb] = NoProcessing(), edit_encoder: Callable[[TProb], Iterable[TEnc]] = lambda x: [x], ...
===========unchanged ref 0=========== at: coeditor.code_change DefaultIgnoreDirs = {".venv", ".mypy_cache", ".git", "venv", "build"} JProjectChange(changed: Mapping[ModuleName, JModuleChange], all_modules: Modified[Collection[JModule]], commit_info: "CommitInfo | None") TProb = Typ...
coeditor.ctx_change_encoder/C3ProblemGenerator.__init__
Modified
temp-1
ab374914700355dc76b7f09d9c8121b7a6855e67
- Only editing non-function spans during training. - Add time limit to data creation. - Fix fast diff. - Handle value error in `normalize_code_by_ast`. - Add max_total_ref_tks to C3ProblemTokenizer.
<0>:<add> self._is_training: bool = False
# module: coeditor.ctx_change_encoder class C3ProblemGenerator(ProjectChangeProcessor[C3Problem]): def __init__(self, analyzer: "JediUsageAnalyzer | None" = None): if analyzer is None: analyzer = JediUsageAnalyzer() + self.analyzer = analyzer ...
===========unchanged ref 0=========== at: coeditor.ctx_change_encoder JediUsageAnalyzer() at: coeditor.ctx_change_encoder.C3ProblemGenerator VERSION = "1.1" ===========changed ref 0=========== # module: coeditor.ctx_change_encoder class C3ProblemGenerator(ProjectChangeProc...
coeditor.ctx_change_encoder/C3ProblemGenerator.process_change
Modified
temp-1
ab374914700355dc76b7f09d9c8121b7a6855e67
- Only editing non-function spans during training. - Add time limit to data creation. - Fix fast diff. - Handle value error in `normalize_code_by_ast`. - Add max_total_ref_tks to C3ProblemTokenizer.
<0>:<add> if should_mk_problem:
# module: coeditor.ctx_change_encoder class C3ProblemGenerator(ProjectChangeProcessor[C3Problem]): def process_change( self, pchange: JProjectChange, mod2usages: Mapping[ModuleName, LineUsageAnalysis], module_order: Sequence[ModuleName], ...
===========above chunk 0=========== # module: coeditor.ctx_change_encoder class C3ProblemGenerator(ProjectChangeProcessor[C3Problem]): def process_change( self, pchange: JProjectChange, mod2usages: Mapping[ModuleName, LineUsageAnalysis], module_order: Sequ...
coeditor.dataset/_process_commits
Modified
temp-1
ec882028fee3333b952c7e20e8051e7a58402a6d
Switch to TkC3Problem in retrieval model code.
<0>:<add> traceback.print_exception(e, limit=-6)
# module: coeditor.dataset def _process_commits( root: Path, workdir: Path, commits: Sequence[CommitInfo], is_training: bool, encoder: C3EditEncoder, ) -> _ProcessingResult: # use process-specific parso cache _fix_jedi_cache(workdir...
===========unchanged ref 0=========== at: _warnings warn(message: str, category: Optional[Type[Warning]]=..., stacklevel: int=..., source: Optional[Any]=...) -> None warn(message: Warning, category: Any=..., stacklevel: int=..., source: Optional[Any]=...) -> None at: coeditor.dataset ...
coeditor.dataset/dataset_from_projects
Modified
temp-1
ec882028fee3333b952c7e20e8051e7a58402a6d
Switch to TkC3Problem in retrieval model code.
<0>:<add> history_chunk_size = max(50, math.ceil(len(h) / 10))
# module: coeditor.dataset def dataset_from_projects( project_roots: Sequence[Path], encoder: C3EditEncoder, repo_training: Sequence[bool], max_history_per_repo: int = 1000, workers: int = DefaultWorkers, ) -> "TokenizedEditDataset[TkC3Problem]": ...
===========above chunk 0=========== # module: coeditor.dataset def dataset_from_projects( project_roots: Sequence[Path], encoder: C3EditEncoder, repo_training: Sequence[bool], max_history_per_repo: int = 1000, workers: int = DefaultWorkers, ) -> "TokenizedEditDataset[...
coeditor.retrieval_model/_BatchSampler.estimate_n_batches
Modified
temp-1
ec882028fee3333b952c7e20e8051e7a58402a6d
Switch to TkC3Problem in retrieval model code.
<0>:<add> batches = tk_edits_to_batches(self.all_edits, self.batch_args, silent=True)
# module: coeditor.retrieval_model @dataclass class _BatchSampler: def estimate_n_batches(self) -> int: - batches = query_edits_to_batches(self.all_edits, self.batch_args, silent=True) <0> return len(batches)
===========unchanged ref 0=========== at: coeditor.retrieval_model.pad_token_seqs max_len = max(len(ref) for ref in seqs) pad_id = PAD_id ===========changed ref 0=========== # module: coeditor.retrieval_model @dataclass class _BatchSampler: + all_edits: list[TkC3Prob...
coeditor.retrieval_model/_BatchSampler.__iter__
Modified
temp-1
ec882028fee3333b952c7e20e8051e7a58402a6d
Switch to TkC3Problem in retrieval model code.
<0>:<add> batches = tk_edits_to_batches(self.all_edits, self.batch_args)
# module: coeditor.retrieval_model @dataclass class _BatchSampler: def __iter__(self) -> Iterable[Mapping]: if self.shuffle: random.shuffle(self.all_edits) - batches = query_edits_to_batches(self.all_edits, self.batch_args) <0> if self.sh...
===========unchanged ref 0=========== at: coeditor.retrieval_model.pad_token_seqs rows = [] at: math ceil(x: SupportsFloat, /) -> int ===========changed ref 0=========== # module: coeditor.retrieval_model @dataclass class _BatchSampler: def estimate_n_batches(s...
coeditor.api/EditPredictionService.suggest_edit
Modified
temp-1
ec882028fee3333b952c7e20e8051e7a58402a6d
Switch to TkC3Problem in retrieval model code.
<0>:<add> batches = tk_edits_to_batches(qedits, self.batch_args)
# module: coeditor.api @dataclass class EditPredictionService: def suggest_edit( self, file: Path, line: int, log_dir: Path | None = Path(".coeditor_logs"), ) -> ServiceResponse: <s> elem_change = Modified(trans_elem, tr...
===========above chunk 0=========== # module: coeditor.api @dataclass class EditPredictionService: def suggest_edit( self, file: Path, line: int, log_dir: Path | None = Path(".coeditor_logs"), ) -> ServiceResponse: # offset: -1 <s> ...
coeditor.api/EditPredictionService.apply_edit_to_elem
Modified
temp-1
ec882028fee3333b952c7e20e8051e7a58402a6d
Switch to TkC3Problem in retrieval model code.
<0>:<add> new_change = new_change.map(lambda s: s.strip("\n"))
# module: coeditor.api @dataclass class EditPredictionService: def apply_edit_to_elem( self, file: Path, now_mod: PythonModule, now_elem: PythonElem, cursor_line: int, out_tks: TokenSeq, ) -> tuple[...
===========above chunk 0=========== # module: coeditor.api @dataclass class EditPredictionService: def apply_edit_to_elem( self, file: Path, now_mod: PythonModule, now_elem: PythonElem, cursor_line: int, out_tks: TokenSeq, ...
coeditor.retrieval_model/BatchArgs.eval_default
Modified
temp-1
18bed1bae904b1d484977a957aa4477ec2128c00
Training parameter adjustment.
<0>:<add> max_total_ref_tks=512 * 24,
# module: coeditor.retrieval_model @dataclass class BatchArgs: @classmethod def eval_default(cls) -> Self: return BatchArgs( - max_total_ref_tks=512 * 32, <0> max_queries=32, shuffle_extra_ids=False, ) ...
===========unchanged ref 0=========== at: coeditor.retrieval_model BatchArgs(max_output_tks: int=256, max_query_tks: int=512, min_queires: int=1, max_queries: int=8, max_ref_tks: int=512, max_total_ref_tks: int=512 * 12, shuffle_extra_ids: bool=True) at: coeditor.retrieval_model.BatchArgs m...
scripts.coeditor.train_retrieval_model/train_model
Modified
temp-1
18bed1bae904b1d484977a957aa4477ec2128c00
Training parameter adjustment.
<0>:<add> warmup_bargs.max_total_ref_tks //= 3
# module: scripts.coeditor.train_retrieval_model def train_model( dataset_name="medium", model_variant="-sig-analysis-post_usees", encoder: C3EditEncoder = C3EditEncoder(), batch_args=BatchArgs.train_default(), test_batch_args=BatchArgs.eval_default(), ...
===========above chunk 0=========== # module: scripts.coeditor.train_retrieval_model def train_model( dataset_name="medium", model_variant="-sig-analysis-post_usees", encoder: C3EditEncoder = C3EditEncoder(), batch_args=BatchArgs.train_default(), test_batch_args=BatchArgs...
coeditor.ctx_change_encoder/C3ProblemTokenizer.tokenize_problem
Modified
temp-1
f0a4cab073846109c9b3083f25a99bd2bde88b3a
Make C3Problem more suitable for serialization.
<0>:<add> path=span.headers[-1].path,
# module: coeditor.ctx_change_encoder @dataclass class C3ProblemTokenizer: def tokenize_problem( self, problem: C3Problem, ) -> Sequence[TkC3Problem]: <s>chunk_overlap, ) above_chunks = [ ...
===========above chunk 0=========== # module: coeditor.ctx_change_encoder @dataclass class C3ProblemTokenizer: def tokenize_problem( self, problem: C3Problem, ) -> Sequence[TkC3Problem]: # offset: -1 <s> get_problem(chunk_input, chunk_output): ...
coeditor.ctx_change_encoder/C3ProblemTokenizer._encode_change
Modified
temp-1
f0a4cab073846109c9b3083f25a99bd2bde88b3a
Make C3Problem more suitable for serialization.
<0>:<add> self._change_cache[change] = change_tks
# module: coeditor.ctx_change_encoder @dataclass class C3ProblemTokenizer: def _encode_change(self, change: Change[str]) -> TokenSeq: - if (key := _ObjId(id(change))) in self._id_cache: - return self._id_cache[key] - change = change.map(lambda s: s.str...
===========unchanged ref 0=========== at: coeditor.common TokenSeq = list[Token] at: coeditor.ctx_change_encoder ChangedHeader(change: Change[str], type: str, line_range: LineRange, path: ProjectPath) at: coeditor.ctx_change_encoder.C3ProblemTokenizer max_scope_tks: int = 1...
coeditor.ctx_change_encoder/C3ProblemTokenizer._group_encode_changed_refs
Modified
temp-1
f0a4cab073846109c9b3083f25a99bd2bde88b3a
Make C3Problem more suitable for serialization.
<0>:<add> lambda i: self._encode_headers(mod_change, i),
# module: coeditor.ctx_change_encoder @dataclass class C3ProblemTokenizer: def _group_encode_changed_refs( + self, changes: Sequence[ChangedCodeSpan] - self, changes: Sequence[ChangedSpan] ) -> Sequence[TokenSeq]: <s> header_diff = list[ChangedHeader](...
===========above chunk 0=========== # module: coeditor.ctx_change_encoder @dataclass class C3ProblemTokenizer: def _group_encode_changed_refs( + self, changes: Sequence[ChangedCodeSpan] - self, changes: Sequence[ChangedSpan] ) -> Sequence[TokenSeq]: # offset: -1 + ...
spot.utils/pmap
Modified
temp-1
2e823493b40c36c3f449ba3571e2fa26454e3493
Update datasets creation pipeline.
<0>:<add> desc = "pmap: " + f.__name__
# module: spot.utils def pmap( f: Callable[..., T1], *f_args: Any, + desc: str | None = None, - desc: str = "parallel map", key_args: Mapping[str, Any] | None = None, max_workers: int | None = None, chunksize: int | None = None, tqd...
===========unchanged ref 0=========== at: multiprocessing Pool(processes: Optional[int]=..., initializer: Optional[Callable[..., Any]]=..., initargs: Iterable[Any]=..., maxtasksperchild: Optional[int]=...) -> pool.Pool at: spot.utils T1 = TypeVar("T1") DefaultWorkers: int = mul...
coeditor.dataset/TokenizedEditDataset.__repr__
Modified
temp-1
2e823493b40c36c3f449ba3571e2fa26454e3493
Update datasets creation pipeline.
<0>:<add> return f"TokenizedEditDataset(n_edits={n_edits})"
# module: coeditor.dataset @dataclass class TokenizedEditDataset(Generic[TEdit]): def __repr__(self) -> str: - n_projects = len(self.project2edits) - n_edits = sum(len(edits) for edits in self.project2edits.values()) + n_edits = len(self.all_edits()) -...
===========unchanged ref 0=========== at: coeditor.dataset.TokenizedEditDataset _edits: list[TEdit] all_edits() -> list[TEdit] all_edits(self) -> list[TEdit] ===========changed ref 0=========== # module: coeditor.dataset @dataclass class TokenizedEditDataset(Generi...
coeditor.dataset/TokenizedEditDataset.all_edits
Modified
temp-1
2e823493b40c36c3f449ba3571e2fa26454e3493
Update datasets creation pipeline.
<0>:<add> return self._edits
# module: coeditor.dataset @dataclass class TokenizedEditDataset(Generic[TEdit]): def all_edits(self) -> list[TEdit]: - return join_list(self.project2edits.values()) <0>
===========unchanged ref 0=========== at: dataclasses field(*, init: bool=..., repr: bool=..., hash: Optional[bool]=..., compare: bool=..., metadata: Optional[Mapping[str, Any]]=...) -> Any field(*, default_factory: Callable[[], _T], init: bool=..., repr: bool=..., hash: Optional[bool]=..., compare:...
coeditor.dataset/TokenizedEditDataset.from_edits
Modified
temp-1
2e823493b40c36c3f449ba3571e2fa26454e3493
Update datasets creation pipeline.
<0>:<add> return TokenizedEditDataset(list(edits))
# module: coeditor.dataset @dataclass class TokenizedEditDataset(Generic[TEdit]): @staticmethod - def from_edits( - edits: Iterable[TEdit], path=Path("all") - ) -> "TokenizedEditDataset[TEdit]": + def from_edits(edits: Iterable[TEdit]) -> "TokenizedEditDat...
===========unchanged ref 0=========== at: dataclasses dataclass(_cls: Type[_T]) -> Type[_T] dataclass(*, init: bool=..., repr: bool=..., eq: bool=..., order: bool=..., unsafe_hash: bool=..., frozen: bool=...) -> Callable[[Type[_T]], Type[_T]] dataclass(_cls: None) -> Callable[[Type[_T]], Typ...
coeditor.dataset/_process_commits
Modified
temp-1
2e823493b40c36c3f449ba3571e2fa26454e3493
Update datasets creation pipeline.
<0>:<add> change_processor.append_stats(stats)
# module: coeditor.dataset def _process_commits( root: Path, workdir: Path, commits: Sequence[CommitInfo], is_training: bool, + change_processor: ProjectChangeProcessor[C3Problem], - encoder: C3EditEncoder, ) -> _ProcessingResult: # use...
===========unchanged ref 0=========== at: _warnings warn(message: str, category: Optional[Type[Warning]]=..., stacklevel: int=..., source: Optional[Any]=...) -> None warn(message: Warning, category: Any=..., stacklevel: int=..., source: Optional[Any]=...) -> None at: coeditor._utils ...
coeditor.dataset/dataset_from_projects
Modified
temp-1
2e823493b40c36c3f449ba3571e2fa26454e3493
Update datasets creation pipeline.
<0>:<add> return project2edits
# module: coeditor.dataset def dataset_from_projects( project_roots: Sequence[Path], + change_processor: ProjectChangeProcessor[C3Problem], - encoder: C3EditEncoder, repo_training: Sequence[bool], max_history_per_repo: int = 1000, workers: int = Defaul...
===========above chunk 0=========== # module: coeditor.dataset def dataset_from_projects( project_roots: Sequence[Path], + change_processor: ProjectChangeProcessor[C3Problem], - encoder: C3EditEncoder, repo_training: Sequence[bool], max_history_per_repo: int = 1000, w...
coeditor.dataset/datasets_from_repos
Modified
temp-1
2e823493b40c36c3f449ba3571e2fa26454e3493
Update datasets creation pipeline.
<0>:<add> return {k: join_list(dataset[r] for r in repos) for k, repos in projects.items()}
# module: coeditor.dataset def datasets_from_repos( repos_root: Path, + change_processor: ProjectChangeProcessor[C3Problem], - encoder: C3EditEncoder, max_history_per_repo: int = 1000, workers: int = DefaultWorkers, + ) -> Mapping[str, Sequence[C3Problem]]: ...
===========unchanged ref 0=========== at: _warnings warn(message: str, category: Optional[Type[Warning]]=..., stacklevel: int=..., source: Optional[Any]=...) -> None warn(message: Warning, category: Any=..., stacklevel: int=..., source: Optional[Any]=...) -> None at: coeditor._utils ...
coeditor.ctx_change_encoder/C3ProblemTokenizer.tokenize_problem
Modified
temp-1
2e823493b40c36c3f449ba3571e2fa26454e3493
Update datasets creation pipeline.
<0>:<add> named_references=all_refs,
# module: coeditor.ctx_change_encoder @dataclass class C3ProblemTokenizer: def tokenize_problem( self, problem: C3Problem, ) -> Sequence[TkC3Problem]: <s>) for i, chunk in enumerate(above_chunks) ] below_chunks =...
===========above chunk 0=========== # module: coeditor.ctx_change_encoder @dataclass class C3ProblemTokenizer: def tokenize_problem( self, problem: C3Problem, ) -> Sequence[TkC3Problem]: # offset: -1 <s> chunk_output = TokenSeq() prev_c...
coeditor.code_change/ChangeScope.from_tree
Modified
temp-1
f106fd266a6e09194f46b8cad8930f3f0978a011
Fix missing spans.
<0>:<add> if isinstance(container, BaseNode):
# 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) ...
===========below chunk 0=========== # module: coeditor.code_change @dataclass class ChangeScope: @staticmethod def from_tree(path: ProjectPath, tree: ScopeTree) -> "ChangeScope": # offset: 1 <s> = path.append(name) subscope = ChangeScope.from_tree(spath, stree) ...
coeditor.encoding/get_extra_id
Modified
temp-1
0a557eb3eef82b76ad61c98704f8bfdf960a3ca1
Improve encoder performance.
<0>:<add> return _min_extra_id + (N_Extra_Ids - 1 - i)
# module: coeditor.encoding def get_extra_id(i: int) -> int: assert 0 <= i < N_Extra_Ids - return _Tokenizer.additional_special_tokens_ids[N_Extra_Ids - 1 - i] <0>
===========unchanged ref 0=========== at: coeditor.encoding N_Extra_Ids = 100 _min_extra_id = _Tokenizer.additional_special_tokens_ids[0]
coeditor.encoding/change_to_tokens
Modified
temp-1
0a557eb3eef82b76ad61c98704f8bfdf960a3ca1
Improve encoder performance.
<0>:<add> raise AssertionError(f"Not a change type: {change}")
# module: coeditor.encoding def change_to_tokens(change: Change[str]) -> TokenSeq: + match change: + case Modified(before=before, after=after, unchanged=unchanged): + if unchanged or before == after: + return encode_basic(before) + else...
===========unchanged ref 0=========== at: coeditor.common TokenSeq = list[Token] ===========changed ref 0=========== # module: coeditor.encoding def get_extra_id(i: int) -> int: assert 0 <= i < N_Extra_Ids + return _min_extra_id + (N_Extra_Ids - 1 - i) - return _Tokeniz...