Skip to content

Commit

Permalink
Improved transformation extraction performance and added support for …
Browse files Browse the repository at this point in the history
…insertion points (#41)

* added kaskara-backed insert statement transformation

* implemented basic should_insert_at_location for insert statements

* added FileLineSet to core module

* implemented elegant way of lazily computing rooibos transformations

* added all_single_edit_patches helper to generator module

* bug fix: bad return type

* moved all_single_edit_patches to candidate module

* bug fix: added all_single_edit_patches to __all__

* added first implementation of sample_by_localization_and_type

* bug fix: use FileLineSet.from_iter as builder

* use bugzoo v2.1.14

* bug fix: use loop in sample_by_localization_and_type

* bug fix: incorrect handling of exhausted lines

* removed generator module

* require boggart 0.1.12

* suppress erroneous type warning

* increased version to 0.1.10
  • Loading branch information
ChrisTimperley authored Jul 8, 2018
1 parent afb9195 commit 789c846
Show file tree
Hide file tree
Showing 6 changed files with 351 additions and 496 deletions.
4 changes: 2 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@
license='mit',
python_requires='>=3.5',
install_requires=[
'bugzoo>=2.1.12',
'bugzoo>=2.1.14',
'rooibos>=0.3.0',
'boggart>=0.1.8',
'boggart>=0.1.12',
'kaskara>=0.0.1',
'attrs>=17.2.0',
'requests',
Expand Down
14 changes: 12 additions & 2 deletions src/darjeeling/candidate.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
__all__ = ['Candidate']
__all__ = ['Candidate', 'all_single_edit_patches']

from typing import List, Iterator, Dict, FrozenSet
from typing import List, Iterator, Dict, FrozenSet, Iterable

import attr
from bugzoo.core.patch import Patch
Expand Down Expand Up @@ -44,3 +44,13 @@ def lines_changed(self, problem: Problem) -> List[FileLine]:
lines = [FileLine(loc.filename, loc.start.line)
for loc in locations]
return lines


def all_single_edit_patches(transformations: Iterable[Transformation]
) -> Iterable[Candidate]:
"""
Returns an iterator over all of the single-edit patches that can be
composed using a provided source of transformations.
"""
for t in transformations:
yield Candidate([t]) # type: ignore
2 changes: 1 addition & 1 deletion src/darjeeling/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@

from boggart.core.replacement import Replacement
from boggart.core.location import FileLocationRange, FileLine, Location, \
LocationRange, FileLocation
LocationRange, FileLocation, FileLineSet
Loading

0 comments on commit 789c846

Please sign in to comment.