replace
This commit is contained in:
parent
4b39d429f3
commit
0aef3aaeb1
@ -84,7 +84,7 @@ class BaseTester:
|
||||
with open(
|
||||
join(self.path, file.path), "wb"
|
||||
) as fs:
|
||||
fs.write(get_bytes(file.fs_id))
|
||||
fs.write(get_bytes(file.fs_id).replace(b"\r\n", b"\n"))
|
||||
self.solution.result = CONSTS["testing_status"]
|
||||
self.solution.save()
|
||||
docker_command = f"docker run --name solution_{self.solution.id} --volume=/sprint-data/solutions/{self.solution.id}:/{self.working_directory} -t -d {self.solution.language.image}"
|
||||
@ -95,7 +95,7 @@ class BaseTester:
|
||||
with open(
|
||||
join(self.path, file.filename), "wb"
|
||||
) as fs:
|
||||
fs.write(get_bytes(file.fs_id))
|
||||
fs.write(get_bytes(file.fs_id).replace(b"\r\n", b"\n"))
|
||||
print("Files copied")
|
||||
for file in listdir(self.path):
|
||||
chmod(join(self.path, file), 0o777)
|
||||
|
@ -3,19 +3,19 @@ from requests import get, post
|
||||
from Sprint import settings
|
||||
|
||||
|
||||
def write_bytes(data):
|
||||
def write_bytes(data: bytes):
|
||||
url = settings.FS_HOST + ":" + str(settings.FS_PORT) + "/upload_file"
|
||||
print(url)
|
||||
return post(url, data=data).json()["id"]
|
||||
|
||||
|
||||
def get_bytes(num):
|
||||
def get_bytes(num: int) -> bytes:
|
||||
url = settings.FS_HOST + ":" + str(settings.FS_PORT) + "/get_file?id=" + str(num)
|
||||
print(url)
|
||||
return get(url).content
|
||||
|
||||
|
||||
def delete_file(num):
|
||||
def delete_file(num: int):
|
||||
url = settings.FS_HOST + ":" + str(settings.FS_PORT) + "/delete_file?id=" + str(num)
|
||||
print(url)
|
||||
post(url)
|
||||
|
Loading…
Reference in New Issue
Block a user