mirror of
https://github.com/veekun/pokedex.git
synced 2024-08-20 18:16:34 +00:00
Exit the generator for Python 3.7 and up
This commit is contained in:
parent
efd05a4754
commit
feb6788b9f
1 changed files with 8 additions and 1 deletions
|
@ -28,6 +28,7 @@ import csv
|
|||
import io
|
||||
import os
|
||||
import re
|
||||
import sys
|
||||
from collections import defaultdict
|
||||
|
||||
import six
|
||||
|
@ -377,7 +378,13 @@ def group_by_object(stream):
|
|||
Yields ((class name, object ID), (list of messages)) pairs.
|
||||
"""
|
||||
stream = iter(stream)
|
||||
current = next(stream)
|
||||
try:
|
||||
current = next(stream)
|
||||
except StopIteration:
|
||||
if sys.version_info >= (3, 7):
|
||||
return
|
||||
else:
|
||||
raise StopIteration
|
||||
current_key = current.cls, current.id
|
||||
group = [current]
|
||||
for message in stream:
|
||||
|
|
Loading…
Add table
Reference in a new issue