Skip to content

Commit

Permalink
fix Python < 3.10
Browse files Browse the repository at this point in the history
  • Loading branch information
uraniumanchor committed Dec 4, 2023
1 parent 3371ed6 commit c89048d
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion tracker/models/event.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,19 @@
from .fields import TimestampField
from .util import LatestEvent

# TODO: remove when 3.10 is oldest supported version

try:
from itertools import pairwise
except ImportError:

def pairwise(iterable):
# pairwise('ABCDEFG') --> AB BC CD DE EF FG
a, b = itertools.tee(iterable)
next(b, None)
return zip(a, b)


__all__ = [
'Event',
'PostbackURL',
Expand Down Expand Up @@ -547,7 +560,7 @@ def clean(self):
'order': 'Next anchor in the order would occur before this one'
}
)
for c, n in itertools.pairwise(
for c, n in pairwise(
itertools.chain(
[self],
SpeedRun.objects.filter(
Expand Down

0 comments on commit c89048d

Please sign in to comment.