Skip to content

Commit

Permalink
Fix tail exception when from_line=None (#615)
Browse files Browse the repository at this point in the history
  • Loading branch information
Innixma authored Apr 4, 2024
1 parent 728d651 commit 85b530a
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions amlb/utils/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -361,7 +361,7 @@ def head(s, lines=10, splitlines=False):

def tail(s, lines=10, from_line=None, include_line=True, splitlines=False):
if s is None:
return None if from_line is None else None, None
return None, None

s_lines = s.splitlines()
start = -lines
Expand All @@ -380,7 +380,7 @@ def tail(s, lines=10, from_line=None, include_line=True, splitlines=False):
line=s_lines[-1] if len(s_lines) > 0 else None)
s_lines = s_lines[start:]
t = s_lines if splitlines else '\n'.join(s_lines)
return t if from_line is None else (t, last_line)
return (t, None) if from_line is None else (t, last_line)


def fn_name(fn):
Expand Down

0 comments on commit 85b530a

Please sign in to comment.