diff --git a/lib/source_code.py b/lib/source_code.py index 9edef30..0b8867d 100644 --- a/lib/source_code.py +++ b/lib/source_code.py @@ -20,7 +20,7 @@ def get_source_code(func, strip_comments=False): if strip_comments: # TODO: less fragile way to do this (tokenizer sadly inserts whitespaces all around) comment_pattern = re.compile('^(\s.*)#.*$') - source = ''.join(( + source = ''.join( line for line in StringIO(source).readlines() if re.match(comment_pattern, line) is None - )) + ) return source