From 2ba4c5850a0679db9d3aa3bd02fe45a2560858d6 Mon Sep 17 00:00:00 2001 From: Tanner Prestegard <tanner.prestegard@ligo.org> Date: Thu, 18 Jul 2019 13:51:43 -0500 Subject: [PATCH] Import 'reduce' for Python 3 --- gracedb/alerts/recipients.py | 5 +++++ gracedb/api/tests/utils.py | 4 ++++ gracedb/search/query/events.py | 4 ++++ 3 files changed, 13 insertions(+) diff --git a/gracedb/alerts/recipients.py b/gracedb/alerts/recipients.py index 43f9356fe..18f6b7081 100644 --- a/gracedb/alerts/recipients.py +++ b/gracedb/alerts/recipients.py @@ -1,3 +1,8 @@ +try: + from functools import reduce +except ImportError: # python < 3 + pass + from django.conf import settings from django.db.models import Q diff --git a/gracedb/api/tests/utils.py b/gracedb/api/tests/utils.py index 872a333e0..014902207 100644 --- a/gracedb/api/tests/utils.py +++ b/gracedb/api/tests/utils.py @@ -1,4 +1,8 @@ from copy import deepcopy +try: + from functools import reduce +except ImportError: # python < 3 + pass try: from unittest import mock except ImportError: # python < 3 diff --git a/gracedb/search/query/events.py b/gracedb/search/query/events.py index 6644bb4ca..0db5f7b44 100644 --- a/gracedb/search/query/events.py +++ b/gracedb/search/query/events.py @@ -15,6 +15,10 @@ from pyparsing import Word, nums, Literal, CaselessLiteral, delimitedList, \ oneOf, stringStart, stringEnd, FollowedBy, ParseResults, ParseException, \ CaselessKeyword import pytz +try: + from functools import reduce +except ImportError: # python < 3 + pass from django.db.models import Q from django.db.models.query import QuerySet -- GitLab