summaryrefslogtreecommitdiff
path: root/kpov_judge/tasks/custom_rdate/task.py
diff options
context:
space:
mode:
Diffstat (limited to 'kpov_judge/tasks/custom_rdate/task.py')
-rw-r--r--kpov_judge/tasks/custom_rdate/task.py16
1 files changed, 8 insertions, 8 deletions
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)