Skip to content

Commit

Permalink
Merge pull request #264 from Erotemic/rebased-normpath-comparison
Browse files Browse the repository at this point in the history
Rebased normpath comparison
  • Loading branch information
Erotemic authored Apr 28, 2024
2 parents d9d9ad1 + d4a3e1c commit c715356
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions line_profiler/line_profiler.py
Original file line number Diff line number Diff line change
Expand Up @@ -220,10 +220,12 @@ def add_module(self, mod):
def is_ipython_kernel_cell(filename):
""" Return True if a filename corresponds to a Jupyter Notebook cell
"""
filename = os.path.normcase(filename)
temp_dir = os.path.normcase(tempfile.gettempdir())
return (
filename.startswith('<ipython-input-') or
filename.startswith(os.path.join(tempfile.gettempdir(), 'ipykernel_')) or
filename.startswith(os.path.join(tempfile.gettempdir(), 'xpython_'))
filename.startswith(os.path.join(temp_dir, 'ipykernel_')) or
filename.startswith(os.path.join(temp_dir, 'xpython_'))
)


Expand Down

0 comments on commit c715356

Please sign in to comment.