parent
ac1e8a4efe
commit
6ca6271170
@ -30,6 +30,7 @@ import datetime
|
|||||||
import traceback
|
import traceback
|
||||||
import functools
|
import functools
|
||||||
import contextlib
|
import contextlib
|
||||||
|
import posixpath
|
||||||
import socket
|
import socket
|
||||||
import shlex
|
import shlex
|
||||||
import glob
|
import glob
|
||||||
@ -165,6 +166,9 @@ def read_file(filename, binary=False):
|
|||||||
Return:
|
Return:
|
||||||
The file contents as string.
|
The file contents as string.
|
||||||
"""
|
"""
|
||||||
|
assert not posixpath.isabs(filename), filename
|
||||||
|
assert os.path.pardir not in filename.split(posixpath.sep), filename
|
||||||
|
|
||||||
if not binary and filename in _resource_cache:
|
if not binary and filename in _resource_cache:
|
||||||
return _resource_cache[filename]
|
return _resource_cache[filename]
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user