Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 16 additions & 6 deletions IPython/core/magics/execution.py
Original file line number Diff line number Diff line change
Expand Up @@ -1568,12 +1568,22 @@ def code_wrap(self, line, cell=None):

def parse_breakpoint(text, current_file):
'''Returns (file, line) for file:line and (current_file, line) for line'''
colon = text.find(':')
if colon == -1:
return current_file, int(text)
else:
return text[:colon], int(text[colon+1:])

text = text.strip("'").strip('"')
token = text.split(':')
reg = re.compile(r"[^\d]")
if len(token) == 1 or len(token) == 0:
num = reg.sub("", text)
return (current_file, int(text))
elif len(token) == 2:
colon = text.find(':')
num = (reg.sub("", text[colon+1:]))
return text[:colon], int(num)
elif len(token) == 3:
num = reg.sub("", token[2])
return (':'.join(token[:2]), int(num))
elif len(token) > 3:
raise Exception("More than 2 colons in text")

def _format_time(timespan, precision=3):
"""Formats the timespan in a human readable form"""

Expand Down