Skip to content

Instantly share code, notes, and snippets.

@chtenb
Created June 8, 2016 10:04
Show Gist options
  • Select an option

  • Save chtenb/0c804418d32745f5e088edc093bc104e to your computer and use it in GitHub Desktop.

Select an option

Save chtenb/0c804418d32745f5e088edc093bc104e to your computer and use it in GitHub Desktop.

Revisions

  1. chtenb created this gist Jun 8, 2016.
    22 changes: 22 additions & 0 deletions fix_conversion_constructors.py
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,22 @@
    import re
    from shellout import get, out

    errors = get('cat errors.txt')

    # Fix missing explicit keyword using vim
    # Where explicit.vim contains:
    # exe "normal 0wiexplicit \<esc>"
    # wq

    try:
    regex = re.compile(r'\[(?P<filename>[^:]+):(?P<linenumber>\d+)')
    matches = regex.findall(errors)
    for match in matches:
    d = match.groupdict()
    filename = d['filename']
    linenumber = d['linenumber']
    print(filename, linenumber)
    out(r'vim -T dumb -N -u NONE +{} -c "set nomore" -S explicit.vim "{}"',
    linenumber, filename, verbose=True)
    finally:
    out('clear')