Skip to content

Instantly share code, notes, and snippets.

@rsyring
Created March 13, 2014 01:50
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rsyring/9520549 to your computer and use it in GitHub Desktop.
Save rsyring/9520549 to your computer and use it in GitHub Desktop.
parse python source for comments
def test_noqa_lines(codeString):
g = tokenize.generate_tokens(StringIO(codeString).readline) # tokenize the string
for toknum, tokval, srow, _, _ in g:
if toknum == N_TOKENS:
pass # do something
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment