From 6bba1db4cc41ef22bcba14046b498572019fba3e Mon Sep 17 00:00:00 2001 From: ines Date: Sun, 18 Feb 2018 13:29:56 +0100 Subject: [PATCH] Drop six and related hacks as a dependency --- requirements.txt | 2 -- setup.py | 2 -- spacy/compat.py | 8 ++++---- spacy/tests/lang/en/test_tagger.py | 6 +++--- 4 files changed, 7 insertions(+), 11 deletions(-) diff --git a/requirements.txt b/requirements.txt index ff400b03a..a283d6952 100644 --- a/requirements.txt +++ b/requirements.txt @@ -6,7 +6,6 @@ preshed>=1.0.0,<2.0.0 thinc>=6.10.1,<6.11.0 murmurhash>=0.28,<0.29 plac<1.0.0,>=0.9.6 -six ujson>=1.35 dill>=0.2,<0.3 requests>=2.13.0,<3.0.0 @@ -16,4 +15,3 @@ pytest>=3.0.6,<4.0.0 mock>=2.0.0,<3.0.0 msgpack-python msgpack-numpy==0.4.1 -html5lib==1.0b8 diff --git a/setup.py b/setup.py index 7c26a7491..0b39b1444 100755 --- a/setup.py +++ b/setup.py @@ -191,8 +191,6 @@ def setup_package(): 'preshed>=1.0.0,<2.0.0', 'thinc>=6.10.1,<6.11.0', 'plac<1.0.0,>=0.9.6', - 'six', - 'html5lib==1.0b8', 'pathlib', 'ujson>=1.35', 'dill>=0.2,<0.3', diff --git a/spacy/compat.py b/spacy/compat.py index 3cc214b28..de98f54cc 100644 --- a/spacy/compat.py +++ b/spacy/compat.py @@ -1,7 +1,6 @@ # coding: utf8 from __future__ import unicode_literals -import six import ftfy import sys import ujson @@ -47,9 +46,10 @@ is_windows = sys.platform.startswith('win') is_linux = sys.platform.startswith('linux') is_osx = sys.platform == 'darwin' -is_python2 = six.PY2 -is_python3 = six.PY3 -is_python_pre_3_5 = is_python2 or (is_python3 and sys.version_info[1]<5) +# See: https://github.com/benjaminp/six/blob/master/six.py +is_python2 = sys.version_info[0] == 2 +is_python3 = sys.version_info[0] == 3 +is_python_pre_3_5 = is_python2 or (is_python3 and sys.version_info[1] < 5) if is_python2: bytes_ = str diff --git a/spacy/tests/lang/en/test_tagger.py b/spacy/tests/lang/en/test_tagger.py index a77e6d636..0959ba7c7 100644 --- a/spacy/tests/lang/en/test_tagger.py +++ b/spacy/tests/lang/en/test_tagger.py @@ -2,9 +2,9 @@ from __future__ import unicode_literals from ....parts_of_speech import SPACE +from ....compat import unicode_ from ...util import get_doc -import six import pytest @@ -24,8 +24,8 @@ def test_tag_names(EN): text = "I ate pizzas with anchovies." doc = EN(text, disable=['parser']) assert type(doc[2].pos) == int - assert isinstance(doc[2].pos_, six.text_type) - assert isinstance(doc[2].dep_, six.text_type) + assert isinstance(doc[2].pos_, unicode_) + assert isinstance(doc[2].dep_, unicode_) assert doc[2].tag_ == u'NNS'