mirror of
https://github.com/explosion/spaCy.git
synced 2024-11-10 19:57:17 +03:00
Merge for updated requirements
This commit is contained in:
commit
3ff7d7fcef
|
@ -59,6 +59,11 @@ elif is_python3:
|
|||
json_dumps = lambda data: ujson.dumps(data, indent=2)
|
||||
path2str = lambda path: str(path)
|
||||
|
||||
def getattr_(obj, name, *default):
|
||||
if is_python3 and isinstance(name, bytes):
|
||||
name = name.decode('utf8')
|
||||
return getattr(obj, name, *default)
|
||||
|
||||
|
||||
def symlink_to(orig, dest):
|
||||
if is_python2 and is_windows:
|
||||
|
@ -79,7 +84,7 @@ def is_config(python2=None, python3=None, windows=None, linux=None, osx=None):
|
|||
def normalize_string_keys(old):
|
||||
'''Given a dictionary, make sure keys are unicode strings, not bytes.'''
|
||||
new = {}
|
||||
for key, value in old:
|
||||
for key, value in old.items():
|
||||
if isinstance(key, bytes_):
|
||||
new[key.decode('utf8')] = value
|
||||
else:
|
||||
|
|
|
@ -22,7 +22,7 @@ import ujson
|
|||
|
||||
from .symbols import ORTH
|
||||
from .compat import cupy, CudaStream, path2str, basestring_, input_, unicode_
|
||||
from .compat import copy_array, normalize_string_keys
|
||||
from .compat import copy_array, normalize_string_keys, getattr_
|
||||
|
||||
|
||||
LANGUAGES = {}
|
||||
|
|
Loading…
Reference in New Issue
Block a user