From feb6788b9f9f727fed03bf9707727bdd9e5792ce Mon Sep 17 00:00:00 2001
From: Kip Yin <28321392+kipyin@users.noreply.github.com>
Date: Mon, 4 Feb 2019 17:19:31 +0800
Subject: [PATCH] Exit the generator for Python 3.7 and up

---
 pokedex/db/translations.py | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/pokedex/db/translations.py b/pokedex/db/translations.py
index 8f55473..35c5208 100755
--- a/pokedex/db/translations.py
+++ b/pokedex/db/translations.py
@@ -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: