Skip to content

Commit

Permalink
Add fix for the error found by hypothesis
Browse files Browse the repository at this point in the history
  • Loading branch information
bp72 committed Dec 12, 2023
1 parent 5849ec2 commit ee8d87f
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion isort/parse.py
Original file line number Diff line number Diff line change
Expand Up @@ -519,7 +519,11 @@ def file_contents(contents: str, config: Config = DEFAULT_CONFIG) -> ParsedConte
if comments and attach_comments_to is not None:
attach_comments_to.extend(comments)

if "," in import_string.split(just_imports[-1])[-1]:
if (
just_imports
and just_imports[-1]
and "," in import_string.split(just_imports[-1])[-1]
):
trailing_commas.add(import_from)
else:
if comments and attach_comments_to is not None:
Expand Down

0 comments on commit ee8d87f

Please sign in to comment.