mirror of https://github.com/explosion/spaCy.git
Fix formatting and remove unused code
This commit is contained in:
parent
b672e95045
commit
d7898d586f
|
@ -6,10 +6,10 @@ import json
|
||||||
import re
|
import re
|
||||||
import os.path
|
import os.path
|
||||||
import pathlib
|
import pathlib
|
||||||
|
|
||||||
import six
|
import six
|
||||||
from .attrs import TAG, HEAD, DEP, ENT_IOB, ENT_TYPE
|
from .attrs import TAG, HEAD, DEP, ENT_IOB, ENT_TYPE
|
||||||
|
|
||||||
|
|
||||||
try:
|
try:
|
||||||
basestring
|
basestring
|
||||||
except NameError:
|
except NameError:
|
||||||
|
@ -74,20 +74,6 @@ def split_data_name(name):
|
||||||
return name.split('-', 1) if '-' in name else (name, '')
|
return name.split('-', 1) if '-' in name else (name, '')
|
||||||
|
|
||||||
|
|
||||||
def constraint_match(constraint_string, version):
|
|
||||||
# From http://github.com/spacy-io/sputnik
|
|
||||||
if not constraint_string:
|
|
||||||
return True
|
|
||||||
|
|
||||||
constraints = [c.strip() for c in constraint_string.split(',') if c.strip()]
|
|
||||||
|
|
||||||
for c in constraints:
|
|
||||||
if not re.match(r'[><=][=]?\d+(\.\d+)*', c):
|
|
||||||
raise ValueError('invalid constraint: %s' % c)
|
|
||||||
|
|
||||||
return all(semver.match(version, c) for c in constraints)
|
|
||||||
|
|
||||||
|
|
||||||
def read_regex(path):
|
def read_regex(path):
|
||||||
path = path if not isinstance(path, basestring) else pathlib.Path(path)
|
path = path if not isinstance(path, basestring) else pathlib.Path(path)
|
||||||
with path.open() as file_:
|
with path.open() as file_:
|
||||||
|
|
Loading…
Reference in New Issue