summaryrefslogtreecommitdiff
path: root/kpov_judge/tasks/custom_rdate
diff options
context:
space:
mode:
authorTimotej Lazar <timotej.lazar@fri.uni-lj.si>2018-09-26 16:23:29 +0200
committerTimotej Lazar <timotej.lazar@fri.uni-lj.si>2018-09-26 16:23:29 +0200
commit03c9d6d8441e3293b058fed270866419781b734c (patch)
treea456f12f5c26c836685c6e47c95cfe2897e43723 /kpov_judge/tasks/custom_rdate
parent3938c69f3e1586c1ffbcae5395414ca8480e6ba4 (diff)
Run 2to3
Some stuff is broken now.
Diffstat (limited to 'kpov_judge/tasks/custom_rdate')
-rw-r--r--kpov_judge/tasks/custom_rdate/rDate.py2
-rw-r--r--kpov_judge/tasks/custom_rdate/task.py16
2 files changed, 9 insertions, 9 deletions
diff --git a/kpov_judge/tasks/custom_rdate/rDate.py b/kpov_judge/tasks/custom_rdate/rDate.py
index 1ceafaa..97885b0 100644
--- a/kpov_judge/tasks/custom_rdate/rDate.py
+++ b/kpov_judge/tasks/custom_rdate/rDate.py
@@ -14,5 +14,5 @@ podatek = s.recv(4)
stevilka = struct.unpack("!I", podatek)
st= stevilka[0]-220898800
date = time.localtime(st)
-print(time.strftime('%Y-%m-%d %H:%M:%S'),date)
+print((time.strftime('%Y-%m-%d %H:%M:%S'), date))
s.send(date)
diff --git a/kpov_judge/tasks/custom_rdate/task.py b/kpov_judge/tasks/custom_rdate/task.py
index 867e037..b84a2b7 100644
--- a/kpov_judge/tasks/custom_rdate/task.py
+++ b/kpov_judge/tasks/custom_rdate/task.py
@@ -4,7 +4,7 @@
# kpov_random_helpers should be imported by add_assignment.py
# TODO: finish this!
instructions = {
- 'si':u"""
+ 'si':"""
Postavite dva navidezna racunalnika:
- SimpleArbiterDhcpRdate s slike diska simpleArbiterRdate ter
- rdateClient.
@@ -18,7 +18,7 @@ predznaceno celo število, pri čemer naj uporablja zapis z debelim koncem
(big endian).
Število naj program izpiše na standardni izhod v obliki niza.
""",
- 'en':u"""
+ 'en':"""
Setup two virtual machines:
- SimpleArbiterDhcpRdate from disk image simpleArbiterRdate and
- rdateClient.
@@ -69,9 +69,9 @@ networks = { 'net1': {'public': False}, 'test-net': {'public': True} }
# Tu sem dolocil parametre
params_meta = {
- 'RDATE_OFFSET':{'descriptions': {'si': u'Napaka v času pri rdate', 'en': 'Timekeeping error for rdate'}, 'w': False, 'public': False, 'type': 'integer', 'generated': True},
- 'PROGRAM_FILENAME':{'descriptions': {'si': u'Ime programa', 'en': 'program filename'}, 'w': False, 'public': True, 'type': 'integer', 'generated': True},
- 'IP_RDATECLIENT':{'descriptions': {'si': u'IP rdateClient', "en": "rdateClient's IP"}, 'w': True, 'public': True, 'type': 'IP', 'generated': False},
+ 'RDATE_OFFSET':{'descriptions': {'si': 'Napaka v času pri rdate', 'en': 'Timekeeping error for rdate'}, 'w': False, 'public': False, 'type': 'integer', 'generated': True},
+ 'PROGRAM_FILENAME':{'descriptions': {'si': 'Ime programa', 'en': 'program filename'}, 'w': False, 'public': True, 'type': 'integer', 'generated': True},
+ 'IP_RDATECLIENT':{'descriptions': {'si': 'IP rdateClient', "en": "rdateClient's IP"}, 'w': True, 'public': True, 'type': 'IP', 'generated': False},
}
def task(IP_RDATECLIENT, PROGRAM_FILENAME):
@@ -90,7 +90,7 @@ def task(IP_RDATECLIENT, PROGRAM_FILENAME):
client.connect(IP_RDATECLIENT, username=peer_user, password=peer_passwd)
#client.login(IP_RDATECLIENT, peer_user, peer_passwd)
r = random.Random(PROGRAM_FILENAME)
- for i in xrange(10):
+ for i in range(10):
stdin, stdout, stderr = client.exec_command(
'~/{}'.format(PROGRAM_FILENAME))
data = struct.pack("!I", r.randint(0, 2**32))
@@ -128,7 +128,7 @@ def task_check(results, params):
r = random.Random(params['PROGRAM_FILENAME'])
score = 0.0
hints = []
- for i in xrange(10):
+ for i in range(10):
data = base64.decodestring(results['in_' + str(i)])
x = struct.pack("!I", r.randint(0, 2**32))
if data != x:
@@ -174,5 +174,5 @@ t = time.time() + 2208988800 + offset
sys.stdout.write(struct.pack("!I", int(t)))
"""
d.write('/usr/local/bin/kpovrdate', s2)
- d.chmod(0775, '/usr/local/bin/kpovrdate')
+ d.chmod(0o775, '/usr/local/bin/kpovrdate')
write_default_config(templates['simpleArbiterDhcpGWRdate'], global_params)