Skip to content

Commit 7abed61

Browse files
authored
Merge pull request #864 from RDFLib/python-3.7
3.7 for travis
2 parents a7c7ebe + 58c45d6 commit 7abed61

File tree

5 files changed

+13
-17
lines changed

5 files changed

+13
-17
lines changed

.travis.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,12 @@ python:
1515
- 3.5
1616
- 3.6
1717

18+
matrix:
19+
include:
20+
- python: 3.7
21+
dist: xenial
22+
sudo: true
23+
1824
before_install:
1925
- pip install -U setuptools pip # seems travis comes with a too old setuptools for html5lib
2026
- bash .travis.fuseki_install_optional.sh

docs/developers.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ If you make a pull-request to RDFLib on GitHub, travis will automatically test y
5656
Compatibility
5757
-------------
5858

59-
RDFLib>=5.0.0 tries to be compatible with python versions 2.7, 3.5, 3.6.
59+
RDFLib>=5.0.0 tries to be compatible with python versions 2.7, 3.5, 3.6, 3.7.
6060

6161

6262
Releasing

rdflib/plugins/sparql/evaluate.py

Lines changed: 3 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
"""
1616

1717
import collections
18+
import itertools
1819

1920
from rdflib import Variable, Graph, BNode, URIRef, Literal
2021
from six import iteritems, itervalues
@@ -321,22 +322,9 @@ def evalOrderBy(ctx, part):
321322

322323

323324
def evalSlice(ctx, slice):
324-
# import pdb; pdb.set_trace()
325325
res = evalPart(ctx, slice.p)
326-
i = 0
327-
while i < slice.start:
328-
next(res)
329-
i += 1
330-
i = 0
331-
for x in res:
332-
i += 1
333-
if slice.length is None:
334-
yield x
335-
else:
336-
if i <= slice.length:
337-
yield x
338-
else:
339-
break
326+
327+
return itertools.islice(res, slice.start, slice.start+slice.length if slice.length is not None else None)
340328

341329

342330
def evalReduced(ctx, part):

rdflib/query.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
from __future__ import print_function
44

55
import os
6+
import itertools
67
import shutil
78
import tempfile
89
import warnings
@@ -185,7 +186,7 @@ def _get_bindings(self):
185186
return self._bindings
186187

187188
def _set_bindings(self, b):
188-
if isinstance(b, types.GeneratorType):
189+
if isinstance(b, (types.GeneratorType, itertools.islice)):
189190
self._genbindings = b
190191
self._bindings = []
191192
else:

setup.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ def find_version(filename):
4646
"Programming Language :: Python :: 3.4",
4747
"Programming Language :: Python :: 3.5",
4848
"Programming Language :: Python :: 3.6",
49+
"Programming Language :: Python :: 3.7",
4950
"License :: OSI Approved :: BSD License",
5051
"Topic :: Software Development :: Libraries :: Python Modules",
5152
"Operating System :: OS Independent",

0 commit comments

Comments
 (0)