Last active
July 12, 2019 03:14
-
-
Save lihuanshuai/755e10a2e7e22fce64781903933b3ffb to your computer and use it in GitHub Desktop.
script for fixing python problem
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import re | |
regex = re.compile(r'\\(\d+)' | |
def repl(m): | |
return r'\x' + hex(int(m.group(1), 8)).replace('0x', r'').zfill(2) | |
lines = vscode.editor.lines | |
lines = [line.decode() for line in lines] | |
lines = [regex.sub(repl, line) for line in lines] | |
text = '\n'.join(lines) | |
vscode.editor.text = text.encode() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
pylint $file | grep "undefined-variable" | sed "s/.* Undefined variable \'\([_A-Za-z0-9]\{1,\}\)\'.*/\1,/" | sort | uniq |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment