Skip to content

Commit dd9177a

Browse files
stevenjkingMHendricks
authored andcommitted
fix max to be compatibele with Python 2.7
1 parent ffe7b22 commit dd9177a

1 file changed

Lines changed: 5 additions & 4 deletions

File tree

Qt.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2153,10 +2153,11 @@ def parse(line):
21532153
qt_compat_imported = any("from Qt import QtCompat" in line for line in parsed)
21542154

21552155
if not qt_compat_imported:
2156-
last_qt_import_line = max(
2157-
(i for i, line in enumerate(parsed) if line.startswith("from Qt")),
2158-
default=0
2159-
)
2156+
try:
2157+
last_qt_import_line = max(
2158+
i for i, line in enumerate(parsed) if line.startswith("from Qt"))
2159+
except ValueError:
2160+
last_qt_import_line = 0
21602161
parsed.insert(last_qt_import_line + 1, "from Qt import QtCompat\n")
21612162

21622163

0 commit comments

Comments
 (0)