diff options
Diffstat (limited to 'kpov_judge/tasks/copy_rename_20_files_tail_env')
-rw-r--r-- | kpov_judge/tasks/copy_rename_20_files_tail_env/task.py | 60 |
1 files changed, 30 insertions, 30 deletions
diff --git a/kpov_judge/tasks/copy_rename_20_files_tail_env/task.py b/kpov_judge/tasks/copy_rename_20_files_tail_env/task.py index e82e8ca..7e3c3c8 100644 --- a/kpov_judge/tasks/copy_rename_20_files_tail_env/task.py +++ b/kpov_judge/tasks/copy_rename_20_files_tail_env/task.py @@ -4,7 +4,7 @@ # TODO (polz): instructions = { - 'si':u""" + 'si':""" Prijavi se na sistem kot uporabnik student z geslom vaje. V domači mapi najdeš imenik {file_rename_dirname} z 20 datotekami. - Preimenuj vse datoteke tako, da zamenjaš minuse s podčrtaji @@ -32,7 +32,7 @@ V domači mapi najdeš imenik {file_rename_dirname} z 20 datotekami. v novo vrstico v count.txt in rezultat zapiši v novo datoteko - lines.txt v istem imeniku. """, - 'en':u""" + 'en':""" Log into the system as student using vaje as your password. In your home folder you will find a directory called {file_rename_dirname} containing 20 files. @@ -210,13 +210,13 @@ def gen_params(user_id, params_meta): r = random.Random(user_id) params['file_creator_random_seed'] = str(r.random()) params['file_rename_dirname'] = homedir + kpov_random_helpers.default_generators['dirname'](r) - params['mv_src_dir'] = homedir + "".join([r.choice("abcdefgh") for i in xrange(6)]) - params['mv_dst_dir'] = homedir + "".join([r.choice("ijklmnop") for i in xrange(6)]) + params['mv_src_dir'] = homedir + "".join([r.choice("abcdefgh") for i in range(6)]) + params['mv_dst_dir'] = homedir + "".join([r.choice("ijklmnop") for i in range(6)]) params['syslog_n_zmeda'] = str(r.randint(5, 15)) params['cowsay_string'] = kpov_random_helpers.default_generators['short_text'](r) params['curl_fname'] = kpov_random_helpers.default_generators['filename'](r) params['curl_n_images'] = str(r.randint(30,100)) - params['wc_dirname'] = homedir + "".join([r.choice("rstuvxz") for i in xrange(8)]) + params['wc_dirname'] = homedir + "".join([r.choice("rstuvxz") for i in range(8)]) params['wc_n_lines'] = str(r.randint(200, 600)) #params['phttp'] = "8080" #params['images'] = subprocess.check_output(["echo","$images"]) @@ -229,8 +229,8 @@ def task_check(results, params): hints = [] r = random.Random(params['file_creator_random_seed']) fnames = [] - for i in xrange(20): - fnames.append("".join([ r.choice("_abcdefghijk") for j in xrange(8)])) + for i in range(20): + fnames.append("".join([ r.choice("_abcdefghijk") for j in range(8)])) #TO FINISH SCORING WE REQUIRE DICT KEYS AND FUNCTIONS gen_params AND task TO BE FINISHED #POINTS FOR EACH TASK MAY BE ADJUSTED IN THE FUTURE #TASK 1 @@ -251,8 +251,8 @@ def task_check(results, params): # premakni datoteke s cim krajsim ukazom fnames = [] try: - for i in xrange(40): - fnames.append("".join([ r.choice("123456789abcdefghijk") for j in xrange(8)])) + for i in range(40): + fnames.append("".join([ r.choice("123456789abcdefghijk") for j in range(8)])) task2_re = re.search( r"-rw[x-][r-][w-][x-][r-][w-][x-] \d* student student (\d*) .*mv_ukaz", results['mv_ls_size']) @@ -280,17 +280,17 @@ def task_check(results, params): # task3_ok = True mama_fnames = [] - for i in xrange(20): - mama_fnames.append("".join([ r.choice("123456789abcdefghijk") for j in xrange(8)])) + for i in range(20): + mama_fnames.append("".join([ r.choice("123456789abcdefghijk") for j in range(8)])) papa_fnames = [] - for i in xrange(20): - papa_fnames.append("".join([ r.choice("123456789abcdefghijk") for j in xrange(8)])) + for i in range(20): + papa_fnames.append("".join([ r.choice("123456789abcdefghijk") for j in range(8)])) dirnames = [] - for i in xrange(20): - dirnames.append("".join([ r.choice("123456789abcdefghijk") for j in xrange(8)])) + for i in range(20): + dirnames.append("".join([ r.choice("123456789abcdefghijk") for j in range(8)])) linknames = [] - for i in xrange(20): - linknames.append("".join([ r.choice("123456789abcdefghijk") for j in xrange(8)])) + for i in range(20): + linknames.append("".join([ r.choice("123456789abcdefghijk") for j in range(8)])) #print( results['grep_mama']) #print( results['grep_napake']) for i in dirnames + linknames + papa_fnames: @@ -356,17 +356,17 @@ def prepare_disks(templates, task_params, global_params): # rename d.mkdir(task_params['file_rename_dirname']) d.chown(1000, 1000, task_params['file_rename_dirname']) - for i in xrange(20): + for i in range(20): fname = task_params['file_rename_dirname'] + '/' + "".join( - [r.choice("-abcdefghijk") for j in xrange(8)]) + [r.choice("-abcdefghijk") for j in range(8)]) d.touch(fname) d.chown(1000, 1000, fname) # mv ukaz d.mkdir(task_params['mv_src_dir']) d.chown(1000, 1000, task_params['mv_src_dir']) - for i in xrange(40): + for i in range(40): fname = task_params['mv_src_dir'] + '/' +"".join( - [r.choice("123456789abcdefghijk") for j in xrange(8)]) + [r.choice("123456789abcdefghijk") for j in range(8)]) d.touch(fname) d.chown(1000, 1000, fname) d.mkdir(task_params['mv_dst_dir']) @@ -374,27 +374,27 @@ def prepare_disks(templates, task_params, global_params): # grep mama # mama fnames d.mkdir('/home/student/grep_test_dir') - for i in xrange(20): + for i in range(20): d.write("/home/student/grep_test_dir/" + "".join( - [ r.choice("123456789abcdefghijk") for j in xrange(8)]), + [ r.choice("123456789abcdefghijk") for j in range(8)]), "mama") # papa fnames - for i in xrange(20): + for i in range(20): d.write("/home/student/grep_test_dir/" + "".join( - [ r.choice("123456789abcdefghijk") for j in xrange(8)]), + [ r.choice("123456789abcdefghijk") for j in range(8)]), "papa") # dirnames - for i in xrange(20): + for i in range(20): d.mkdir("/home/student/grep_test_dir/" + "".join( - [ r.choice("123456789abcdefghijk") for j in xrange(8)])) + [ r.choice("123456789abcdefghijk") for j in range(8)])) # linknames - for i in xrange(20): + for i in range(20): d.ln_sf("mali zeleni", "/home/student/grep_test_dir/" + "".join( - [ r.choice("123456789abcdefghijk") for j in xrange(8)])) + [ r.choice("123456789abcdefghijk") for j in range(8)])) # sledenje syslog spammer_source = "#!/bin/sh\n" + int(task_params['syslog_n_zmeda']) * "logger zmeda\n" d.write("/usr/local/bin/syslog_spammer", spammer_source) - d.chmod(0775, "/usr/local/bin/syslog_spammer") + d.chmod(0o775, "/usr/local/bin/syslog_spammer") # curl l1 = ['images'] * int(task_params['curl_n_images']) l2 = ['imeges'] * r.randint(30, 100) |