Skip to content

Commit

Permalink
Handle comments
Browse files Browse the repository at this point in the history
  • Loading branch information
elazarg committed Jun 29, 2023
1 parent aa6b925 commit ec8e3a2
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
3 changes: 2 additions & 1 deletion examples/tmp.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@ def func3():
def func4():
pass
func5()
func3()
:return:
"""
# func3()
pass
3 changes: 3 additions & 0 deletions uncalled/regex_finder.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@


def prepare(txt: str) -> str:
# this is a hack to remove comments. It may remove too much, but rarely
txt = re.sub(r'#[^\r\n]*', '', txt)

return re.sub(r'"""[^\r]*?"""' + r"|'''[^\r]*?'''", '...', txt)


Expand Down

0 comments on commit ec8e3a2

Please sign in to comment.