Fix VNese bugs when after trimming
This commit is contained in:
parent
ffb6797c64
commit
d8e514911a
1 changed files with 5 additions and 5 deletions
|
@ -141,16 +141,16 @@ def read_head_archive(archive, file):
|
||||||
with archive.open(file) as f:
|
with archive.open(file) as f:
|
||||||
return f.read(settings.TESTCASE_VISIBLE_LENGTH + 3)
|
return f.read(settings.TESTCASE_VISIBLE_LENGTH + 3)
|
||||||
|
|
||||||
|
|
||||||
def get_visible_content(data):
|
def get_visible_content(data):
|
||||||
data = data or b''
|
data = data or b''
|
||||||
data = data.replace(b'\r\n', b'\r').replace(b'\r', b'\n')
|
data = data.replace(b'\r\n', b'\r').replace(b'\r', b'\n')
|
||||||
|
|
||||||
|
data = data.decode('utf-8')
|
||||||
|
|
||||||
if (len(data) > settings.TESTCASE_VISIBLE_LENGTH):
|
if (len(data) > settings.TESTCASE_VISIBLE_LENGTH):
|
||||||
data = data[:settings.TESTCASE_VISIBLE_LENGTH]
|
data = data[:settings.TESTCASE_VISIBLE_LENGTH]
|
||||||
data += b'.' * 3
|
data += '.' * 3
|
||||||
elif not data.endswith(b'\n'):
|
return data
|
||||||
data += b'\n'
|
|
||||||
return data.decode('utf-8')
|
|
||||||
|
|
||||||
|
|
||||||
def get_input_answer(case, archive):
|
def get_input_answer(case, archive):
|
||||||
|
|
Loading…
Reference in a new issue