mirror of
https://github.com/explosion/spaCy.git
synced 2024-12-25 01:16:28 +03:00
Add path2str compat function
This commit is contained in:
parent
e34069db9f
commit
311704674d
|
@ -32,6 +32,7 @@ if is_python2:
|
||||||
basestring_ = basestring
|
basestring_ = basestring
|
||||||
input_ = raw_input
|
input_ = raw_input
|
||||||
json_dumps = lambda data: ujson.dumps(data, indent=2).decode('utf8')
|
json_dumps = lambda data: ujson.dumps(data, indent=2).decode('utf8')
|
||||||
|
path2str = lambda path: str(path).decode('utf8')
|
||||||
|
|
||||||
elif is_python3:
|
elif is_python3:
|
||||||
bytes_ = bytes
|
bytes_ = bytes
|
||||||
|
@ -39,12 +40,13 @@ elif is_python3:
|
||||||
basestring_ = str
|
basestring_ = str
|
||||||
input_ = input
|
input_ = input
|
||||||
json_dumps = lambda data: ujson.dumps(data, indent=2)
|
json_dumps = lambda data: ujson.dumps(data, indent=2)
|
||||||
|
path2str = lambda path: str(path)
|
||||||
|
|
||||||
|
|
||||||
def symlink_to(orig, dest):
|
def symlink_to(orig, dest):
|
||||||
if is_python2 and is_windows:
|
if is_python2 and is_windows:
|
||||||
import subprocess
|
import subprocess
|
||||||
subprocess.call(['mklink', '/d', unicode(orig), unicode(dest)], shell=True)
|
subprocess.call(['mklink', '/d', path2str(orig), path2str(dest)], shell=True)
|
||||||
else:
|
else:
|
||||||
orig.symlink_to(dest)
|
orig.symlink_to(dest)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user